fit: print conf node compatibles + use property string constants
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, hence the RFC state for this series.
[1] https://fitspec.osfw.foundation/#optional-properties compatible paragraph
[2] https://fitspec.osfw.foundation/#select-a-configuration-to-boot
---
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: 341cafc31e4c6941a1b05feb18d18c99ffaebcc1
change-id: 20250409-fit-compat-ebe94f690b08
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
RFC PATCH 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.49.0
RFC PATCH 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.49.0
RFC PATCH 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
@@ -1103,6 +1103,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,#define FIT_STANDALONE_PROP "standalone"#define FIT_SCRIPT_PROP "script"#define FIT_PHASE_PROP "phase" +#define FIT_COMPAT_PROP "compatible"#define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
Signature · 1 line
2.49.0
RFC PATCH 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.49.0
Hi all,
Quoted 9 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].
Quoted 7 lines
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, hence the RFC state for this series.
Gentle ping. Any feedback on the series?
Cheers,
Quentin
Hi all,
Quoted 9 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].
Quoted 7 lines
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, hence the RFC state for this series.
Any feedback on this series?
It doesn't apply cleanly anymore but the conflict resolution is straightforward.
Cheers,
Quentin
Quoted 20 lines · Quentin Schulz
Hi all,
Quoted 9 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].
Quoted 7 lines
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, hence the RFC state for this series.
Quoted 4 lines
Any feedback on this series?
It doesn't apply cleanly anymore but the conflict resolution is straightforward.
I probably marked it as RFC in patchwork. So, how about v1 non-RFC rebased on top of next? Thanks!
Signature · 1 line
Tom