fit: print conf node compatibles + use property string constants
v2 cover fit: print conf node compatibles + use property string constants
This does a bit of "cleanup" by reusing constants for some FIT properties instead of having the same string in multiple places.
Additionally, this adds a new constant for the compatible property in FIT configuration nodes[1] which is useful for FIT images with multiple FIT configuration nodes to support multiple devices in the same blob. U-Boot will try to figure out which node to select based on that compatible[2].
However, if this property is missing (and the first blob in the fdt property of the configuration node is uncompressed), the compatible from the root node of the associated kernel FDT will be used for the autoselection mechanism. For now, I only print the property if it exists, but maybe it'd make sense to expose the fallback one if it's missing. I guess we can implement that later on if desired.
[1] https://fitspec.osfw.foundation/#optional-properties compatible paragraph
[2] https://fitspec.osfw.foundation/#select-a-configuration-to-boot
---
Changes in v2:
- rebased on top of next,
- removed RFC status so it gets some attention,
---
Quentin Schulz (4):
boot/fit: use constants for property strings
lib: rsa: use FIT_ALGO_PROP constant instead of "algo" in FIT boot/fit: declare (and use) new constant for conf's compatible prop boot/fit: print all configuration node compatibles
boot/common_fit.c | 4 ++-- boot/image-fit.c | 15 +++++++++++++-- include/image.h | 1 + lib/rsa/rsa-verify.c | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-)
---
base-commit: dca19206acf2af2d339087bb62aa0b8ee1b0e326
change-id: 20250409-fit-compat-ebe94f690b08
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
PATCH v2 1/4 boot/fit: use constants for property strings
From: Quentin Schulz <[email protected]>
Some properties have their string represented in include/image.h via constants, so let's use those constants instead of using a hardcoded string.
--- boot/common_fit.c | 4 ++-- boot/image-fit.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
boot/common_fit.c +2 -2
@@ -46,12 +46,12 @@ int fit_find_config_node(const void *fdt)return -EINVAL ; } - dflt_conf_name =fdt_getprop (fdt, conf,"default" , &len); + dflt_conf_name =fdt_getprop (fdt, conf,FIT_DEFAULT_PROP , &len);for (node =fdt_first_subnode (fdt, conf); node >=0 ; node =fdt_next_subnode (fdt, node)) { - name =fdt_getprop (fdt, node,"description" , &len); + name =fdt_getprop (fdt, node,FIT_DESC_PROP , &len);if (!name) {#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: Missing FDT description in DTB\n",
boot/image-fit.c +1 -1
@@ -1760,7 +1760,7 @@ int fit_conf_find_compat(const void *fit, const void *fdt) fdt = fit;/* search in FIT image */ compat_noffset = noffset;/* search under config node */ }else {/* Otherwise extract it from the kernel FDT. */ - kfdt_name =fdt_getprop (fit, noffset,"fdt" , &len); + kfdt_name =fdt_getprop (fit, noffset,FIT_FDT_PROP , &len);if (!kfdt_name) {debug ("No fdt property found.\n" );continue ;
Signature · 1 line
2.52.0
Re: [PATCH next v2 1/4] boot/fit: use constants for property strings
Quoted 7 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
Some properties have their string represented in
include/image.hvia constants, so let's use those constants instead of using a hardcoded string.
Quoted 6 lines
Signed-off-by Quentin Schulz <[email protected]>--- boot/common_fit.c | 4 ++-- boot/image-fit.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
PATCH v2 2/4 lib: rsa: use FIT_ALGO_PROP constant instead of "algo" in FIT
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
Some FIT image properties have their string represented in include/image.h via constants. FIT_ALGO_PROP does exist and would fit the bill so let's use it instead of using a hardcoded string.
--- lib/rsa/rsa-verify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/rsa/rsa-verify.c +1 -1
@@ -448,7 +448,7 @@ static int rsa_verify_with_keynode(struct image_sign_info *info,return -EBADF ; } - algo =fdt_getprop (blob, node,"algo" ,NULL ); + algo =fdt_getprop (blob, node,FIT_ALGO_PROP ,NULL );if (!algo) {debug ("%s: Missing 'algo' property\n" , __func__);return -EFAULT ;
Signature · 1 line
2.52.0
Re: [PATCH next v2 2/4] lib: rsa: use FIT_ALGO_PROP constant instead of "algo" in FIT
Quoted 11 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
Some FIT image properties have their string represented in
include/image.hvia constants.FIT_ALGO_PROPdoes exist and would fit the bill so let's use it instead of using a hardcoded string.Signed-off-by Quentin Schulz <[email protected]>--- lib/rsa/rsa-verify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v2 3/4 boot/fit: declare (and use) new constant for conf's compatible prop
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
Fit conf node may have a compatible property[1] which stores the root compatible of the first blob in the fdt property of the node. This can be used to automatically select the proper conf node based on the compatible from the running U-Boot (matching the former's compatible with the latter)[2].
This adds (and uses) this constant for FIT node parsing.
Note that this property may also appear in fpga image nodes[3] but that isn't done in this commit.
[1] https://fitspec.osfw.foundation/#optional-properties compatible paragraph
[2] https://fitspec.osfw.foundation/#select-a-configuration-to-boot
[3] https://fitspec.osfw.foundation/#images-node 2.3.2 Conditionally mandatory property
--- boot/image-fit.c | 2 +- include/image.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
boot/image-fit.c +1 -1
@@ -1756,7 +1756,7 @@ int fit_conf_find_compat(const void *fit, const void *fdt)continue ;/* If there's a compat property in the config node, use that. */ -if (fdt_getprop (fit, noffset,"compatible" ,NULL )) { +if (fdt_getprop (fit, noffset,FIT_COMPAT_PROP ,NULL )) { fdt = fit;/* search in FIT image */ compat_noffset = noffset;/* search under config node */ }else {/* Otherwise extract it from the kernel FDT. */
include/image.h +1 -0
@@ -1105,6 +1105,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,#define FIT_SCRIPT_PROP "script"#define FIT_PHASE_PROP "phase"#define FIT_TFA_BL31_PROP "tfa-bl31" +#define FIT_COMPAT_PROP "compatible"#define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
Signature · 1 line
2.52.0
Re: [PATCH next v2 3/4] boot/fit: declare (and use) new constant for conf's compatible prop
Quoted 14 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
Fit conf node may have a compatible property[1] which stores the root compatible of the first blob in the fdt property of the node. This can be used to automatically select the proper conf node based on the compatible from the running U-Boot (matching the former's compatible with the latter)[2].
This adds (and uses) this constant for FIT node parsing.
Note that this property may also appear in fpga image nodes[3] but that isn't done in this commit.
Quoted 9 lines
[1] https://fitspec.osfw.foundation/#optional-properties compatible paragraph
[2] https://fitspec.osfw.foundation/#select-a-configuration-to-boot
[3] https://fitspec.osfw.foundation/#images-node 2.3.2 Conditionally mandatory propertySigned-off-by Quentin Schulz <[email protected]>--- boot/image-fit.c | 2 +- include/image.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
PATCH v2 4/4 boot/fit: print all configuration node compatibles
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
Fit conf node may have a compatible property[1] which stores the compatible of the first blob in the fdt property of the node. This can be used to automatically select the proper conf node based on the compatible from the running U-Boot (matching the former's compatible with the latter)[2].
This brings the ability to mkimage/dumpimage to print the compatibles of the configuration node(s). U-Boot CLI commands such as iminfo also see this addition to their output.
[1] https://fitspec.osfw.foundation/#optional-properties compatible paragraph
[2] https://fitspec.osfw.foundation/#select-a-configuration-to-boot
--- boot/image-fit.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
boot/image-fit.c +11 -0
@@ -323,6 +323,17 @@ static void fit_conf_print(const void *fit, int noffset, const char *p)printf ("%s\n" , uname); } +for (fdt_index =0 ; + uname =fdt_stringlist_get (fit, noffset,FIT_COMPAT_PROP , + fdt_index,NULL ), uname; + fdt_index++) { +if (fdt_index ==0 ) +printf ("%s Compatible: " , p); +else +printf ("%s " , p); +printf ("%s\n" , uname); + } + uname =fdt_getprop (fit, noffset,FIT_FPGA_PROP ,NULL );if (uname)printf ("%s FPGA: %s\n" , p, uname);
Signature · 1 line
2.52.0
Re: [PATCH next v2 4/4] boot/fit: print all configuration node compatibles
Quoted 44 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
Fit conf node may have a compatible property[1] which stores the compatible of the first blob in the fdt property of the node. This can be used to automatically select the proper conf node based on the compatible from the running U-Boot (matching the former's compatible with the latter)[2].
This brings the ability to mkimage/dumpimage to print the compatibles of the configuration node(s). U-Boot CLI commands such as iminfo also see this addition to their output.
[1] https://fitspec.osfw.foundation/#optional-properties compatible paragraph
[2] https://fitspec.osfw.foundation/#select-a-configuration-to-bootSigned-off-by Quentin Schulz <[email protected]>--- boot/image-fit.c | 11 +++++++++++ 1 file changed, 11 insertions(+)boot/image-fit.c +11
-1@@ -323,6 +323,17 @@ static void fit_conf_print(const void *fit, int noffset, const char *p)printf ("%s\n" , uname); } +for (fdt_index =0 ; + uname =fdt_stringlist_get (fit, noffset,FIT_COMPAT_PROP , + fdt_index,NULL ), uname; + fdt_index++) { +if (fdt_index ==0 ) +printf ("%s Compatible: " , p); +else +printf ("%s " , p); +printf ("%s\n" , uname); + } + uname =fdt_getprop (fit, noffset,FIT_FPGA_PROP ,NULL );if (uname)printf ("%s FPGA: %s\n" , p, uname); --
Quoted 2 lines
2.52.0
Concept has:
40fd6b04b9f boot: Show compatible strings with FIT information
Re: [PATCH next v2 4/4] boot/fit: print all configuration node compatibles
Hi Simon,
Quoted 1 line · Simon Glass
On Wed, 3 Dec 2025 at 09:19, Quentin Schulz <[email protected]> wrote:
[...]
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>
Thanks!
Quoted 3 lines
Concept has:
40fd6b04b9fboot: Show compatible strings with FIT information
? I don't understand what you mean?
Cheers,
Quentin
Re: [PATCH next v2 4/4] boot/fit: print all configuration node compatibles
Hi Quentin,
Quoted 10 lines · Quentin Schulz
Hi Simon,
Quoted 1 line · Simon Glass
On Wed, 3 Dec 2025 at 09:19, Quentin Schulz <[email protected]> wrote:
[...]
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>
Quoted 7 lines
Thanks!
Quoted 3 lines
Concept has:
40fd6b04b9fboot: Show compatible strings with FIT information? I don't understand what you mean?
Just mentioning that I have an almost identical patch in the Concept tree. I also recently did a refactoring of printing in general, to try to make it easier to maintain. It's quite a lot of patches (27), but perhaps after the bootm_final stuff I could send some of them.
Regards,
Simon
Quoted 10 lines · Quentin Schulz
This does a bit of "cleanup" by reusing constants for some FIT properties instead of having the same string in multiple places.
Additionally, this adds a new constant for the compatible property in FIT configuration nodes[1] which is useful for FIT images with multiple FIT configuration nodes to support multiple devices in the same blob. U-Boot will try to figure out which node to select based on that compatible[2].
[...]
Applied to u-boot/next, thanks!
[1/4] boot/fit: use constants for property strings
commit: 634dcda25924567d000396542948fc33c7e8bc1a
[2/4] lib: rsa: use FIT_ALGO_PROP constant instead of "algo" in FIT
commit: 883359e152d5000943411ef7d2daaec6c137f47d
[3/4] boot/fit: declare (and use) new constant for conf's compatible prop
commit: 3059eb0c27dd1b4a40a06bda4a47e10246185aca
[4/4] boot/fit: print all configuration node compatibles
commit: 6c7d3ba292c648c9075eb0b82278a844bb1ff953Signature · 1 line
Tom