
Detect the lack of OS and deal with it through the rest of the bootm logic. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/bootm.c | 21 ++++++++++++++------- include/bootm.h | 5 +++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/boot/bootm.c b/boot/bootm.c index 5caeb94a998..d19268ccd84 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -599,15 +599,19 @@ int bootm_find_images(ulong img_addr, const char *conf_ramdisk, static int bootm_find_other(ulong img_addr, const char *conf_ramdisk, const char *conf_fdt) { + bool type_ok, os_ok; + log_debug("find_other type %x os %x\n", images.os.type, images.os.os); - if ((images.os.type == IH_TYPE_KERNEL || - images.os.type == IH_TYPE_KERNEL_NOLOAD || - images.os.type == IH_TYPE_MULTI) && - (images.os.os == IH_OS_LINUX || images.os.os == IH_OS_VXWORKS || - images.os.os == IH_OS_EFI || images.os.os == IH_OS_TEE)) { + + type_ok = images.os.type == IH_TYPE_KERNEL || + images.os.type == IH_TYPE_KERNEL_NOLOAD || + images.os.type == IH_TYPE_MULTI; + os_ok = images.os.os == IH_OS_LINUX || images.os.os == IH_OS_VXWORKS || + images.os.os == IH_OS_EFI || images.os.os == IH_OS_TEE; + + if (images.no_os || (type_ok && os_ok)) return bootm_find_images(img_addr, conf_ramdisk, conf_fdt, 0, 0); - } return 0; } @@ -1075,7 +1079,7 @@ int bootm_run_states(struct bootm_info *bmi, int states) bootm_measure(images); /* Load the OS */ - if (!ret && (states & BOOTM_STATE_LOADOS)) { + if (!ret && (states & BOOTM_STATE_LOADOS) && !images->no_os) { if (IS_ENABLED(CONFIG_EVENT)) { struct event_os_load data; @@ -1113,6 +1117,9 @@ int bootm_run_states(struct bootm_info *bmi, int states) } #endif + if (images->no_os) + return -ENOPKG; + /* From now on, we need the OS boot function */ if (ret) return ret; diff --git a/include/bootm.h b/include/bootm.h index 7c74b6c406d..9ddf9fd364d 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -201,10 +201,11 @@ int bootm_measure(struct bootm_headers *images); * * @bmi: bootm information * @states Mask containing states to run (BOOTM_STATE_...) - * Return: 0 if ok, something else on error. Some errors will cause this + * Return: 0 if ok, -ENOPKG if a 'load-only' FIT was loaded and there is no OS + * to load, something else on error. Some errors will cause this * function to perform a reboot! If states contains BOOTM_STATE_OS_GO * then the intent is to boot an OS, so this function will not return - * unless the image type is standalone. + * unless the image type is standalone or this is a=. */ int bootm_run_states(struct bootm_info *bmi, int states); -- 2.43.0