[PATCH] fdt: Allow OF_HAS_PRIOR_STAGE to be disabled in defconfig

Tom Rini trini at konsulko.com
Thu Apr 3 21:02:40 CEST 2025


On Fri, Apr 04, 2025 at 06:53:49AM +1300, Simon Glass wrote:

> At present it is impossible to change the qemu_arm64 defconfig to
> obtain a devicetree from the U-Boot build.
> 
> This is necessary for FIT validation, for example, where the signature
> node must be compiled into U-Boot.
> 
> A proposed change to QEMU has been blocked for several years. As a
> workaround, the only option is to use QEMU's dumpdtb option, merge in
> the signature node manually and then disable OF_HAS_PRIOR_STAGE
> 
> Unfortunately the only way to disable OF_HAS_PRIOR_STAGE at present is
> to hack the Kconfig. So update it to allow use from defconfig. This
> avoids needing to patch U-Boot to get this working.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> Link: https://patchwork.kernel.org/project/qemu-devel/patch/20210926183410.256484-1-sjg@chromium.org/#24481799

How about instead we do something like:
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b7311d3b754b..44e45a304cd0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1080,7 +1080,7 @@ config ARCH_QEMU
 	imply DM_RNG
 	imply DM_RTC
 	imply RTC_PL031
-	imply OF_HAS_PRIOR_STAGE if !TARGET_QEMU_ARM_SBSA
+	imply OF_HAS_PRIOR_STAGE if !QEMU_MANUAL_DTB
 	imply VIDEO
 	imply VIDEO_BOCHS
 	imply SYS_WHITE_ON_BLACK
diff --git a/board/emulation/common/Kconfig b/board/emulation/common/Kconfig
index 4c15c8bcb891..9053f2ff2f55 100644
--- a/board/emulation/common/Kconfig
+++ b/board/emulation/common/Kconfig
@@ -13,3 +13,10 @@ config MTDPARTS_NOR1
 	help
 	  This define the partition of nor1 used to build mtparts dynamically
 	  for the u-boot env stored on nor1.
+
+config QEMU_MANUAL_DTB
+	bool "Manually provide a device tree to QEMU"
+	depends on ARCH_QEMU # Expand more if needed
+	help
+	  For some use cases, such as FIT validation of U-Boot itself we need
+	  to override the device tree that QEMU would normally provide to us.

This way we don't start opening asking OF_HAS_PRIOR_STAGE.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250403/cfdba39f/attachment.sig>


More information about the U-Boot mailing list