From 34ac23c23151c9ea14b3091ab0b3948417f495ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20H=C3=B6ppner?= <jonas.hoeppner@garz-fricke.com> Date: Wed, 7 Sep 2022 15:49:35 +0200 Subject: [PATCH] u-boot:mc3: Add support for multiple devicetrees for u-boot and imx-boot Adding new variable UBOOT_ADDITIONAL_DTB_NAMES to specify more then one devicetree, use it in the u-boot and the imx-boot recipe to integrate everything into one fit image. imx-boot needs a patch, to use the addional devicetrees in the makefile when writing the fit image. --- conf/machine/seco-mx8mp.conf | 5 +-- ...onal-devicetrees-in-dtbs-to-the-u-bo.patch | 24 ++++++++++++++ .../imx-mkimage/imx-boot_%.bbappend | 32 +++++++++++++++++++ .../recipes-bsp/u-boot/u-boot-imx_%.bbappend | 8 +++++ 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 dynamic-layers/freescale-layer/recipes-bsp/imx-mkimage/imx-boot/0001-iMX8M-Add-additional-devicetrees-in-dtbs-to-the-u-bo.patch diff --git a/conf/machine/seco-mx8mp.conf b/conf/machine/seco-mx8mp.conf index f221d457..10240919 100644 --- a/conf/machine/seco-mx8mp.conf +++ b/conf/machine/seco-mx8mp.conf @@ -17,15 +17,12 @@ MACHINEOVERRIDES =. "mx8:mx8m:mx8mp:" # Setting both is not possible. UBOOT_CONFIG[sd] = "trizeps8plus_defconfig,sdcard" -# @TODO: Can we move to a proper DTB (like tanaro.dtb)? UBOOT_DTB_NAME = "kuk-trizeps8plus.dtb" +UBOOT_ADDITIONAL_DTB_NAMES = " seco-mx8mp-mc3.dtb " # Set imx-mkimage boot target IMXBOOT_TARGETS = "flash_evk" IMX_BOOT_SOC_TARGET = "iMX8MP" -# TODO trizeps uses uart 1 but mc3 uart 2 -ATF_BOOT_UART_BASE = "0x30860000" -#ATF_BOOT_UART_BASE = "0x30890000" # The i.MX8MM needs a seek of 32 (used for WIC images only) IMX_BOOT_SEEK = "32" diff --git a/dynamic-layers/freescale-layer/recipes-bsp/imx-mkimage/imx-boot/0001-iMX8M-Add-additional-devicetrees-in-dtbs-to-the-u-bo.patch b/dynamic-layers/freescale-layer/recipes-bsp/imx-mkimage/imx-boot/0001-iMX8M-Add-additional-devicetrees-in-dtbs-to-the-u-bo.patch new file mode 100644 index 00000000..13517d5a --- /dev/null +++ b/dynamic-layers/freescale-layer/recipes-bsp/imx-mkimage/imx-boot/0001-iMX8M-Add-additional-devicetrees-in-dtbs-to-the-u-bo.patch @@ -0,0 +1,24 @@ +From 60efc73735fdca8533b7f4ced482df1d5cb9cb3b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20H=C3=B6ppner?= <jonas.hoeppner@garz-fricke.com> +Date: Tue, 13 Sep 2022 08:04:05 +0200 +Subject: [PATCH] iMX8M: Add additional devicetrees in 'dtbs' to the u-boot.itb + target + +With this, it is possible to add multiple dtbs to the fit image. +--- + iMX8M/soc.mak | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/iMX8M/soc.mak b/iMX8M/soc.mak +index 60502d8..760eed1 100644 +--- a/iMX8M/soc.mak ++++ b/iMX8M/soc.mak +@@ -148,7 +148,7 @@ u-boot.itb: $(dtb) + ./$(PAD_IMAGE) $(TEE) + ./$(PAD_IMAGE) bl31.bin + ./$(PAD_IMAGE) u-boot-nodtb.bin $(dtb) +- BL32=$(TEE) DEK_BLOB_LOAD_ADDR=$(DEK_BLOB_LOAD_ADDR) TEE_LOAD_ADDR=$(TEE_LOAD_ADDR) ATF_LOAD_ADDR=$(ATF_LOAD_ADDR) ./mkimage_fit_atf.sh $(dtb) > u-boot.its ++ BL32=$(TEE) DEK_BLOB_LOAD_ADDR=$(DEK_BLOB_LOAD_ADDR) TEE_LOAD_ADDR=$(TEE_LOAD_ADDR) ATF_LOAD_ADDR=$(ATF_LOAD_ADDR) ./mkimage_fit_atf.sh $(dtb) $(dtbs) > u-boot.its + mkimage -E -p 0x3000 -f u-boot.its u-boot.itb + @rm -f u-boot.its $(dtb) + diff --git a/dynamic-layers/freescale-layer/recipes-bsp/imx-mkimage/imx-boot_%.bbappend b/dynamic-layers/freescale-layer/recipes-bsp/imx-mkimage/imx-boot_%.bbappend index 9321a92d..cc25218a 100644 --- a/dynamic-layers/freescale-layer/recipes-bsp/imx-mkimage/imx-boot_%.bbappend +++ b/dynamic-layers/freescale-layer/recipes-bsp/imx-mkimage/imx-boot_%.bbappend @@ -1,5 +1,13 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +SRC_URI += "file://0001-iMX8M-Add-additional-devicetrees-in-dtbs-to-the-u-bo.patch" + +do_compile:prepend() { + for dtb in ${UBOOT_ADDITIONAL_DTB_NAMES};do + cp -v ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${dtb} ${BOOT_STAGING} + done +} + do_compile:append() { # Integrate fw_env.config and u-boot-initial-env @@ -34,3 +42,27 @@ do_deploy:append() { cd - done } + +# Copy of the original compile function, as UBOOT_ADDITIONAL_DTB_NAMES had to +# be added to the make call +do_compile() { + # mkimage for i.MX8 + # Copy TEE binary to SoC target folder to mkimage + if ${DEPLOY_OPTEE}; then + cp ${DEPLOY_DIR_IMAGE}/tee.bin ${BOOT_STAGING} + fi + for target in ${IMXBOOT_TARGETS}; do + compile_${SOC_FAMILY} + if [ "$target" = "flash_linux_m4_no_v2x" ]; then + # Special target build for i.MX 8DXL with V2X off + bbnote "building ${IMX_BOOT_SOC_TARGET} - ${REV_OPTION} V2X=NO ${target}" + make SOC=${IMX_BOOT_SOC_TARGET} ${REV_OPTION} V2X=NO dtbs=${UBOOT_DTB_NAME} flash_linux_m4 + else + bbnote "building ${IMX_BOOT_SOC_TARGET} - ${REV_OPTION} ${target}" + make SOC=${IMX_BOOT_SOC_TARGET} ${REV_OPTION} dtbs="${UBOOT_DTB_NAME} ${UBOOT_ADDITIONAL_DTB_NAMES}" ${target} + fi + if [ -e "${BOOT_STAGING}/flash.bin" ]; then + cp ${BOOT_STAGING}/flash.bin ${S}/${BOOT_CONFIG_MACHINE}-${target} + fi + done +} diff --git a/dynamic-layers/freescale-layer/recipes-bsp/u-boot/u-boot-imx_%.bbappend b/dynamic-layers/freescale-layer/recipes-bsp/u-boot/u-boot-imx_%.bbappend index 2519a109..f8db744b 100644 --- a/dynamic-layers/freescale-layer/recipes-bsp/u-boot/u-boot-imx_%.bbappend +++ b/dynamic-layers/freescale-layer/recipes-bsp/u-boot/u-boot-imx_%.bbappend @@ -126,6 +126,10 @@ do_deploy:append () { ln -sf fw_env-${MACHINE}-${type}-${PV}-${PR}.config fw_env-${MACHINE}-${type}.config ln -sf fw_env-${MACHINE}-${type}-${PV}-${PR}.config fw_env-${type}.config fi + # Deploy additional devicetrees, if more then one should integrated into the image + for dtb in ${UBOOT_ADDITIONAL_DTB_NAMES};do + install -m 0777 ${B}/${config}/arch/arm/dts/${dtb} ${DEPLOYDIR}/${BOOT_TOOLS} + done fi done unset j @@ -144,6 +148,10 @@ do_deploy:append () { ln -sf fw_env-${MACHINE}-${PV}-${PR}.config fw_env-${MACHINE}.config ln -sf fw_env-${MACHINE}-${PV}-${PR}.config fw_env.config fi + # Deploy additional devicetrees, if more then one should integrated into the image + for dtb in ${UBOOT_ADDITIONAL_DTB_NAMES};do + install -m 0777 ${B}/${config}/arch/arm/dts/${dtb} ${DEPLOYDIR}/${BOOT_TOOLS} + done fi } -- GitLab