[PATCH v2 8/9] riscv: Call bootm_final()

Simon Glass sjg at chromium.org
Tue Feb 24 15:25:50 CET 2026


Make use of this function, adding some pieces needed by RISC-V

Signed-off-by: Simon Glass <simon.glass at canonical.com>
---

Changes in v2:
- Drop the EFI_LOADER change

 arch/riscv/lib/bootm.c | 18 +-----------------
 boot/bootm_final.c     |  9 ++++++++-
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
index c6a008a4559..bd47275b52e 100644
--- a/arch/riscv/lib/bootm.c
+++ b/arch/riscv/lib/bootm.c
@@ -32,23 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 static void announce_and_cleanup(int fake)
 {
-	printf("\nStarting kernel ...%s\n\n", fake ?
-		"(fake run for tracing)" : "");
-	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
-#ifdef CONFIG_BOOTSTAGE_FDT
-	bootstage_fdt_add_report();
-#endif
-#if CONFIG_IS_ENABLED(BOOTSTAGE_REPORT)
-	bootstage_report();
-#endif
-
-	/*
-	 * 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();
-
+	bootm_final(fake);
 	cleanup_before_linux();
 }
 
diff --git a/boot/bootm_final.c b/boot/bootm_final.c
index 7077702d8c7..7f069877d06 100644
--- a/boot/bootm_final.c
+++ b/boot/bootm_final.c
@@ -7,17 +7,24 @@
 
 #include <bootm.h>
 #include <bootstage.h>
+#include <usb.h>
 #include <dm/root.h>
 
 void bootm_final(enum bootm_final_t flags)
 {
-	printf("\nStarting kernel ...\n\n");
+	printf("\nStarting kernel ...%s\n\n", flags & BOOTM_FINAL_FAKE ?
+		"(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();
 
+	if (IS_ENABLED(CONFIG_USB_DEVICE))
+		udc_disconnect();
+
 	/*
 	 * Call remove function of all devices with a removal flag set.
 	 * This may be useful for last-stage operations, like cancelling
-- 
2.43.0



More information about the U-Boot mailing list