build.sh: add devices config
authorBigfootACA <bigfoot@classfun.cn>
星期四, 19 May 2022 09:33:19 +0000 (17:33 +0800)
committerBigfootACA <bigfoot@classfun.cn>
星期四, 19 May 2022 09:33:19 +0000 (17:33 +0800)
build.sh
devices/default.conf [new file with mode: 0644]

index 6e270773a23deb240526ed14d9712cc23dfcf933..ad36fa8b016d420bc796b91fb24ed4149a5a8a5a 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -68,12 +68,16 @@ function _build(){
                RELEASE)_MODE=RELEASE;;
                *)_MODE=DEBUG;;
        esac
+       if [ -f "devices/${DEVICE}.conf" ]
+       then source "devices/${DEVICE}.conf"
+       else source "devices/default.conf"
+       fi
        build \
                -s \
                -n 0 \
                -a AARCH64 \
                -t "${TOOLCHAIN}" \
-               -p "sdm845Pkg/Devices/${DEVICE}.dsc" \
+               -p "${DSC_FILE}" \
                -b "${_MODE}" \
                -D FIRMWARE_VER="${GITCOMMIT}" \
                -D USE_UART="${USE_UART}" \
@@ -93,8 +97,8 @@ function _build(){
                --kernel_offset 0x00000000 \
                --ramdisk_offset 0x00000000 \
                --tags_offset 0x00000000 \
-               --os_version 12.0.0 \
-               --os_patch_level 2022-04 \
+               --os_version "${BOOTIMG_OS_VERSION}" \
+               --os_patch_level "${BOOTIMG_OS_PATCH_LEVEL}" \
                --header_version 1 \
                -o "${OUTDIR}/boot-${DEVICE}.img" \
                ||return "$?"
diff --git a/devices/default.conf b/devices/default.conf
new file mode 100644 (file)
index 0000000..8f98b9e
--- /dev/null
@@ -0,0 +1,4 @@
+DSC_FILE="sdm845Pkg/Devices/${DEVICE}.dsc"
+DTB_FILE="device_specific/${DEVICE}.dtb"
+BOOTIMG_OS_PATCH_LEVEL="$(date '+%Y-%m')"
+BOOTIMG_OS_VERSION=12.0.0