[PATCH v2] emulation: fdt: Allow using U-Boot's device tree with QEMU

Tom Rini trini at konsulko.com
Wed Apr 16 15:50:15 CEST 2025


On Wed, Apr 16, 2025 at 07:33:51AM +0200, Heinrich Schuchardt wrote:
> On 4/5/25 21:07, 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.
> 
> This description looks wrong:
> 
> Signatures are in FIT images.
> 
> Only public keys to validate the signatures should be compiled into U-Boot.
> 
> > 
> > A proposed change to QEMU to allow device tree additions has been
> > blocked for several years. The only known workaround is to use QEMU's
> > dumpdtb option, merge in the signature node manually, disable
> > OF_HAS_PRIOR_STAGE and then start QEMU with special arguments. This is
> > complicated enough that it is documented in U-Boot[1].
> 
> This seems to relate to
> [PATCH] hw/arm/virt: Allow additions to the generated device tree
> https://lore.kernel.org/qemu-devel/20210926183410.256484-1-sjg@chromium.org/
> 
> As your describe in [1] QEMU already provides a -dtb parameter if you want a
> crafted device-tree. Your proposed change is confounding boot stages and and
> would not provide value to the QEMU project. It was therefore rejected for
> good.
> 
> It remains unclear why you would disable OF_HAS_PRIOR_STAGE if you were
> using QEMU's -dtb parameter.
> 
> What would be the benefit of compiling the DT into U-Boot instead of
> providing it via the -dtb parameter?
> 
> > 
> > Unfortunately the only way to disable OF_HAS_PRIOR_STAGE at present is
> > to hack the Kconfig.
> > 
> > Add a new QEMU_MANUAL_DTB Kconfig option which makes OF_HAS_PRIOR_STAGE
> > optional, thus avoiding needing to patch U-Boot to get this working.
> > 
> > This seems a clearer solution than just making OF_HAS_PRIOR_STAGE
> > visible, since that symbol is intended to be set automatically by each
> > platform.
> 
> To me the new parameter is harder to use than simply making
> CONFIG_OF_HAS_PRIOR_STAGE always editable.

I don't want OF_HAS_PRIOR_STAGE to be editable. Ideally, we shouldn't
ever be asking the user/developer to put this in the config, it's a
feature of the board. But as part of Simon's whole "Why don't [I] try
saying yes?" request, I'm trying to accommodate the design he has in
mind. And so, for QEMU, we need something here, because on real hardware
implementing the scheme, everything required would already be in the
provided tree.

-- 
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/20250416/7ef94a23/attachment.sig>


More information about the U-Boot mailing list