Merge patch series "fit: print conf node compatibles + use property string constants"

Quentin Schulz <foss+uboot@0leil.net> says:

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

Link: https://lore.kernel.org/r/20251203-fit-compat-v2-0-0fea56f23809@cherry.de
This commit is contained in:
Tom Rini
2025-12-16 11:40:54 -06:00
4 changed files with 17 additions and 5 deletions
+2 -2
View File
@@ -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",
+13 -2
View File
@@ -328,6 +328,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);
@@ -1761,11 +1772,11 @@ 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. */
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;
+1
View File
@@ -1106,6 +1106,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
#define FIT_PHASE_PROP "phase"
#define FIT_TFA_BL31_PROP "tfa-bl31"
#define FIT_TEE_PROP "tee"
#define FIT_COMPAT_PROP "compatible"
#define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
+1 -1
View File
@@ -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;