summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-12-16 11:40:54 -0600
committerTom Rini <[email protected]>2025-12-16 11:40:54 -0600
commita333d9e59f6675c9541c34643f334dbf50898647 (patch)
tree1b1a527bbc4d2fbe2fe6a0a0c68fbe3c0b405111
parent417254ff08ef6647fd73c6963c95ba06015699df (diff)
parent6c7d3ba292c648c9075eb0b82278a844bb1ff953 (diff)
Merge patch series "fit: print conf node compatibles + use property string constants"
Quentin Schulz <[email protected]> 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/[email protected]
-rw-r--r--boot/common_fit.c4
-rw-r--r--boot/image-fit.c15
-rw-r--r--include/image.h1
-rw-r--r--lib/rsa/rsa-verify.c2
4 files changed, 17 insertions, 5 deletions
diff --git a/boot/common_fit.c b/boot/common_fit.c
index a2f9b8d83c3..fd434fe28e1 100644
--- a/boot/common_fit.c
+++ b/boot/common_fit.c
@@ -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",
diff --git a/boot/image-fit.c b/boot/image-fit.c
index f47f37471c0..2d040e38d97 100644
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -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;
diff --git a/include/image.h b/include/image.h
index d543c6cf254..8841dea06c9 100644
--- a/include/image.h
+++ b/include/image.h
@@ -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
diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
index e7e612a4688..3169c3a6dd1 100644
--- a/lib/rsa/rsa-verify.c
+++ b/lib/rsa/rsa-verify.c
@@ -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;