
Detect this condition and set a flag in the images struct to remember that no OS is being loaded. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/bootm.c | 14 +++++++++++++- include/image.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/boot/bootm.c b/boot/bootm.c index 02bc81eb9e5..5caeb94a998 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -193,13 +193,20 @@ static int boot_get_kernel(const char *addr_fit, struct bootm_headers *images, IH_ARCH_DEFAULT, IH_TYPE_KERNEL, BOOTSTAGE_ID_FIT_KERNEL_START, FIT_LOAD_IGNORED, os_data, os_len); - if (os_noffset < 0) + if (os_noffset < 0 && os_noffset != -ENOPKG) return -ENOENT; images->fit_hdr_os = map_sysmem(img_addr, 0); images->fit_uname_os = fit_uname_kernel; images->fit_uname_cfg = fit_uname_config; images->fit_noffset_os = os_noffset; + if (os_noffset == -ENOPKG) { + log_debug("no_os: hdr_os %lx uname_os '%s' uname_cfg '%s' noffset_os %dE\n", + img_addr, images->fit_uname_os, + images->fit_uname_cfg, + images->fit_noffset_os); + return -ENOPKG; + } break; #endif #ifdef CONFIG_ANDROID_BOOT_IMAGE @@ -335,6 +342,11 @@ static int bootm_find_os(const char *cmd_name, const char *addr_fit) ret = boot_get_kernel(addr_fit, &images, &images.os.image_start, &images.os.image_len, &os_hdr); if (ret) { + /* no OS present, but that is OK */ + if (ret == -ENOPKG) { + images.no_os = true; + return 0; + } if (ret == -EPROTOTYPE) printf("Wrong Image Type for %s command\n", cmd_name); diff --git a/include/image.h b/include/image.h index 254d1731b96..0c5575adbbf 100644 --- a/include/image.h +++ b/include/image.h @@ -455,6 +455,9 @@ struct bootm_headers { int verify; /* env_get("verify")[0] != 'n' */ enum bootm_state state; + + /* true if this is a load-only FIT with no OS */ + bool no_os; }; extern struct bootm_headers images; -- 2.43.0