diff --git a/README.md b/README.md index 9afcb2f209..4b58546ed6 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,9 @@ sudo apt install gcc-aarch64-linux-gnu build-essential flex bison libssl-dev Usage: SOC=[mt7981|mt7986] BOARD= 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 ``` --- diff --git a/build.sh b/build.sh index 2d698fa6dd..20d1379670 100755 --- a/build.sh +++ b/build.sh @@ -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 @@ -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 @@ -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