diff options
| author | Simon Glass <[email protected]> | 2026-03-05 19:36:13 -0700 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-03-18 13:17:34 -0600 |
| commit | 1ec3ee670de6b2f8f96cd7c15f7e22e89a06bb2d (patch) | |
| tree | 7b2f60d5b3daa8fce368e12a56b1ebe35c12ea2d /boot | |
| parent | 5cc969caf0ba247d8464af1fd87110e73309e37d (diff) | |
bootm: Create bootm_final() for pre-boot cleanup
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 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 bootm_final() function with the common pre-boot steps:
printing the "Starting kernel" message, recording bootstage data,
optionally writing bootstage to the FDT and printing a report, and
removing active devices.
Be careful to avoid using BIT() macros which are not available with host
tools.
Signed-off-by: Simon Glass <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
Diffstat (limited to 'boot')
| -rw-r--r-- | boot/bootm.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/boot/bootm.c b/boot/bootm.c index 4bdca22ea8c..cba10b5dce7 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -7,6 +7,7 @@ #ifndef USE_HOSTCC #include <bootm.h> #include <bootstage.h> +#include <dm/root.h> #include <cli.h> #include <command.h> #include <cpu_func.h> @@ -1194,6 +1195,27 @@ void __weak switch_to_non_secure_mode(void) { } +void bootm_final(int flag) +{ + printf("\nStarting kernel ...%s\n\n", + (flag & BOOTM_STATE_OS_FAKE_GO) ? + " (fake run for tracing)" : ""); + + bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel"); + + if (IS_ENABLED(CONFIG_BOOTSTAGE_FDT) && IS_ENABLED(CONFIG_CMD_FDT)) + bootstage_fdt_add_report(); + if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT)) + bootstage_report(); + + /* + * Call remove function of all devices with a removal flag set. + * This may be useful for last-stage operations, like cancelling + * of DMA operation or releasing device internal buffers. + */ + dm_remove_devices_active(); +} + #else /* USE_HOSTCC */ #if defined(CONFIG_FIT_SIGNATURE) |
