* [PATCH] fdt: Allow OF_HAS_PRIOR_STAGE to be disabled in defconfig
@ 2025-04-03 17:53 Simon Glass
2025-04-03 19:02 ` Tom Rini
0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2025-04-03 17:53 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Caleb Connolly, Jan Kiszka,
Jerry Van Baren, Marek Mojík, Marek Vasut, Neil Armstrong,
Sumit Garg, This contributor prefers not to receive mails
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@chromium.org>
Link: https://patchwork.kernel.org/project/qemu-devel/patch/20210926183410.256484-1-sjg@chromium.org/#24481799
---
dts/Kconfig | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dts/Kconfig b/dts/Kconfig
index 2e88d210bb8..2fe4468d1a9 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -190,7 +190,7 @@ config OF_BOARD
earlier stage should enable OF_HAS_PRIOR_STAGE.
config OF_HAS_PRIOR_STAGE
- bool
+ bool "Device tree comes from prior-stage firmware"
help
Indicates that a prior stage of the firmware (before U-Boot proper)
makes use of device tree and this board normally boots with that prior
@@ -205,8 +205,13 @@ config OF_HAS_PRIOR_STAGE
development purposes, but it is not recommended, and likely will not
even work, for production systems.
- Note: This option must be set in Kconfig and cannot be enabled or
- disabled in the board's defconfig file.
+ Note: This option can be updated in the board's defconfig file if
+ needed. E.g. for QEMU to support FIT validation the devicetree must
+ include a public key.
+
+ See also this for context:
+
+ https://patchwork.kernel.org/project/qemu-devel/patch/20210926183410.256484-1-sjg@chromium.org/#24481799
config OF_OMIT_DTB
bool "Omit the device tree output when building"
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fdt: Allow OF_HAS_PRIOR_STAGE to be disabled in defconfig
2025-04-03 17:53 [PATCH] fdt: Allow OF_HAS_PRIOR_STAGE to be disabled in defconfig Simon Glass
@ 2025-04-03 19:02 ` Tom Rini
2025-04-03 20:40 ` Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: Tom Rini @ 2025-04-03 19:02 UTC (permalink / raw)
To: Simon Glass
Cc: U-Boot Mailing List, Caleb Connolly, Jan Kiszka, Jerry Van Baren,
Marek Mojík, Marek Vasut, Neil Armstrong, Sumit Garg,
This contributor prefers not to receive mails
[-- Attachment #1: Type: text/plain, Size: 2028 bytes --]
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@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fdt: Allow OF_HAS_PRIOR_STAGE to be disabled in defconfig
2025-04-03 19:02 ` Tom Rini
@ 2025-04-03 20:40 ` Simon Glass
2025-04-03 21:48 ` Tom Rini
0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2025-04-03 20:40 UTC (permalink / raw)
To: Tom Rini
Cc: U-Boot Mailing List, Caleb Connolly, Jan Kiszka, Jerry Van Baren,
Marek Mojík, Marek Vasut, Neil Armstrong, Sumit Garg,
This contributor prefers not to receive mails
Hi Tom,
On Fri, 4 Apr 2025 at 08:02, Tom Rini <trini@konsulko.com> wrote:
>
> 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@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.
Yes that seems fine, thanks. If it ends up becoming a more general
problem we can worry about it then.
Regards,
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fdt: Allow OF_HAS_PRIOR_STAGE to be disabled in defconfig
2025-04-03 20:40 ` Simon Glass
@ 2025-04-03 21:48 ` Tom Rini
0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2025-04-03 21:48 UTC (permalink / raw)
To: Simon Glass
Cc: U-Boot Mailing List, Caleb Connolly, Jan Kiszka, Jerry Van Baren,
Marek Mojík, Marek Vasut, Neil Armstrong, Sumit Garg,
This contributor prefers not to receive mails
[-- Attachment #1: Type: text/plain, Size: 2711 bytes --]
On Fri, Apr 04, 2025 at 09:40:18AM +1300, Simon Glass wrote:
> Hi Tom,
>
> On Fri, 4 Apr 2025 at 08:02, Tom Rini <trini@konsulko.com> wrote:
> >
> > 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@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.
>
> Yes that seems fine, thanks. If it ends up becoming a more general
> problem we can worry about it then.
Thanks. I'll let you make that up in to a more general and complete
patch, that was just me poking at the files for a moment.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-03 21:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 17:53 [PATCH] fdt: Allow OF_HAS_PRIOR_STAGE to be disabled in defconfig Simon Glass
2025-04-03 19:02 ` Tom Rini
2025-04-03 20:40 ` Simon Glass
2025-04-03 21:48 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox