From: BigfootACA <bigfoot@classfun.cn>
Date: 星期四, 19 May 2022 09:33:19 +0000 (+0800)
Subject: build.sh: add devices config
X-Git-Tag: v2.0rc2~9
X-Git-Url: https://git.renegade-project.org/?a=commitdiff_plain;h=24ec99ec598f047112ac0537a68b85c13021b760;p=edk2-sdm845.git

build.sh: add devices config
---

diff --git a/build.sh b/build.sh
index 6e27077..ad36fa8 100755
--- 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
index 0000000..8f98b9e
--- /dev/null
+++ b/devices/default.conf
@@ -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