huangcm
2025-04-11 9871d522be7037db6670d22c28feb398699c03cc
build.sh
....@@ -3,60 +3,68 @@
33 BOARD_CONFIG_DIR=longan/device/config/chips/
44 BOARD_CONFIG_FILE=longan/device/.BoardConfig.mk
55
6
-function build_lunch()
7
-{
8
- TARGET_BOARD_PATH_ARRAY=( $(find $BOARD_CONFIG_DIR -name "BoardConfig-a133*.mk" | sort) )
9
- TARGET_BOARD_ARRAY=( $(find $BOARD_CONFIG_DIR -name "BoardConfig-a133*.mk" | sed 's#.*/##' | sort) )
10
- echo "======you are building a133 android======"
11
- echo "${TARGET_BOARD_ARRAY[@]}" |xargs -n 1 | sed "=" | sed "N;s/\n/. /"
6
+function build_lunch() {
7
+ TARGET_BOARD_PATH_ARRAY=($(find $BOARD_CONFIG_DIR -name "BoardConfig-a133*.mk" | sort))
8
+ TARGET_BOARD_ARRAY=($(find $BOARD_CONFIG_DIR -name "BoardConfig-a133*.mk" | sed 's#.*/##' | sort))
9
+ echo "======you are building a133 android======"
10
+ echo "${TARGET_BOARD_ARRAY[@]}" | xargs -n 1 | sed "=" | sed "N;s/\n/. /"
1211
13
- while true; do
14
- read -p "which board would you like (1-${#TARGET_BOARD_ARRAY[@]}): " INDEX
15
- if [[ "$INDEX" =~ ^[0-9]+$ ]] && ((INDEX >= 1 && INDEX <= ${#TARGET_BOARD_ARRAY[@]})); then
16
- INDEX=$(($INDEX - 1))
17
- BUILD_TARGET_BOARD="${TARGET_BOARD_PATH_ARRAY[$INDEX]}"
12
+ while true; do
13
+ read -p "which board would you like (1-${#TARGET_BOARD_ARRAY[@]}): " INDEX
14
+ if [[ "$INDEX" =~ ^[0-9]+$ ]] && ((INDEX >= 1 && INDEX <= ${#TARGET_BOARD_ARRAY[@]})); then
15
+ INDEX=$(($INDEX - 1))
16
+ BUILD_TARGET_BOARD="${TARGET_BOARD_PATH_ARRAY[$INDEX]}"
1817
19
- break
20
- else
21
- echo "Invalid input. Please enter a number between 1 and ${#TARGET_BOARD_ARRAY[@]}."
22
- fi
23
- done
18
+ break
19
+ else
20
+ echo "Invalid input. Please enter a number between 1 and ${#TARGET_BOARD_ARRAY[@]}."
21
+ fi
22
+ done
2423
25
- cp -f $BUILD_TARGET_BOARD $BOARD_CONFIG_FILE
24
+ cp -f $BUILD_TARGET_BOARD $BOARD_CONFIG_FILE
2625
27
- echo -e "build target board configuration: $BUILD_TARGET_BOARD\n"
28
- #select partition table
29
- source $BOARD_CONFIG_FILE
30
- echo "you board is ${DTS_NAME}"
26
+ echo -e "build target board configuration: $BUILD_TARGET_BOARD\n"
27
+ #select partition table
28
+ source $BOARD_CONFIG_FILE
29
+ echo "you board is ${DTS_NAME}"
3130
32
- source $BOARD_CONFIG_FILE
33
- longan/build/mkcommon.sh autoconfig -i a133 -o android -b c3
31
+ echo "Start clean kerenl"
32
+ cd longan/kernel/linux-4.9 && make clean -j32 && cd -
33
+ source $BOARD_CONFIG_FILE
34
+ longan/build/mkcommon.sh autoconfig -i a133 -o android -b c3
3435 }
3536
36
-if [ "x$1" == "xlunch" ];then
37
+if [ "x$1" == "xlunch" ]; then
3738 build_lunch && exit 0
3839 else
3940 source $BOARD_CONFIG_FILE
40
- if [ x"$1" == "xuboot" ] || [ x"$1" == "xu" ] || [ x"$1" == "x" ] ;then
41
- echo "Start build uboot"
42
- cd longan/brandy/brandy-2.0 && ./build.sh -p sun50iw10p1 && cd -
43
- if [ $? -eq 0 ]; then
44
- echo "Build uboot ok!"
45
- else
46
- echo "Build uboot failed!"
47
- exit 1
48
- fi
41
+ if [ x"$1" == "xuboot" ] || [ x"$1" == "xu" ] || [ x"$1" == "x" ]; then
42
+ echo "Start build uboot"
43
+ cd longan/brandy/brandy-2.0
44
+ ./build.sh -p sun50iw10p1
45
+ if [ $? -eq 0 ]; then
46
+ echo "Build uboot ok!"
47
+ else
48
+ echo "Build uboot failed!"
49
+ cd -
50
+ exit 1
51
+ fi
52
+ cd -
4953 fi
5054
51
- if [ x"$1" == "xkernel" ] || [ x"$1" == "xk" ] || [ x"$1" == "x" ] ;then
52
- echo "Start build kernel"
53
- cd longan && ./build.sh autoconfig -o android -i a133 -b c3 && ./build.sh && cd -
54
- if [ $? -eq 0 ]; then
55
- echo "Build kernel ok!"
56
- else
57
- echo "Build kernel failed!"
58
- exit 1
59
- fi
55
+ if [ x"$1" == "xkernel" ] || [ x"$1" == "xk" ] || [ x"$1" == "x" ]; then
56
+ echo "Start build kernel"
57
+ cd longan
58
+ ./build.sh autoconfig -o android -i a133 -b c3
59
+ ./build.sh
60
+ if [ $? -eq 0 ]; then
61
+ echo "Build kernel ok!"
62
+ else
63
+ echo "Build kernel failed!"
64
+ cd -
65
+ exit 1
66
+ fi
67
+ cd -
6068 fi
6169
6270 # android envsetup
....@@ -66,12 +74,19 @@
6674 extract-bsp
6775 cd -
6876
69
- if [ x"$1" == "xandroid" ] || [ x"$1" == "xa" ] || [ x"$1" == "x" ] ;then
70
- echo "Start build Android"
71
- cd android
72
- make installclean
73
- make BUILD_NUMBER=ido-a133 -j32
74
- cd -
77
+ if [ x"$1" == "xandroid" ] || [ x"$1" == "xa" ] || [ x"$1" == "x" ]; then
78
+ echo "Start build Android"
79
+ cd android
80
+ make installclean
81
+ make BUILD_NUMBER=ido-a133 -j32
82
+ if [ $? -eq 0 ]; then
83
+ echo "Build android ok!"
84
+ else
85
+ echo "Build android failed!"
86
+ cd -
87
+ exit 1
88
+ fi
89
+ cd -
7590 fi
7691
7792 # pack image
....@@ -80,4 +95,4 @@
8095 pack
8196 cd -
8297
83
-fi
98
+fi