From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Simon Glass <sjg@chromium.org>,
Eddie James <eajames@linux.ibm.com>,
Igor Opaniuk <igor.opaniuk@gmail.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Mattijs Korpershoek <mkorpershoek@baylibre.com>,
Maxim Moskalets <maximmosk4@gmail.com>,
Paul-Erwan Rio <paulerwan.rio@gmail.com>,
Raymond Mao <raymond.mao@linaro.org>,
Roman Stratiienko <r.stratiienko@gmail.com>,
Tom Rini <trini@konsulko.com>
Subject: [PATCH 03/19] boot: Allow FIT to fall back from best-match option
Date: Thu, 29 Aug 2024 08:57:46 -0600 [thread overview]
Message-ID: <20240829145802.1827952-4-sjg@chromium.org> (raw)
In-Reply-To: <20240829145802.1827952-1-sjg@chromium.org>
When the best-match feature fails to find something, use the provided
config name as a fallback. The allows SPL to select a suitable config
when best-match is enabled.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
boot/image-fit.c | 19 ++++++++++---------
include/image.h | 4 +++-
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/boot/image-fit.c b/boot/image-fit.c
index 7d56f0b5e6e..439ff51edf6 100644
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -1729,13 +1729,13 @@ int fit_conf_find_compat(const void *fit, const void *fdt)
images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH);
if (confs_noffset < 0 || images_noffset < 0) {
debug("Can't find configurations or images nodes.\n");
- return -1;
+ return -EINVAL;
}
fdt_compat = fdt_getprop(fdt, 0, "compatible", &fdt_compat_len);
if (!fdt_compat) {
debug("Fdt for comparison has no \"compatible\" property.\n");
- return -1;
+ return -ENXIO;
}
/*
@@ -1812,7 +1812,7 @@ int fit_conf_find_compat(const void *fit, const void *fdt)
}
if (!best_match_offset) {
debug("No match found.\n");
- return -1;
+ return -ENOENT;
}
return best_match_offset;
@@ -2095,17 +2095,18 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
* fit_conf_get_node() will try to find default config node
*/
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_NO_UNIT_NAME);
- if (IS_ENABLED(CONFIG_FIT_BEST_MATCH) && !fit_uname_config) {
- cfg_noffset = fit_conf_find_compat(fit, gd_fdt_blob());
- } else {
- cfg_noffset = fit_conf_get_node(fit, fit_uname_config);
- }
- if (cfg_noffset < 0) {
+ ret = -ENXIO;
+ if (IS_ENABLED(CONFIG_FIT_BEST_MATCH) && !fit_uname_config)
+ ret = fit_conf_find_compat(fit, gd_fdt_blob());
+ if (ret < 0 && ret != -EINVAL)
+ ret = fit_conf_get_node(fit, fit_uname_config);
+ if (ret < 0) {
puts("Could not find configuration node\n");
bootstage_error(bootstage_id +
BOOTSTAGE_SUB_NO_UNIT_NAME);
return -ENOENT;
}
+ cfg_noffset = ret;
fit_base_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
printf(" Using '%s' configuration\n", fit_base_uname_config);
diff --git a/include/image.h b/include/image.h
index dbf8d0e7ba9..92128180e0f 100644
--- a/include/image.h
+++ b/include/image.h
@@ -1423,7 +1423,9 @@ int fit_check_format(const void *fit, ulong size);
* copied into the configuration node in the FIT image. This is required to
* match configurations with compressed FDTs.
*
- * Returns: offset to the configuration to use if one was found, -1 otherwise
+ * Returns: offset to the configuration to use if one was found, -EINVAL if
+ * there a /configurations or /images node is missing, -ENOENT if no match was
+ * found, -ENXIO if the FDT node has no compatible string
*/
int fit_conf_find_compat(const void *fit, const void *fdt);
--
2.34.1
next prev parent reply other threads:[~2024-08-29 14:58 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 14:57 [PATCH 00/19] vbe: Series part E Simon Glass
2024-08-29 14:57 ` [PATCH 01/19] image: Add a prototype for fit_image_get_phase() Simon Glass
2024-08-29 14:57 ` [PATCH 02/19] serial: ns16550: Allow clocks to be missing Simon Glass
2024-08-29 17:24 ` Tom Rini
2024-09-20 7:25 ` Simon Glass
2024-08-29 14:57 ` Simon Glass [this message]
2024-09-04 22:25 ` [PATCH 03/19] boot: Allow FIT to fall back from best-match option Tom Rini
2024-09-20 15:59 ` Simon Glass
2024-09-20 16:34 ` Tom Rini
2024-08-29 14:57 ` [PATCH 04/19] bootstd: Avoid sprintf() in SPL when creating bootdevs Simon Glass
2024-08-29 14:57 ` [PATCH 05/19] boot: Respect the load_op in fit_image_load() Simon Glass
2024-09-04 22:25 ` Tom Rini
2024-08-29 14:57 ` [PATCH 06/19] malloc: Show amount of used space when memory runs out Simon Glass
2024-08-29 17:26 ` Tom Rini
2024-09-20 7:25 ` Simon Glass
2024-09-20 14:59 ` Tom Rini
2024-09-20 16:04 ` Simon Glass
2024-09-20 16:35 ` Tom Rini
2024-09-21 11:37 ` Simon Glass
2024-08-29 14:57 ` [PATCH 07/19] malloc: Provide a simple malloc for VPL Simon Glass
2024-08-29 14:57 ` [PATCH 08/19] Support setting a maximum size for the VPL image Simon Glass
2024-08-29 14:57 ` [PATCH 09/19] spl: Report a loader failure Simon Glass
2024-08-29 14:57 ` [PATCH 10/19] spl: Allow serial to be disabled in any XPL phase Simon Glass
2024-08-29 14:57 ` [PATCH 11/19] spl: Support a relocated stack " Simon Glass
2024-08-29 14:57 ` [PATCH 12/19] spl: Drop use of uintptr_t Simon Glass
2024-08-29 14:57 ` [PATCH 13/19] spl: Drop a duplicate variable in boot_from_devices() Simon Glass
2024-08-29 14:57 ` [PATCH 14/19] spl: Add some more debugging to load_simple_fit() Simon Glass
2024-08-29 14:57 ` [PATCH 15/19] spl: lib: Allow for decompression in any SPL build Simon Glass
2024-08-29 14:57 ` [PATCH 16/19] boot: Allow use of FIT in TPL and VPL Simon Glass
2024-08-29 14:58 ` [PATCH 17/19] lib: Allow crc8 " Simon Glass
2024-08-29 17:30 ` Tom Rini
2024-08-29 14:58 ` [PATCH 18/19] boot: Imply CRC8 with VBE Simon Glass
2024-08-29 17:31 ` Tom Rini
2024-09-20 7:25 ` Simon Glass
2024-08-29 14:58 ` [PATCH 19/19] hash: Plumb crc8 into the hash functions Simon Glass
2024-08-30 12:17 ` Peter Robinson
2024-09-01 20:09 ` Simon Glass
2024-08-29 18:32 ` [PATCH 00/19] vbe: Series part E Tom Rini
2024-08-30 1:06 ` Simon Glass
2024-08-30 12:18 ` Caleb Connolly
2024-09-19 14:11 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240829145802.1827952-4-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=eajames@linux.ibm.com \
--cc=igor.opaniuk@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=maximmosk4@gmail.com \
--cc=mkorpershoek@baylibre.com \
--cc=paulerwan.rio@gmail.com \
--cc=r.stratiienko@gmail.com \
--cc=raymond.mao@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.