fdt: Allow OF_HAS_PRIOR_STAGE to be disabled in defconfig
PATCH 1/1 fdt: Allow OF_HAS_PRIOR_STAGE to be disabled in defconfig
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.
---
dts/Kconfig | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
dts/Kconfig +8 -3
@@ -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/[email protected]/#24481799 config OF_OMIT_DTB bool "Omit the device tree output when building"
Signature · 1 line
2.43.0
Quoted 10 lines · Simon Glass
At present it is impossible to change the
qemu_arm64defconfig 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
Quoted 6 lines
Unfortunately the only way to disable
OF_HAS_PRIOR_STAGEat present is to hack theKconfig. So update it to allow use from defconfig. This avoids needing to patch U-Boot to get this working.
How about instead we do something like:
arch/arm/Kconfig +1 -1
@@ -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
board/emulation/common/Kconfig +7 -0
@@ -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.
Signature · 1 line
Tom
Hi Tom,
Quoted 50 lines · Tom Rini
Quoted 10 lines · Simon Glass
At present it is impossible to change the
qemu_arm64defconfig 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_STAGEQuoted 6 lines
Unfortunately the only way to disable
OF_HAS_PRIOR_STAGEat present is to hack theKconfig. So update it to allow use from defconfig. This avoids needing to patch U-Boot to get this working.How about instead we do something like:
arch/arm/Kconfig +1
-1@@ -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_BLACKboard/emulation/common/Kconfig +7
-0@@ -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.
Quoted 1 line
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
Quoted 53 lines · Simon Glass
Hi Tom,
Quoted 50 lines · Tom Rini
Quoted 10 lines · Simon Glass
At present it is impossible to change the
qemu_arm64defconfig 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_STAGEQuoted 6 lines
Unfortunately the only way to disable
OF_HAS_PRIOR_STAGEat present is to hack theKconfig. So update it to allow use from defconfig. This avoids needing to patch U-Boot to get this working.How about instead we do something like:
arch/arm/Kconfig +1
-1@@ -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_BLACKboard/emulation/common/Kconfig +7
-0@@ -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.
Quoted 4 lines
Quoted 1 line
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.
Signature · 1 line
Tom