From 768c0788f6c4458fb4b0ac15614c3b63c739809d Mon Sep 17 00:00:00 2001 From: methanal <13671494-methanal@users.noreply.gitlab.com> Date: Tue, 16 Jan 2024 15:58:53 +0000 Subject: [PATCH] add support for generating dt.img (MR 52) Add support for generation of dt.img in boot-deploy. The type is defined in `deviceinfo_bootimg_qcdt_type'. Valid values are "qcom", "exynos" and "sprd". --- boot-deploy-functions.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/boot-deploy-functions.sh b/boot-deploy-functions.sh index da4f6d9..4250009 100644 --- a/boot-deploy-functions.sh +++ b/boot-deploy-functions.sh @@ -16,6 +16,7 @@ deviceinfo_bootimg_mtk_label_ramdisk="" deviceinfo_bootimg_mtk_mkimage="" deviceinfo_bootimg_pxa="" deviceinfo_bootimg_qcdt="" +deviceinfo_bootimg_qcdt_type="" deviceinfo_bootimg_override_payload="" deviceinfo_bootimg_override_payload_compression="" deviceinfo_bootimg_override_payload_append_dtb="" @@ -161,6 +162,7 @@ validate_deviceinfo() { deviceinfo_bootimg_override_payload_compression \ deviceinfo_bootimg_pxa \ deviceinfo_bootimg_qcdt \ + deviceinfo_bootimg_qcdt_type \ deviceinfo_flash_kernel_on_update \ deviceinfo_generate_bootimg \ deviceinfo_generate_depthcharge_image \ @@ -626,6 +628,38 @@ create_bootimg() { local _dt_img="" if [ "${deviceinfo_bootimg_qcdt}" = "true" ]; then _dt_img="--dt /boot/dt.img" + if [ -n "${deviceinfo_bootimg_qcdt_type}" ]; then + if [ -z "${deviceinfo_dtb}" ]; then + log "ERROR: deviceinfo_bootimg_qcdt_type is set, but" + log "'deviceinfo_dtb' is missing. Set 'deviceinfo_dtb'" + log "to the device tree blob for your device." + log "See also: <https://postmarketos.org/deviceinfo>" + exit 1 + fi + if [ -z "${_dtb}" ]; then + log "ERROR: Couldn't find DTB for ${deviceinfo_dtb}" + exit 1 + fi + fi + case "${deviceinfo_bootimg_qcdt_type}" in + "exynos") + require_package "dtbTool-exynos" "dtbtool-exynos" "bootimg_qcdt_type" + dtbTool-exynos -o "/boot/dt.img" "${_dtb}";; + "sprd") + require_package "dtbTool-sprd" "dtbtool-sprd" "bootimg_qcdt_type" + dtbTool-sprd -o "/boot/dt.img" "${_dtb}";; + "qcom") + require_package "dtbTool" "dtbtool" "bootimg_qcdt_type" + dtbTool -o "/boot/dt.img" "${_dtb}";; + "") + # When 'bootimg_qcdt_type` is not set, expect that + # dt.img has been generated by the linux APKBUILD. + ;; + *) + log "ERROR: deviceinfo_bootimg_qcdt_type has an unrecognized" + log "value. See also <https://postmarketos.org/deviceinfo>" + exit 1 + esac if ! [ -e "/boot/dt.img" ]; then log "ERROR: File not found: /boot/dt.img, but" log "'deviceinfo_bootimg_qcdt' is set. Please verify that your" -- GitLab