bootm: Allow building bootm.c without CONFIG_SYS_BOOTM_LEN
authorSimon Glass <sjg@chromium.org>
Thu, 6 Mar 2025 00:25:07 +0000 (17:25 -0700)
committerTom Rini <trini@konsulko.com>
Tue, 18 Mar 2025 19:12:15 +0000 (13:12 -0600)
This code cannot be compiled by boards which don't have this option. Add
an accessor in the header file to avoid another #ifdef

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
boot/bootm.c
include/bootm.h

index 854ac7e..c719a50 100644 (file)
@@ -633,11 +633,11 @@ static int bootm_load_os(struct bootm_headers *images, int boot_progress)
        load_buf = map_sysmem(load, 0);
        image_buf = map_sysmem(os.image_start, image_len);
        err = image_decomp(os.comp, load, os.image_start, os.type,
-                          load_buf, image_buf, image_len,
-                          CONFIG_SYS_BOOTM_LEN, &load_end);
+                          load_buf, image_buf, image_len, bootm_len(),
+                          &load_end);
        if (err) {
-               err = handle_decomp_error(os.comp, load_end - load,
-                                         CONFIG_SYS_BOOTM_LEN, err);
+               err = handle_decomp_error(os.comp, load_end - load, bootm_len(),
+                                         err);
                bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
                return err;
        }
index c471615..d174f18 100644 (file)
@@ -89,6 +89,14 @@ struct bootm_info {
 #define bootm_x86_set(_bmi, _field, _val)
 #endif
 
+static inline ulong bootm_len(void)
+{
+#ifdef CONFIG_SYS_BOOTM_LEN
+       return CONFIG_SYS_BOOTM_LEN;
+#endif
+       return 0;
+}
+
 /**
  * bootm_init() - Set up a bootm_info struct with useful defaults
  *