From: Simon Glass <sjg@chromium.org>
Date: Mon, 28 Sep 2020 00:46:20 +0000 (-0600)
Subject: binman: Support multiple images in the library
X-Git-Tag: v2025.01-rc5-pxa1908~2146^2~69
X-Git-Url: http://git.dujemihanovic.xyz/%22mailto:Murray.Jensen%40csiro.au/static/git-logo.png?a=commitdiff_plain;h=83187546ae;p=u-boot.git

binman: Support multiple images in the library

Add support for multiple images, since these are used on x86 now. Select
the first image for now, since that is generally the correct one. At some
point we can add a way to determine which image is currently running.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

diff --git a/lib/binman.c b/lib/binman.c
index 79e497fc8d..e71c1b9e99 100644
--- a/lib/binman.c
+++ b/lib/binman.c
@@ -96,6 +96,13 @@ int binman_init(void)
 	binman->image = ofnode_path("/binman");
 	if (!ofnode_valid(binman->image))
 		return log_msg_ret("binman node", -EINVAL);
+	if (ofnode_read_bool(binman->image, "multiple-images")) {
+		ofnode node = ofnode_first_subnode(binman->image);
+
+		if (!ofnode_valid(node))
+			return log_msg_ret("first image", -ENOENT);
+		binman->image = node;
+	}
 	binman->rom_offset = ROM_OFFSET_NONE;
 
 	return 0;