Sanrio Alvares | a5ecd98 | 2016-06-08 10:54:33 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Scott D Phillips | 37a5198 | 2015-10-07 15:40:59 -0700 | [diff] [blame] | 3 | set -e |
| 4 | |
Sanrio Alvares | a5ecd98 | 2016-06-08 10:54:33 -0700 | [diff] [blame] | 5 | if [[ -z "${1// }" ]] |
| 6 | then |
| 7 | echo "To sign u-boot, run build_for_brillo.sh --sign." |
| 8 | echo "Building u-boot..." |
| 9 | sleep 2 |
| 10 | else |
| 11 | if [ "$1" == "--sign" ] |
| 12 | then |
| 13 | echo "Building u-boot for signing..." |
| 14 | sleep 2 |
| 15 | else |
| 16 | echo "To sign u-boot, run build_for_brillo.sh --sign" |
| 17 | exit |
| 18 | fi |
| 19 | fi |
| 20 | |
Scott D Phillips | 37a5198 | 2015-10-07 15:40:59 -0700 | [diff] [blame] | 21 | rm -rf out |
| 22 | |
| 23 | make O=out CROSS_COMPILE=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin/x86_64-linux-android- CFLAGS=-m32 -j$(nproc) edison_defconfig |
| 24 | make O=out CROSS_COMPILE=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin/x86_64-linux-android- CFLAGS=-m32 -j$(nproc) |
| 25 | |
| 26 | rm -rf out-fastboot |
| 27 | |
Sanrio Alvares | a5ecd98 | 2016-06-08 10:54:33 -0700 | [diff] [blame] | 28 | if [ "$1" == "--sign" ] |
| 29 | then |
| 30 | make O=out-fastboot CROSS_COMPILE=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin/x86_64-linux-android- CFLAGS=-m32 KCPPFLAGS=-DCONFIG_BRILLO_FASTBOOT_ONLY KCPPFLAGS=-DCONFIG_OSIP_SIGNED_ATTRIBUTE -j$(nproc) edison_defconfig |
| 31 | make O=out-fastboot CROSS_COMPILE=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin/x86_64-linux-android- CFLAGS=-m32 KCPPFLAGS=-DCONFIG_BRILLO_FASTBOOT_ONLY KCPPFLAGS=-DCONFIG_OSIP_SIGNED_ATTRIBUTE -j$(nproc) |
| 32 | else |
| 33 | make O=out-fastboot CROSS_COMPILE=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin/x86_64-linux-android- CFLAGS=-m32 KCPPFLAGS=-DCONFIG_BRILLO_FASTBOOT_ONLY -j$(nproc) edison_defconfig |
| 34 | make O=out-fastboot CROSS_COMPILE=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin/x86_64-linux-android- CFLAGS=-m32 KCPPFLAGS=-DCONFIG_BRILLO_FASTBOOT_ONLY -j$(nproc) |
| 35 | fi |
Scott D Phillips | 37a5198 | 2015-10-07 15:40:59 -0700 | [diff] [blame] | 36 | |
| 37 | dd if=out/u-boot.bin of=u-boot-edison.bin bs=4096 seek=1 |
Sanrio Alvares | a5ecd98 | 2016-06-08 10:54:33 -0700 | [diff] [blame] | 38 | if [ "$1" == "--sign" ] |
| 39 | then |
| 40 | dd if=out-fastboot/u-boot.bin of=u-boot-edison.img obs=4096 seek=1 |
| 41 | echo "Use Image Studio Tool to sign u-boot-edison.bin and u-boot-edison.img." |
| 42 | else |
| 43 | openssl base64 -d <<EOF | xz -d > u-boot-edison.img |
| 44 | /Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4AH/ADJdABITxmI/dj2HEN524/dYfdgu |
| 45 | VSVrkQEE6XSgsZnwdRltLRkU6GTigpK5eAw3CQAaRzcAAAAAtBe6DKrPzUcAAU6A |
| 46 | BAAAAASYg8ixxGf7AgAAAAAEWVo= |
Scott D Phillips | 37a5198 | 2015-10-07 15:40:59 -0700 | [diff] [blame] | 47 | EOF |
Sanrio Alvares | a5ecd98 | 2016-06-08 10:54:33 -0700 | [diff] [blame] | 48 | dd if=out-fastboot/u-boot.bin of=u-boot-edison.img bs=4608 seek=1 |
| 49 | fi |