
From: Simon Glass <sjg@chromium.org> There are various functions which announce that booting is imminent and do related preparation. Most of these are arch-specific. In practice, most archs do the a similar thing. It would be better to have a common function, with perhaps some events for things that are really arch- and board-specific. Create a new function for this. For now, nothing uses it. Signed-off-by: Simon Glass <sjg@chromium.org> --- MAINTAINERS | 1 + boot/Makefile | 2 +- boot/bootm_final.c | 12 ++++++++++++ include/bootm.h | 17 +++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 boot/bootm_final.c diff --git a/MAINTAINERS b/MAINTAINERS index 70b06c71d2e..3d19c6cc8be 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -941,6 +941,7 @@ M: Simon Glass <sjg@chromium.org> S: Maintained F: boot/bootdev*.c F: boot/bootflow.c +F: boot/bootm_final.c F: boot/bootmeth*.c F: boot/bootstd.c F: cmd/bootdev.c diff --git a/boot/Makefile b/boot/Makefile index 2b41b92230d..f4968cdcf7e 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -12,7 +12,7 @@ obj-$(CONFIG_PXE_UTILS) += pxe_utils.o endif -obj-y += image.o image-board.o +obj-y += image.o image-board.o bootm_final.o obj-$(CONFIG_ANDROID_AB) += android_ab.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o diff --git a/boot/bootm_final.c b/boot/bootm_final.c new file mode 100644 index 00000000000..15ddbbe5e74 --- /dev/null +++ b/boot/bootm_final.c @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Cleanup before handing off to the OS + * + * Copyright 2025 Simon Glass <sjg@chromium.org> + */ + +#include <bootm.h> + +void bootm_final(enum bootm_final_t flags) +{ +} diff --git a/include/bootm.h b/include/bootm.h index f010a3ecfa2..05d55b2d948 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -16,6 +16,16 @@ struct cmd_tbl; #define BOOTM_ERR_OVERLAP (-2) #define BOOTM_ERR_UNIMPLEMENTED (-3) +/** + * enum bootm_final_t - flags to control bootm_final() + * + * @BOOTM_FINAL_FAKE: true to do everything except actually boot; it then + * returns to the caller + */ +enum bootm_final_t { + BOOTM_FINAL_FAKE = BIT(0), +}; + /** * struct bootm_info() - information used when processing images to boot * @@ -375,4 +385,11 @@ void zimage_dump(struct bootm_info *bmi, bool show_cmdline); */ int bootm_boot_start(ulong addr, const char *cmdline); +/** + * bootm_final() - Announce and do cleanup before boot + * + * @flags: Flags to control what this function does + */ +void bootm_final(enum bootm_final_t flags); + #endif -- 2.43.0