| #!/bin/bash |
| |
| exec_name=$0 |
| |
| set -o errtrace |
| trap 'echo Fatal error: script ${exec_name} aborting at line $LINENO, command \"$BASH_COMMAND\" returned $?; exit 1' ERR |
| |
| cpu_num=$(grep -c processor /proc/cpuinfo) |
| |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| echo DIR:$DIR |
| |
| function usage(){ |
| echo "Usage: ${exec_name} <board> [workspace path]" |
| echo "supported boards: swift-p0 swift-p1 swift-p2 swift-b1 swift-b3 swift-b4" |
| } |
| |
| readonly fsi_folder="bootloader" |
| readonly fct_folder="factory/bootloader" |
| readonly fsi="$fsi_folder:" |
| readonly fct="$fct_folder:" |
| |
| function building_uboot(){ |
| soc_family_name=$1 |
| local_name=$2 |
| rev=$3 |
| board_name=$4 |
| |
| config=${local_name}_${rev} |
| echo "building u-boot for ${board}" |
| # make T=1 to use latest git commit time as build timestamp. |
| ./mk ${config} ${git_dbg} --board_name $board_name --deterministic_build $6 |
| echo "mk done\n" |
| |
| local product=`echo ${board} | cut -d "-" -f1` |
| |
| for cfg in "$fsi" "$fct"; do |
| local folder="${cfg%:*}" |
| |
| local bootloader_path=${workspace_path}/vendor/amlogic/${product}/prebuilt/${folder} |
| if [ ! -z $workspace_path ]; then |
| mkdir -p ${bootloader_path} |
| # Copy bl2 and bl3x images for bootloader signing under eureka source. |
| cp fip/_tmp/bb1st.sto.bin.signed \ |
| ${bootloader_path}/bb1st.sto.bin.signed.${board_name} |
| cp fip/_tmp/bb1st.usb.bin.signed \ |
| ${bootloader_path}/bb1st.usb.bin.signed.${board_name} |
| cp fip/_tmp/blob-bl2e.sto.bin.signed \ |
| ${bootloader_path}/blob-bl2e.sto.bin.signed.${board_name} |
| cp fip/_tmp/blob-bl2e.usb.bin.signed \ |
| ${bootloader_path}/blob-bl2e.usb.bin.signed.${board_name} |
| cp fip/_tmp/blob-bl2x.bin.signed \ |
| ${bootloader_path}/blob-bl2x.bin.signed.${board_name} |
| cp fip/_tmp/bl30-payload.bin \ |
| ${bootloader_path}/bl30-payload.bin.${board_name} |
| cp fip/_tmp/blob-bl31.bin.signed \ |
| ${bootloader_path}/blob-bl31.bin.signed.${board_name} |
| cp fip/_tmp/blob-bl32.bin.signed \ |
| ${bootloader_path}/blob-bl32.bin.signed.${board_name} |
| cp fip/_tmp/blob-bl40.bin.signed \ |
| ${bootloader_path}/blob-bl40.bin.signed.${board_name} |
| cp fip/_tmp/ddr-fip.bin \ |
| ${bootloader_path}/ddr-fip.bin.${board_name} |
| cp fip/_tmp/dvinit-params.bin \ |
| ${bootloader_path}/dvinit-params.bin.${board_name} |
| |
| #copy a4 bb1st.bin for sign uboot |
| cp soc/templates/${chipset}/${chipset_variant}/bb1st.bin \ |
| ${bootloader_path}/bb1st.bin.${board_name} |
| #copy a4 device-fip-header.bin for sign uboot |
| cp soc/templates/${chipset}/${chipset_variant}/device-fip-header.bin \ |
| ${bootloader_path}/device-fip-header.bin.${board_name} |
| |
| #copy original bl33.bin for adding ext_krnl key |
| cp fip/_tmp/bl33.bin.org \ |
| ${bootloader_path}/bl33.bin.org.${board_name} |
| |
| fi |
| done |
| } |
| |
| parse_ab_image() { |
| chipset=$1 |
| chipset_variant=$2 |
| suffix=$3 |
| new_suffix="" |
| |
| pushd bl2/bin/${chipset}/${chipset_variant}/ |
| for file in *$suffix;do |
| new_file="${file%$suffix}" |
| cp "$file" "${new_file}${new_suffix}" |
| done |
| popd |
| } |
| |
| if (( $# < 1 )) |
| then |
| usage |
| exit 2 |
| fi |
| |
| pushd $DIR |
| |
| readonly board=$1 |
| readonly workspace_path=$2 |
| readonly cross_compile=$DIR/../amlogic/linaro/gcc-linaro-7.3.1-2018.05-i686_aarch64-elf/bin/aarch64-elf- |
| readonly cross_compile_t32=$DIR/../amlogic/linaro/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi- |
| readonly vendor_amlogic=$DIR/../vendor/amlogic |
| |
| dbg_flag="debug" |
| |
| if [ "$3" = "release" -o "$4" = "release" ]; then |
| dbg_flag="release" |
| fi |
| |
| deterministic_build=0 |
| if [ "$3" = "-d" ]; then |
| deterministic_build=1 |
| fi |
| |
| export ENABLE_UBOOT_UPDATE=1 |
| export ENABLE_PRODUCTION_MODE=0 |
| |
| case $board in |
| swift-p0) |
| git_dbg="--build-nogit" |
| chipset=a5 |
| chipset_variant=a113x2 |
| # bb1st.xxx.signed.ab -> bb1st.xxx.signed |
| # blob-bl2e.xxx.signed.ab -> blob-bl2e.xxx.signed |
| parse_ab_image ${chipset} ${chipset_variant} ".ab" |
| building_uboot a5 a5_swift p0 $board $dbg_flag $deterministic_build |
| ;; |
| swift-p1) |
| git_dbg="--build-nogit" |
| chipset=a5 |
| chipset_variant=a113x2 |
| # bb1st.xxx.signed.ab -> bb1st.xxx.signed |
| # blob-bl2e.xxx.signed.ab -> blob-bl2e.xxx.signed |
| parse_ab_image ${chipset} ${chipset_variant} ".ab" |
| building_uboot a5 a5_swift p1 $board $dbg_flag $deterministic_build |
| ;; |
| swift-p2) |
| git_dbg="--build-nogit" |
| chipset=a5 |
| chipset_variant=a113x2g |
| # bb1st.xxx.signed.ab -> bb1st.xxx.signed |
| # blob-bl2e.xxx.signed.ab -> blob-bl2e.xxx.signed |
| parse_ab_image ${chipset} ${chipset_variant} ".ab" |
| building_uboot a5 a5_swift p2 $board $dbg_flag $deterministic_build |
| ;; |
| swift-b1|swift-b3) |
| git_dbg="--build-nogit" |
| chipset=a5 |
| chipset_variant=a113x2g |
| # bb1st.xxx.signed.ab -> bb1st.xxx.signed |
| # blob-bl2e.xxx.signed.ab -> blob-bl2e.xxx.signed |
| parse_ab_image ${chipset} ${chipset_variant} ".ab" |
| building_uboot a5 a5_swift bx $board $dbg_flag $deterministic_build |
| ;; |
| swift-b4) |
| export ENABLE_UBOOT_UPDATE=0 |
| export ENABLE_PRODUCTION_MODE=1 |
| git_dbg="--build-nogit" |
| chipset=a5 |
| chipset_variant=a113x2g |
| # bb1st.xxx.signed.ab -> bb1st.xxx.signed |
| # blob-bl2e.xxx.signed.ab -> blob-bl2e.xxx.signed |
| parse_ab_image ${chipset} ${chipset_variant} ".ab" |
| building_uboot a5 a5_swift bx $board $dbg_flag $deterministic_build |
| ;; |
| *) |
| echo "unknown board: $board" |
| usage |
| exit 1 |
| esac |
| popd |