diff mbox series

[PATCHv3,2/2] image: support board_fit_config_name_match

Message ID 20210104194804.133428-3-sebastian.reichel@collabora.com
State Accepted
Delegated to: Tom Rini
Headers show
Series Support automatic fitImage config selection | expand

Commit Message

Sebastian Reichel Jan. 4, 2021, 7:48 p.m. UTC
Support reusing board_fit_config_name_match() to automatically
select a sensible default configuration for booting fitImages
using 'bootm'.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 common/image-fit.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

Comments

Tom Rini Jan. 6, 2021, 12:56 p.m. UTC | #1
On Mon, Jan 04, 2021 at 08:48:04PM +0100, Sebastian Reichel wrote:

> Support reusing board_fit_config_name_match() to automatically
> select a sensible default configuration for booting fitImages
> using 'bootm'.
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/image-fit.c b/common/image-fit.c
index 097cd38af05c..6a8787ca0aa0 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1738,12 +1738,19 @@  int fit_conf_get_node(const void *fit, const char *conf_uname)
 	if (conf_uname == NULL) {
 		/* get configuration unit name from the default property */
 		debug("No configuration specified, trying default...\n");
-		conf_uname = (char *)fdt_getprop(fit, confs_noffset,
-						 FIT_DEFAULT_PROP, &len);
-		if (conf_uname == NULL) {
-			fit_get_debug(fit, confs_noffset, FIT_DEFAULT_PROP,
-				      len);
-			return len;
+		if (!host_build() && IS_ENABLED(CONFIG_MULTI_DTB_FIT)) {
+			noffset = fit_find_config_node(fit);
+			if (noffset < 0)
+				return noffset;
+			conf_uname = fdt_get_name(fit, noffset, NULL);
+		} else {
+			conf_uname = (char *)fdt_getprop(fit, confs_noffset,
+							 FIT_DEFAULT_PROP, &len);
+			if (conf_uname == NULL) {
+				fit_get_debug(fit, confs_noffset, FIT_DEFAULT_PROP,
+					      len);
+				return len;
+			}
 		}
 		debug("Found default configuration: '%s'\n", conf_uname);
 	}