From: Marek Szyprowski Date: Mon, 30 Nov 2020 13:14:04 +0000 (+0100) Subject: tizen: unify build script for all boards X-Git-Tag: accepted/tizen/unified/20221108.163909~144 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=582b9e24f949fd851abbbe2a2b6a60929c2d3829;p=platform%2Fkernel%2Fu-boot.git tizen: unify build script for all boards Use the same build script for all Amlogic boards. Signed-off-by: Marek Szyprowski Change-Id: I69565c89e3960bbe353545df217f5e81d00465a4 --- diff --git a/tizen/build-amlogic.sh b/tizen/build-amlogic.sh new file mode 100755 index 0000000..42d4d88 --- /dev/null +++ b/tizen/build-amlogic.sh @@ -0,0 +1,121 @@ +#!/bin/bash + +CROSS_COMPILE=${CROSS_COMPILE:-/usr/bin/aarch64-linux-gnu-} +JOBS="-j 5" + +case $1 in +c4) + FIP=fip/c4 + CONFIG=odroid-c4_defconfig + ENCRYPT=fip/aml_encrypt_g12a + NAME=ODROID-C4 + PARAMS=params-c4.bin + OUTPUT_BIN=u-boot-c4.bin + OUTPUT_TAR=odroidc4_bootloader.tar +;; +n2) + FIP=fip/n2 + CONFIG=odroid-n2_defconfig + ENCRYPT=fip/aml_encrypt_g12b + NAME=ODROID-N2 + PARAMS=params-n2.bin + OUTPUT_BIN=u-boot-n2.bin + OUTPUT_TAR=odroidn2_bootloader.tar +;; +vim3) + FIP=fip/kvim3 + CONFIG=khadas-vim3_defconfig + ENCRYPT=fip/aml_encrypt_g12b + NAME="Khadas VIM3" + PARAMS=params-vim3.bin + OUTPUT_BIN=u-boot-kvim3.bin + OUTPUT_TAR=kvim3_bootloader.tar +;; +vim3l) + FIP=fip/kvim3l + CONFIG=khadas-vim3l_defconfig + ENCRYPT=fip/aml_encrypt_g12a + NAME="Khadas VIM3L" + PARAMS=params-vim3l.bin + OUTPUT_BIN=u-boot-kvim3l.bin + OUTPUT_TAR=kvim3l_bootloader.tar +;; +*) + echo "U-boot building script for Tizen Amlogic boards" + echo "Usage: $0 target" + echo "where target is: c4 n2 vim3 vim3l" + exit +;; +esac + +# Check this system has ccache +check_ccache() +{ + type ccache + if [ "$?" -eq "0" ]; then + CCACHE=ccache + fi +} + +build_uboot() +{ + if [ -d output ]; then + rm output/* + fi + + [ -d output ] || mkdir -p output + + if ! [ -e .config ] ; then + make ARCH=arm64 ${CONFIG} + fi + make CROSS_COMPILE="$CCACHE $CROSS_COMPILE" $JOBS + ./tools/mkimage -A arm64 -T script -C none -n "Tizen ${NAME} u-boot helper" -d ./tizen/bootscript/tizen-boot-amlogic-64b.scr ./output/boot.scr.uimg + +} + +generate_param() { + cp `find ./env -name "built-in.o"` copy_env_common.o + ${CROSS_COMPILE}objcopy -O binary --only-section=.rodata.default_environment `find . -name "copy_env_common.o"` + tr '\0' '\n' < copy_env_common.o > default_envs.txt + ./tools/mkenvimage -s 16384 -o params.bin default_envs.txt + rm copy_env_common.o default_envs.txt +} + +build_amlogic() +{ + if [ -e u-boot.bin ] ; then + cp u-boot.bin output/bl33.bin + fi + + ./${ENCRYPT} --bl3sig --input output/bl33.bin --compress lz4 \ + --output output/bl33.bin.enc \ + --level v3 --type bl33 --compress lz4 + + ./${ENCRYPT} --bootmk \ + --output output/${OUTPUT_BIN} \ + --bl2 ${FIP}/bl2.n.bin.sig \ + --bl30 ${FIP}/bl30_new.bin.enc \ + --bl31 ${FIP}/bl31.img.enc \ + --bl33 output/bl33.bin.enc \ + --ddrfw1 ${FIP}/ddr4_1d.fw \ + --ddrfw2 ${FIP}/ddr4_2d.fw \ + --ddrfw3 ${FIP}/ddr3_1d.fw \ + --ddrfw4 ${FIP}/piei.fw \ + --ddrfw5 ${FIP}/lpddr4_1d.fw \ + --ddrfw6 ${FIP}/lpddr4_2d.fw \ + --ddrfw7 ${FIP}/diag_lpddr4.fw \ + --ddrfw8 ${FIP}/aml_ddr.fw \ + --ddrfw9 ${FIP}/lpddr3_ld.fw \ + --level v3 + + cp params.bin output/${PARAMS} + cd ./output/ + tar cvf ${OUTPUT_TAR} ${OUTPUT_BIN} boot.scr.uimg ${PARAMS} + cd .. +} + +check_ccache +build_uboot +generate_param + +build_amlogic diff --git a/tizen/build-kvim3.sh b/tizen/build-kvim3.sh deleted file mode 100755 index 3c1eb18..0000000 --- a/tizen/build-kvim3.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -CROSS_COMPILE=${CROSS_COMPILE:-/usr/bin/aarch64-linux-gnu-} -JOBS="-j 5" - -# Check this system has ccache -check_ccache() -{ - type ccache - if [ "$?" -eq "0" ]; then - CCACHE=ccache - fi -} - -build_uboot() -{ - BOARD=$1 - echo "Build $BOARD" - if [ "$BOARD" != "vim3" ] && [ "$BOARD" != "vim3l" ]; then - echo "Usage ./build_kvim3.sh [TARGET]" - echo " - TARGET : vim3 or vim3l" - echo " - e.g) ./build_vim3.sh vim3 or ./build_vim3.sh vim3l" - exit 1; - fi - if [ -d output ]; then - rm output/* - fi - - [ -d output ] || mkdir -p output - - if ! [ -e .config ] ; then - make ARCH=arm64 khadas-${BOARD}_defconfig - fi - - make CROSS_COMPILE="$CCACHE $CROSS_COMPILE" $JOBS - ./tools/mkimage -A arm64 -T script -C none -n "Tizen Khadas $BOARD u-boot helper" -d ./tizen/bootscript/tizen-boot-amlogic-64b.scr ./output/boot.scr.uimg - -} - -generate_param() { - cp `find ./env -name "built-in.o"` copy_env_common.o - ${CROSS_COMPILE}objcopy -O binary --only-section=.rodata.default_environment `find . -name "copy_env_common.o"` - tr '\0' '\n' < copy_env_common.o > default_envs.txt - ./tools/mkenvimage -s 16384 -o params.bin default_envs.txt - rm copy_env_common.o default_envs.txt -} - -build_vim3() -{ - if [ -e u-boot.bin ] ; then - cp u-boot.bin output/bl33.bin - fi - - ./fip/aml_encrypt_g12b --bl3sig --input output/bl33.bin --compress lz4 \ - --output output/bl33.bin.enc \ - --level v3 --type bl33 --compress lz4 - ./fip/aml_encrypt_g12b --bootmk \ - --output output/u-boot-kvim3.bin \ - --bl2 fip/kvim3/bl2.n.bin.sig \ - --bl30 fip/kvim3/bl30_new.bin.enc \ - --bl31 fip/kvim3/bl31.img.enc \ - --bl33 output/bl33.bin.enc \ - --ddrfw1 fip/kvim3/ddr4_1d.fw \ - --ddrfw2 fip/kvim3/ddr4_2d.fw \ - --ddrfw3 fip/kvim3/ddr3_1d.fw \ - --ddrfw4 fip/kvim3/piei.fw \ - --ddrfw5 fip/kvim3/lpddr4_1d.fw \ - --ddrfw6 fip/kvim3/lpddr4_2d.fw \ - --ddrfw7 fip/kvim3/diag_lpddr4.fw \ - --ddrfw8 fip/kvim3/aml_ddr.fw \ - --ddrfw9 fip/kvim3/lpddr3_ld.fw \ - --level v3 - - cp params.bin output/params-vim3.bin - cd ./output/ - tar cvf kvim3_bootloader.tar u-boot-kvim3.bin boot.scr.uimg params-vim3.bin - cd .. -} - -build_vim3l() -{ - if [ -e u-boot.bin ] ; then - cp u-boot.bin output/bl33.bin - fi - - ./fip/aml_encrypt_g12a --bl3sig --input output/bl33.bin --compress lz4 \ - --output output/bl33.bin.enc \ - --level v3 --type bl33 --compress lz4 - ./fip/aml_encrypt_g12a --bootmk \ - --output output/u-boot-kvim3l.bin \ - --bl2 fip/kvim3l/bl2.n.bin.sig \ - --bl30 fip/kvim3l/bl30_new.bin.enc \ - --bl31 fip/kvim3l/bl31.img.enc \ - --bl33 output/bl33.bin.enc \ - --ddrfw1 fip/kvim3l/ddr4_1d.fw \ - --ddrfw2 fip/kvim3l/ddr4_2d.fw \ - --ddrfw3 fip/kvim3l/ddr3_1d.fw \ - --ddrfw4 fip/kvim3l/piei.fw \ - --ddrfw5 fip/kvim3l/lpddr4_1d.fw \ - --ddrfw6 fip/kvim3l/lpddr4_2d.fw \ - --ddrfw7 fip/kvim3l/diag_lpddr4.fw \ - --ddrfw8 fip/kvim3l/aml_ddr.fw \ - --ddrfw9 fip/kvim3l/lpddr3_ld.fw \ - --level v3 - - cp params.bin output/params-vim3l.bin - cd ./output/ - tar cvf kvim3l_bootloader.tar u-boot-kvim3l.bin boot.scr.uimg params-vim3l.bin - cd .. -} - - -check_ccache -build_uboot $* -generate_param - -if [ $1 = "vim3" ]; then - build_vim3 -elif [ $1 = "vim3l" ]; then - build_vim3l -fi diff --git a/tizen/build-odroid-c4.sh b/tizen/build-odroid-c4.sh deleted file mode 100755 index 8a01abb..0000000 --- a/tizen/build-odroid-c4.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -CROSS_COMPILE=${CROSS_COMPILE:-/usr/bin/aarch64-linux-gnu-} -JOBS="-j 5" - -# Check this system has ccache -check_ccache() -{ - type ccache - if [ "$?" -eq "0" ]; then - CCACHE=ccache - fi -} - -build_uboot() -{ - if [ -d output ]; then - rm output/* - fi - - [ -d output ] || mkdir -p output - - if ! [ -e .config ] ; then - make ARCH=arm64 odroid-c4_defconfig - fi - make CROSS_COMPILE="$CCACHE $CROSS_COMPILE" $JOBS - ./tools/mkimage -A arm64 -T script -C none -n "Tizen ODROID-C4 u-boot helper" -d ./tizen/bootscript/tizen-boot-amlogic-64b.scr ./output/boot.scr.uimg - -} - -generate_param() { - cp `find ./env -name "built-in.o"` copy_env_common.o - ${CROSS_COMPILE}objcopy -O binary --only-section=.rodata.default_environment `find . -name "copy_env_common.o"` - tr '\0' '\n' < copy_env_common.o > default_envs.txt - ./tools/mkenvimage -s 16384 -o params.bin default_envs.txt - rm copy_env_common.o default_envs.txt -} - -build_amlogic() -{ - if [ -e u-boot.bin ] ; then - cp u-boot.bin output/bl33.bin - fi - - ./fip/aml_encrypt_g12a --bl3sig --input output/bl33.bin --compress lz4 \ - --output output/bl33.bin.enc \ - --level v3 --type bl33 --compress lz4 - - ./fip/aml_encrypt_g12a --bootmk \ - --output output/u-boot-c4.bin \ - --bl2 fip/c4/bl2.n.bin.sig \ - --bl30 fip/c4/bl30_new.bin.enc \ - --bl31 fip/c4/bl31.img.enc \ - --bl33 output/bl33.bin.enc \ - --ddrfw1 fip/c4/ddr4_1d.fw \ - --ddrfw2 fip/c4/ddr4_2d.fw \ - --ddrfw3 fip/c4/ddr3_1d.fw \ - --ddrfw4 fip/c4/piei.fw \ - --ddrfw5 fip/c4/lpddr4_1d.fw \ - --ddrfw6 fip/c4/lpddr4_2d.fw \ - --ddrfw7 fip/c4/diag_lpddr4.fw \ - --ddrfw8 fip/c4/aml_ddr.fw \ - --level v3 - - cp params.bin output/params-c4.bin - cd ./output/ - tar cvf odroidc4_bootloader.tar u-boot-c4.bin boot.scr.uimg params-c4.bin - cd .. -} - -check_ccache -build_uboot -generate_param - -build_amlogic diff --git a/tizen/build-odroid-n2.sh b/tizen/build-odroid-n2.sh deleted file mode 100755 index 044aed0..0000000 --- a/tizen/build-odroid-n2.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -CROSS_COMPILE=${CROSS_COMPILE:-/usr/bin/aarch64-linux-gnu-} -JOBS="-j 5" - -# Check this system has ccache -check_ccache() -{ - type ccache - if [ "$?" -eq "0" ]; then - CCACHE=ccache - fi -} - -build_uboot() -{ - if [ -d output ]; then - rm output/* - fi - - [ -d output ] || mkdir -p output - - if ! [ -e .config ] ; then - make ARCH=arm64 odroid-n2_defconfig - fi - make CROSS_COMPILE="$CCACHE $CROSS_COMPILE" $JOBS - ./tools/mkimage -A arm64 -T script -C none -n "Tizen ODROID-N2 u-boot helper" -d ./tizen/bootscript/tizen-boot-amlogic-64b.scr ./output/boot.scr.uimg - -} - -generate_param() { - cp `find ./env -name "built-in.o"` copy_env_common.o - ${CROSS_COMPILE}objcopy -O binary --only-section=.rodata.default_environment `find . -name "copy_env_common.o"` - tr '\0' '\n' < copy_env_common.o > default_envs.txt - ./tools/mkenvimage -s 16384 -o params.bin default_envs.txt - rm copy_env_common.o default_envs.txt -} - -build_amlogic() -{ - if [ -e u-boot.bin ] ; then - cp u-boot.bin output/bl33.bin - fi - - ./fip/aml_encrypt_g12b --bl3sig --input output/bl33.bin --compress lz4 \ - --output output/bl33.bin.enc \ - --level v3 --type bl33 --compress lz4 - ./fip/aml_encrypt_g12b --bootmk \ - --output output/u-boot-n2.bin \ - --bl2 fip/n2/bl2.n.bin.sig \ - --bl30 fip/n2/bl30_new.bin.enc \ - --bl31 fip/n2/bl31.img.enc \ - --bl33 output/bl33.bin.enc \ - --ddrfw1 fip/n2/ddr4_1d.fw \ - --ddrfw2 fip/n2/ddr4_2d.fw \ - --ddrfw3 fip/n2/ddr3_1d.fw \ - --ddrfw4 fip/n2/piei.fw \ - --ddrfw5 fip/n2/lpddr4_1d.fw \ - --ddrfw6 fip/n2/lpddr4_2d.fw \ - --ddrfw7 fip/n2/diag_lpddr4.fw \ - --ddrfw8 fip/n2/aml_ddr.fw \ - --level v3 - - cp params.bin output/params-n2.bin - cd ./output/ - tar cvf odroidn2_bootloader.tar u-boot-n2.bin boot.scr.uimg params-n2.bin - cd .. -} - -check_ccache -build_uboot -generate_param - -build_amlogic