Skip to content

Commit

Permalink
build.sh: output BL2 when build BL2 + FIP (hanwckf#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgs2007m authored Dec 25, 2023
1 parent 610fcad commit 3669f03
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ sudo apt install gcc-aarch64-linux-gnu build-essential flex bison libssl-dev
Usage: SOC=[mt7981|mt7986] BOARD=<board name> MULTI_LAYOUT=[0|1] ./build.sh
eg: SOC=mt7981 BOARD=360t7 ./build.sh
eg: SOC=mt7981 BOARD=wr30u MULTI_LAYOUT=1 ./build.sh
eg: SOC=mt7981 BOARD=cmcc_rax3000m-emmc ./build.sh
eg: SOC=mt7986 BOARD=redmi_ax6000 MULTI_LAYOUT=1 ./build.sh
eg: SOC=mt7986 BOARD=jdcloud_re-cp-03 ./build.sh
```

---
Expand Down
40 changes: 30 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,28 @@ command -v ${TOOLCHAIN}gcc
[ "$?" != "0" ] && { echo ${TOOLCHAIN}gcc not found!; exit 0; }
export CROSS_COMPILE=$TOOLCHAIN

# Build fixed-mtdparts by default
fixedparts=${FIXED_MTDPARTS:-1}
multilayout=${MULTI_LAYOUT:-0}

echo "Building for: ${SOC}_${BOARD}, fixed-mtdparts: $fixedparts, multi-layout: $multilayout"
echo "u-boot dir: $UBOOT_DIR"

UBOOT_CFG="${SOC}_${BOARD}_defconfig"
if [ "$multilayout" = "1" ]; then
UBOOT_CFG="${SOC}_${BOARD}_multi_layout_defconfig"
ATF_CFG="${SOC}_${BOARD}_defconfig"
if grep -q "CONFIG_FLASH_DEVICE_EMMC=y" $ATF_DIR/configs/$ATF_CFG ; then
# No fixed-mtdparts or multilayout for EMMC
fixedparts=0
multilayout=0
echo "Building for: ${SOC}_${BOARD}"
echo "u-boot dir: $UBOOT_DIR"
echo "atf dir: $ATF_DIR"
else
# Build fixed-mtdparts by default for NAND
fixedparts=${FIXED_MTDPARTS:-1}
multilayout=${MULTI_LAYOUT:-0}
if [ "$multilayout" = "1" ]; then
UBOOT_CFG="${SOC}_${BOARD}_multi_layout_defconfig"
fi
echo "Building for: ${SOC}_${BOARD}, fixed-mtdparts: $fixedparts, multi-layout: $multilayout"
echo "u-boot dir: $UBOOT_DIR"
echo "atf dir: $ATF_DIR"
fi


if [ ! -f $UBOOT_DIR/configs/$UBOOT_CFG ]; then
echo "$UBOOT_DIR/configs/$UBOOT_CFG not found!"
exit 1
Expand All @@ -58,7 +68,6 @@ else
fi
fi

ATF_CFG="${SOC}_${BOARD}_defconfig"
if [ ! -f $ATF_DIR/configs/$ATF_CFG ]; then
echo "$ATF_DIR/configs/$ATF_CFG not found!"
exit 1
Expand All @@ -83,4 +92,15 @@ else
echo "fip build fail!"
exit 1
fi
if grep -q "CONFIG_TARGET_ALL_NO_SEC_BOOT=y" $ATF_DIR/configs/$ATF_CFG ; then
if [ -f "$ATF_DIR/build/${SOC}/release/bl2.img" ]; then
[ ! -d "./output" ] && mkdir -p output
BL2_NAME="${SOC}_${BOARD}-bl2"
cp -f $ATF_DIR/build/${SOC}/release/bl2.img output/${BL2_NAME}.bin
echo "$BL2_NAME build done"
else
echo "bl2 build fail!"
exit 1
fi
fi
fi

0 comments on commit 3669f03

Please sign in to comment.