[PATCH 03/13] boot: Tidy up setting of the OS arch on host builds
Simon Glass
sjg at chromium.org
Wed Mar 25 17:54:12 CET 2026
This field is not present in host builds. Create an inline function to
handle this complexity, so we can drop the #ifdef in the C file.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
boot/image-fit.c | 10 ++--------
include/image.h | 7 +++++++
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/boot/image-fit.c b/boot/image-fit.c
index f8772f64cb3..5680cc8b496 100644
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -2193,7 +2193,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
size_t size;
int type_ok, os_ok;
ulong load, load_end, data, len;
- uint8_t os, comp;
+ uint8_t os, comp, os_arch;
const char *prop_name;
fit = map_sysmem(addr, 0);
@@ -2218,14 +2218,8 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
}
}
-#ifndef USE_HOSTCC
- {
- uint8_t os_arch;
-
fit_image_get_arch(fit, noffset, &os_arch);
- images->os.arch = os_arch;
- }
-#endif
+ images_set_arch(images, os_arch);
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL);
type_ok = fit_image_check_type(fit, noffset, image_type) ||
diff --git a/include/image.h b/include/image.h
index 34efac6056d..5e11dc92559 100644
--- a/include/image.h
+++ b/include/image.h
@@ -418,6 +418,13 @@ struct bootm_headers {
extern struct bootm_headers images;
+static inline void images_set_arch(struct bootm_headers *images, int os_arch)
+{
+#ifndef USE_HOSTCC
+ images->os.arch = os_arch;
+#endif
+}
+
/*
* Some systems (for example LWMON) have very short watchdog periods;
* we must make sure to split long operations like memmove() or
--
2.43.0
More information about the U-Boot
mailing list