build.sh: use case for build mode
authorBigfootACA <bigfoot@classfun.cn>
星期六, 23 Oct 2021 07:33:44 +0000 (15:33 +0800)
committerBigfootACA <bigfoot@classfun.cn>
星期六, 23 Oct 2021 07:33:44 +0000 (15:33 +0800)
Signed-off-by: BigfootACA <bigfoot@classfun.cn>
build.sh

index 8dadf227ffca9c2d64c037d65d5c8a49b0a01dba..17113489022aa09417d7269e249f973f67fcfcf7 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -63,16 +63,32 @@ function _build(){
        fi
        # based on the instructions from edk2-platform
        rm -f "${OUTDIR}/boot-${DEVICE}.img" uefi_img "uefi-${DEVICE}.img.gz" "uefi-${DEVICE}.img.gz-dtb"
-       if [ "$MODE" != "RELEASE" ]
-       then
-               build -s -n 0 -a AARCH64 -t GCC5 -p "sdm845Pkg/Devices/${DEVICE}.dsc" -b DEBUG||return "$?"
-               gzip -c < workspace/Build/sdm845Pkg/DEBUG_GCC5/FV/SDM845PKG_UEFI.fd > "workspace/uefi-${DEVICE}.img.gz"||return "$?"
-       else
-               build -s -n 0 -a AARCH64 -t GCC5 -p "sdm845Pkg/Devices/${DEVICE}.dsc" -b RELEASE||return "$?"
-               gzip -c < workspace/Build/sdm845Pkg/RELEASE_GCC5/FV/SDM845PKG_UEFI.fd > "workspace/uefi-${DEVICE}.img.gz"||return "$?"
-       fi
-       cat "workspace/uefi-${DEVICE}.img.gz" "device_specific/${DEVICE}.dtb" > "workspace/uefi-${DEVICE}.img.gz-dtb"||return "$?"
-       abootimg --create "${OUTDIR}/boot-${DEVICE}.img" -k "workspace/uefi-${DEVICE}.img.gz-dtb" -r ramdisk||return "$?"
+       case "${MODE}" in
+               RELEASE)_MODE=RELEASE;;
+               *)_MODE=DEBUG;;
+       esac
+       build \
+               -s \
+               -n 0 \
+               -a AARCH64 \
+               -t GCC5 \
+               -p "sdm845Pkg/Devices/${DEVICE}.dsc" \
+               -b "${_MODE}" \
+               ||return "$?"
+       gzip -c \
+               < "workspace/Build/sdm845Pkg/${_MODE}_GCC5/FV/SDM845PKG_UEFI.fd" \
+               > "workspace/uefi-${DEVICE}.img.gz" \
+               ||return "$?"
+       cat \
+               "workspace/uefi-${DEVICE}.img.gz" \
+               "device_specific/${DEVICE}.dtb" \
+               > "workspace/uefi-${DEVICE}.img.gz-dtb" \
+               ||return "$?"
+       abootimg \
+               --create "${OUTDIR}/boot-${DEVICE}.img" \
+               -k "workspace/uefi-${DEVICE}.img.gz-dtb" \
+               -r ramdisk \
+               ||return "$?"
        echo "Build done: ${OUTDIR}/boot-${DEVICE}.img"
        set +x
 }