Am 24.02.26 um 15:25 schrieb Simon Glass:
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

change "the a" to "a"

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. Be careful to
avoid using BIT() macros which are not available with host tools.

Signed-off-by: Simon Glass <[email protected]>
---

(no changes since v1)

  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 f8d4f6ee8b2..beebb491f28 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -983,6 +983,7 @@ M:  Simon Glass <[email protected]>
  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 7fb56e7ef37..12477fabe28 100644
--- a/boot/Makefile
+++ b/boot/Makefile
@@ -15,7 +15,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 <[email protected]>
+ */
+
+#include <bootm.h>
+
+void bootm_final(enum bootm_final_t flags)
+{
+}
diff --git a/include/bootm.h b/include/bootm.h
index 4060cec7fc0..32711eabb2e 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        = 1 << 0,
+};
+
  /**
   * struct bootm_info() - information used when processing images to boot
   *
@@ -321,4 +331,11 @@ void zimage_dump(struct boot_params *base_ptr, 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

--
Best regards,
Max

TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/

Reply via email to