[PATCH] bootm: add os_type field to struct image_data

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Dec 15 00:52:37 PST 2025


We already call file_detect_type() on data->os_header, but do not stash
the result anywhere beyond a local variable in bootm_boot().

Let's save it into struct image_data, so we do not have to repeat the
operation at other places in the upcoming EFI loader patches.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/bootm.c  | 2 +-
 include/bootm.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/bootm.c b/common/bootm.c
index 22796b3522ac..620eb19ff1d3 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -816,7 +816,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 	if (size < PAGE_SIZE)
 		goto err_out;
 
-	os_type = file_detect_type(data->os_header, PAGE_SIZE);
+	os_type = data->os_type = file_detect_type(data->os_header, PAGE_SIZE);
 
 	if (!data->force && os_type == filetype_unknown) {
 		pr_err("Unknown OS filetype (try -f)\n");
diff --git a/include/bootm.h b/include/bootm.h
index da3e5d7e4b36..b08e20c50da7 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -104,6 +104,7 @@ struct image_data {
 	char *tee_file;
 	struct resource *tee_res;
 
+	enum filetype os_type;
 	enum bootm_verify verify;
 	int verbose;
 	int force;
-- 
2.47.3




More information about the barebox mailing list