.. | .. |
---|
1 | 1 | #!/bin/bash |
---|
2 | 2 | |
---|
3 | | -if [ x"$1" == "xu" ] ;then |
---|
4 | | - cd longan/brandy/brandy-2.0 |
---|
5 | | - ./build.sh -p sun50iw10p1 |
---|
6 | | - cd - |
---|
7 | | -fi |
---|
| 3 | +BOARD_CONFIG_DIR=longan/device/config/chips/ |
---|
| 4 | +BOARD_CONFIG_FILE=longan/device/.BoardConfig.mk |
---|
8 | 5 | |
---|
9 | | -if [ x"$1" == "xk" ] ;then |
---|
10 | | - cd longan && ./build.sh && cd - |
---|
11 | | - if [ $? -eq 0 ]; then |
---|
12 | | - echo "Build kernel ok!" |
---|
13 | | - else |
---|
14 | | - echo "Build kernel failed!" |
---|
15 | | - exit 1 |
---|
16 | | - fi |
---|
17 | | - |
---|
18 | | - cd android |
---|
19 | | - . ./build/envsetup.sh |
---|
20 | | - lunch ceres_c3-userdebug |
---|
21 | | - extract-bsp && pack |
---|
22 | | - cd - |
---|
23 | | -fi |
---|
| 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/. /" |
---|
24 | 11 | |
---|
25 | | -if [ x"$1" == "xa" ] ;then |
---|
26 | | - cd android |
---|
27 | | - . ./build/envsetup.sh |
---|
28 | | - lunch ceres_c3-userdebug |
---|
29 | | - extract-bsp |
---|
30 | | - make installclean |
---|
31 | | - make BUILD_NUMBER=ido-a133 -j32 && pack |
---|
32 | | -# make -j10 && pack -v |
---|
33 | | - cd - |
---|
34 | | -fi |
---|
| 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]}" |
---|
35 | 17 | |
---|
36 | | -if [ x"$1" == "xp" ] ;then |
---|
37 | | - cd android |
---|
38 | | - . ./build/envsetup.sh |
---|
39 | | - lunch ceres_c3-userdebug |
---|
40 | | - extract-bsp && pack |
---|
41 | | - cd - |
---|
42 | | -fi |
---|
| 18 | + break |
---|
| 19 | + else |
---|
| 20 | + echo "Invalid input. Please enter a number between 1 and ${#TARGET_BOARD_ARRAY[@]}." |
---|
| 21 | + fi |
---|
| 22 | + done |
---|
43 | 23 | |
---|
| 24 | + cp -f $BUILD_TARGET_BOARD $BOARD_CONFIG_FILE |
---|
| 25 | + |
---|
| 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}" |
---|
| 30 | + |
---|
| 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 |
---|
| 35 | +} |
---|
| 36 | + |
---|
| 37 | +if [ "x$1" == "xlunch" ]; then |
---|
| 38 | + build_lunch && exit 0 |
---|
| 39 | +else |
---|
| 40 | + source $BOARD_CONFIG_FILE |
---|
| 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 - |
---|
| 53 | + fi |
---|
| 54 | + |
---|
| 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 - |
---|
| 68 | + fi |
---|
| 69 | + |
---|
| 70 | + # android envsetup |
---|
| 71 | + cd android |
---|
| 72 | + . ./build/envsetup.sh |
---|
| 73 | + lunch ceres_c3-userdebug |
---|
| 74 | + extract-bsp |
---|
| 75 | + cd - |
---|
| 76 | + |
---|
| 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 - |
---|
| 90 | + fi |
---|
| 91 | + |
---|
| 92 | + # pack image |
---|
| 93 | + echo "Start pack image" |
---|
| 94 | + cd android |
---|
| 95 | + pack |
---|
| 96 | + cd - |
---|
| 97 | + |
---|
| 98 | +fi |
---|