-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbuild.sh
executable file
·50 lines (43 loc) · 1.2 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
KERNEL_DIR="${KERNEL_DIR:-}"
CROSS_COMPILE=mipsel-linux-
DEFAULT_KERNEL_VERSION="3.10"
# Check if KERNEL_DIR is empty
if [ -z "$KERNEL_DIR" ]; then
echo "Error: KERNEL_DIR is not set. Please specify the kernel directory in this script."
exit 1
fi
# Extract SoC and Kernel Version from arguments
SOC_MODEL="$1"
KERNEL_VERSION="${2:-$DEFAULT_KERNEL_VERSION}" # Use second argument or default to 3.10
case "$SOC_MODEL" in
clean)
find . -type f -name "*.o" -delete
find . -type f -name "*.o.*" -delete
find . -type f -name "*.ko" -delete
find . -type f -name "*.ko.*" -delete
find . -type f -name "*.mod.c" -delete
rm -f Module.symvers
rm -f modules.order
rm -rf .tmp_versions
exit 0
;;
t10 | t20 | t21 | t23 | t30 | t31 | t40 | t41)
export ISP_ENV_KERNEL_DIR="${KERNEL_DIR}"
export CROSS_COMPILE="mipsel-linux-"
FAM="SOC_FAMILY=$SOC_MODEL CONFIG_SOC_${SOC_MODEL^^}=y KERNEL_VERSION=${KERNEL_VERSION}"
make \
V=0 \
BR2_THINGINO_MOTORS=y \
BR2_THINGINO_MOTORS_SPI=y \
ARCH=mips \
$FAM -C $ISP_ENV_KERNEL_DIR M=$PWD ${@:3}
;;
*)
echo "Usage: $0 <soc> [kernel_version] <make_args>"
echo "Usage: $0 clean"
echo "Example: $0 t20 3.10"
exit 1
;;
esac
exit 0