diff mbox series

[v3,21/22] bootm: Create a function to run through the booti states

Message ID 20231215201413.v3.21.I95fe77f4a7f3d6c3dba3ecb3aec30a48739198f9@changeid
State Accepted
Commit e7683c3675ce425e2f8149dedcaafa02175321ef
Delegated to: Tom Rini
Headers show
Series Complete decoupling of bootm logic from commands | expand

Commit Message

Simon Glass Dec. 16, 2023, 3:14 a.m. UTC
In a few places, the booti command is used to handle a boot. We want
these to be done without needing CONFIG_CMDLINE, so add a new
booti_run() function to handle this.

So far this is not used.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v2)

Changes in v2:
- Rework series to allow OS access to cmdline arguments for bootm

 boot/bootm.c    | 13 +++++++++++++
 include/bootm.h | 13 +++++++++++++
 2 files changed, 26 insertions(+)

Comments

Tom Rini Dec. 16, 2023, 5:13 p.m. UTC | #1
On Fri, Dec 15, 2023 at 08:14:25PM -0700, Simon Glass wrote:

> In a few places, the booti command is used to handle a boot. We want
> these to be done without needing CONFIG_CMDLINE, so add a new
> booti_run() function to handle this.
> 
> So far this is not used.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox series

Patch

diff --git a/boot/bootm.c b/boot/bootm.c
index 40751a4c6e6f..53236136f489 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -1153,6 +1153,19 @@  int bootz_run(struct bootm_info *bmi)
 	return bootm_run_states(bmi, states);
 }
 
+int booti_run(struct bootm_info *bmi)
+{
+	int states;
+
+	bmi->cmd_name = "booti";
+	states = BOOTM_STATE_MEASURE | BOOTM_STATE_OS_PREP |
+		BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO;
+	if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
+		states |= BOOTM_STATE_RAMDISK;
+
+	return bootm_run_states(bmi, states);
+}
+
 int bootm_boot_start(ulong addr, const char *cmdline)
 {
 	char addr_str[30];
diff --git a/include/bootm.h b/include/bootm.h
index f7d6d27ecb0a..eba35b33b4e5 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -176,6 +176,19 @@  int bootm_run(struct bootm_info *bmi);
  */
 int bootz_run(struct bootm_info *bmi);
 
+/**
+ * booti_run() - Run the entire booti process
+ *
+ * This runs through the booti process from start to finish, using the default
+ * set of states.
+ *
+ * This uses bootm_run_states().
+ *
+ * @bmi: bootm information
+ * Return: 0 if ok, something else on error
+ */
+int booti_run(struct bootm_info *bmi);
+
 void arch_preboot_os(void);
 
 /*