From 3629775c32357b72ecec799ea22c2bc2cb99f343 Mon Sep 17 00:00:00 2001 From: Tom Hochstein Date: Thu, 22 Aug 2024 11:39:35 -0700 Subject: [PATCH] boot: Remove UUU tag from default bootloader and imx-boot binaries The UUU tag on the default bootloader image causes problems when the bootloader is used outside of the Wic context. Rework the design so the default bootloader and the default imx-boot binaries are not tagged, and only the Wic image will use the tagged binaries. Fixes: https://github.com/Freescale/meta-freescale/pull/1762 Fixes: https://github.com/nxp-imx/mfgtools/issues/416 Signed-off-by: Tom Hochstein --- classes/uuu_bootloader_tag.bbclass | 16 ++++++---------- conf/machine/include/imx-base.inc | 14 ++++++++++++-- recipes-bsp/imx-mkimage/imx-boot_1.0.bb | 6 +----- recipes-bsp/u-boot/u-boot-imx_2024.04.bb | 17 ++++++----------- wic/imx-imx-boot-bootpart.wks.in | 2 +- wic/imx-imx-boot.wks.in | 2 +- wic/imx-uboot-bootpart.wks.in | 2 +- wic/imx-uboot-spl-bootpart.wks.in | 2 +- wic/imx-uboot-spl.wks.in | 2 +- wic/imx-uboot.wks | 2 +- 10 files changed, 31 insertions(+), 34 deletions(-) diff --git a/classes/uuu_bootloader_tag.bbclass b/classes/uuu_bootloader_tag.bbclass index 87745660c..50c4f4c2c 100644 --- a/classes/uuu_bootloader_tag.bbclass +++ b/classes/uuu_bootloader_tag.bbclass @@ -1,12 +1,8 @@ -# Append a tag to the bootloader image used in the SD card image. The tag -# contains the size of the bootloader image so UUU can easily find the end of -# the bootloader in the SD card image. +# Create a tagged boot partition image for the SD card image. The tag +# contains the size of the boot partition image so UUU can easily find +# the end of it in the SD card image. do_deploy:append() { - if [ "${UUU_BOOTLOADER}" != "" ]; then - cp ${DEPLOYDIR}/${UUU_BOOTLOADER} ${DEPLOYDIR}/${UUU_BOOTLOADER_TAGGED} - cp ${DEPLOYDIR}/${UUU_BOOTLOADER} ${DEPLOYDIR}/${UUU_BOOTLOADER_UNTAGGED} - ln -sf ${UUU_BOOTLOADER_TAGGED} ${DEPLOYDIR}/${UUU_BOOTLOADER} - stat -L -cUUUBURNXXOEUZX7+A-XY5601QQWWZ%sEND ${DEPLOYDIR}/${UUU_BOOTLOADER_TAGGED} \ - >> ${DEPLOYDIR}/${UUU_BOOTLOADER_TAGGED} - fi + cp ${DEPLOYDIR}/${IMX_BOOTPART_FILE} ${DEPLOYDIR}/${IMX_BOOTPART_FILE_TAGGED} + stat -L -cUUUBURNXXOEUZX7+A-XY5601QQWWZ%sEND ${DEPLOYDIR}/${IMX_BOOTPART_FILE_TAGGED} \ + >> ${DEPLOYDIR}/${IMX_BOOTPART_FILE_TAGGED} } diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc index f8f677404..6723aa2d8 100644 --- a/conf/machine/include/imx-base.inc +++ b/conf/machine/include/imx-base.inc @@ -659,11 +659,21 @@ WKS_FILE_DEPENDS:append:imx-generic-bsp:mx9-generic-bsp = " \ ${@oe.utils.ifelse(d.getVar('UBOOT_PROVIDES_BOOT_CONTAINER') == '0', 'imx-boot', '')} \ " -SOC_DEFAULT_WKS_FILE ?= "imx-uboot-bootpart.wks.in" -SOC_DEFAULT_WKS_FILE:mx8-generic-bsp ?= "imx-imx-boot-bootpart.wks.in" +SOC_DEFAULT_WKS_FILE ?= "imx-uboot-bootpart.wks.in" SOC_DEFAULT_WKS_FILE:mxs-generic-bsp ?= "imx-uboot-mxs-bootpart.wks.in" +SOC_DEFAULT_WKS_FILE:mx8-generic-bsp ?= "imx-imx-boot-bootpart.wks.in" SOC_DEFAULT_WKS_FILE:mx9-generic-bsp ?= "imx-imx-boot-bootpart.wks.in" +IMX_BOOTPART_FILE_WKS = "${IMX_BOOTPART_FILE}" +IMX_BOOTPART_FILE_WKS:imx-generic-bsp = \ + "${@bb.utils.contains('PREFERRED_PROVIDER_u-boot', 'u-boot-imx', '${IMX_BOOTPART_FILE_TAGGED}', \ + '${IMX_BOOTPART_FILE}', d)}" +IMX_BOOTPART_FILE = "${UBOOT_BINARY}" +IMX_BOOTPART_FILE_TAGGED:arm = "u-boot-tagged.imx" +IMX_BOOTPART_FILE:aarch64 = "imx-boot" +IMX_BOOTPART_FILE_TAGGED:aarch64 = "imx-boot-tagged" + + WKS_FILE ?= "${SOC_DEFAULT_WKS_FILE}" SERIAL_CONSOLES = "115200;ttymxc0" diff --git a/recipes-bsp/imx-mkimage/imx-boot_1.0.bb b/recipes-bsp/imx-mkimage/imx-boot_1.0.bb index 06832fc46..a06d9adb3 100644 --- a/recipes-bsp/imx-mkimage/imx-boot_1.0.bb +++ b/recipes-bsp/imx-mkimage/imx-boot_1.0.bb @@ -22,10 +22,6 @@ DEPENDS:append:mx93-generic-bsp = " u-boot-mkimage-native dtc-native" inherit deploy uuu_bootloader_tag -UUU_BOOTLOADER = "imx-boot" -UUU_BOOTLOADER_TAGGED = "imx-boot-tagged" -UUU_BOOTLOADER_UNTAGGED = "imx-boot-untagged" - # Add CFLAGS with native INCDIR & LIBDIR for imx-mkimage build CFLAGS = "-O2 -Wall -std=c99 -I ${STAGING_INCDIR_NATIVE} -L ${STAGING_LIBDIR_NATIVE}" @@ -398,7 +394,7 @@ do_deploy() { done # The first UBOOT_CONFIG listed will be the imx-boot binary - if [ ! -f "${DEPLOYDIR}/${UUU_BOOTLOADER}" ]; then + if [ ! -f "${DEPLOYDIR}/imx-boot" ]; then ln -sf ${BOOT_CONFIG_MACHINE_EXTRA}-${IMAGE_IMXBOOT_TARGET} ${DEPLOYDIR}/imx-boot else bbwarn "Use custom wks.in for $UBOOT_CONFIG = $type" diff --git a/recipes-bsp/u-boot/u-boot-imx_2024.04.bb b/recipes-bsp/u-boot/u-boot-imx_2024.04.bb index 3d03c8349..0332ef6ab 100644 --- a/recipes-bsp/u-boot/u-boot-imx_2024.04.bb +++ b/recipes-bsp/u-boot/u-boot-imx_2024.04.bb @@ -7,17 +7,12 @@ require u-boot-imx-common_${PV}.inc PROVIDES += "u-boot u-boot-mfgtool" -inherit uuu_bootloader_tag - -UUU_BOOTLOADER = "" -UUU_BOOTLOADER:mx6-generic-bsp = "${UBOOT_BINARY}" -UUU_BOOTLOADER:mx7-generic-bsp = "${UBOOT_BINARY}" -UUU_BOOTLOADER_TAGGED = "" -UUU_BOOTLOADER_TAGGED:mx6-generic-bsp = "u-boot-tagged.${UBOOT_SUFFIX}" -UUU_BOOTLOADER_TAGGED:mx7-generic-bsp = "u-boot-tagged.${UBOOT_SUFFIX}" -UUU_BOOTLOADER_UNTAGGED = "" -UUU_BOOTLOADER_UNTAGGED:mx6-generic-bsp = "u-boot-untagged.${UBOOT_SUFFIX}" -UUU_BOOTLOADER_UNTAGGED:mx7-generic-bsp = "u-boot-untagged.${UBOOT_SUFFIX}" +# The UUU tag goes on the boot partition. For 32-bit, the boot partition +# image is uboot, so UUU-tagging is enabled here. For 64-bit, the boot +# partition image is imx-boot, so UUU-tagging is disabled here. +UUU_BOOTLOADER_TAG = "" +UUU_BOOTLOADER_TAG:imx-nxp-bsp:arm = "uuu_bootloader_tag" +inherit ${UUU_BOOTLOADER_TAG} do_deploy:append:mx8m-generic-bsp() { # Deploy u-boot-nodtb.bin and fsl-imx8m*-XX.dtb for mkimage to generate boot binary diff --git a/wic/imx-imx-boot-bootpart.wks.in b/wic/imx-imx-boot-bootpart.wks.in index b50364d1b..5d56e41bf 100644 --- a/wic/imx-imx-boot-bootpart.wks.in +++ b/wic/imx-imx-boot-bootpart.wks.in @@ -13,7 +13,7 @@ # 0 | 8MiB 72MiB 72MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB) # ${IMX_BOOT_SEEK} 32 or 33kiB, see reference manual # -part u-boot --source rawcopy --sourceparams="file=imx-boot" --ondisk mmcblk --no-table --align ${IMX_BOOT_SEEK} +part u-boot --source rawcopy --sourceparams="file=${IMX_BOOTPART_FILE_WKS}" --ondisk mmcblk --no-table --align ${IMX_BOOT_SEEK} part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 8192 --size 64 part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 8192 diff --git a/wic/imx-imx-boot.wks.in b/wic/imx-imx-boot.wks.in index 8e78b5e35..424413017 100644 --- a/wic/imx-imx-boot.wks.in +++ b/wic/imx-imx-boot.wks.in @@ -13,7 +13,7 @@ # 0 | 8MiB 8MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB) # ${IMX_BOOT_SEEK} 32 or 33kiB, see reference manual # -part u-boot --source rawcopy --sourceparams="file=imx-boot" --ondisk mmcblk --no-table --align ${IMX_BOOT_SEEK} +part u-boot --source rawcopy --sourceparams="file=${IMX_BOOTPART_FILE_WKS}" --ondisk mmcblk --no-table --align ${IMX_BOOT_SEEK} part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 8192 bootloader --ptable msdos diff --git a/wic/imx-uboot-bootpart.wks.in b/wic/imx-uboot-bootpart.wks.in index 8fe019c01..43a3a0b76 100644 --- a/wic/imx-uboot-bootpart.wks.in +++ b/wic/imx-uboot-bootpart.wks.in @@ -12,7 +12,7 @@ # | | | | # 0 1kiB 4MiB 16MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB) # -part u-boot --source rawcopy --sourceparams="file=${UBOOT_BINARY}" --ondisk mmcblk --no-table --align 1 +part u-boot --source rawcopy --sourceparams="file=${IMX_BOOTPART_FILE_WKS}" --ondisk mmcblk --no-table --align 1 part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4096 --size 16 part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4096 diff --git a/wic/imx-uboot-spl-bootpart.wks.in b/wic/imx-uboot-spl-bootpart.wks.in index 8062c51e6..3fecdc3a0 100644 --- a/wic/imx-uboot-spl-bootpart.wks.in +++ b/wic/imx-uboot-spl-bootpart.wks.in @@ -13,7 +13,7 @@ # 0 1kiB 69kiB 4MiB 16MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB) # part SPL --source rawcopy --sourceparams="file=SPL" --ondisk mmcblk --no-table --align 1 -part u-boot --source rawcopy --sourceparams="file=${UBOOT_BINARY}" --ondisk mmcblk --no-table --align 69 +part u-boot --source rawcopy --sourceparams="file=${IMX_BOOTPART_FILE_WKS}" --ondisk mmcblk --no-table --align 69 part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4096 --size 16 part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4096 diff --git a/wic/imx-uboot-spl.wks.in b/wic/imx-uboot-spl.wks.in index db2f89ddb..98f5fcb29 100644 --- a/wic/imx-uboot-spl.wks.in +++ b/wic/imx-uboot-spl.wks.in @@ -13,7 +13,7 @@ # 0 1kiB 69kiB 4MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB) # part SPL --source rawcopy --sourceparams="file=SPL" --ondisk mmcblk --no-table --align 1 -part u-boot --source rawcopy --sourceparams="file=${UBOOT_BINARY}" --ondisk mmcblk --no-table --align 69 +part u-boot --source rawcopy --sourceparams="file=${IMX_BOOTPART_FILE_WKS}" --ondisk mmcblk --no-table --align 69 part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4096 bootloader --ptable msdos diff --git a/wic/imx-uboot.wks b/wic/imx-uboot.wks index 60870c34e..f73172155 100644 --- a/wic/imx-uboot.wks +++ b/wic/imx-uboot.wks @@ -12,7 +12,7 @@ # | | | | # 0 1kiB 4MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB) # -part u-boot --source rawcopy --sourceparams="file=u-boot.imx" --ondisk mmcblk --no-table --align 1 +part u-boot --source rawcopy --sourceparams="file=${IMX_BOOTPART_FILE_WKS}" --ondisk mmcblk --no-table --align 1 part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4096 bootloader --ptable msdos