]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
bootm: Create a function to run through the bootz states
authorSimon Glass <sjg@chromium.org>
Sat, 16 Dec 2023 03:14:23 +0000 (20:14 -0700)
committerTom Rini <trini@konsulko.com>
Thu, 21 Dec 2023 21:07:52 +0000 (16:07 -0500)
In a few places, the bootz command is used to handle a boot. We want
these to be done without needing CONFIG_CMDLINE, so add a new
bootz_run() function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
boot/bootm.c
cmd/bootz.c
include/bootm.h

index cce8485f2d47d49a3361f595af79f6de787e3b93..40751a4c6e6f389012e25afc84d22fa0bb50ab12 100644 (file)
@@ -1140,6 +1140,19 @@ int bootm_run(struct bootm_info *bmi)
        return bootm_run_states(bmi, states);
 }
 
+int bootz_run(struct bootm_info *bmi)
+{
+       int states;
+
+       bmi->cmd_name = "bootz";
+       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];
index 05b15eb4d761081db00bfb9be686e64a0ecfb2b5..b6bb4aae72d4468e886ce1f544605dc82a50058d 100644 (file)
@@ -74,7 +74,7 @@ static int bootz_start(struct cmd_tbl *cmdtp, int flag, int argc,
 int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        struct bootm_info bmi;
-       int states, ret;
+       int ret;
 
        /* Consume 'bootz' */
        argc--; argv++;
@@ -99,12 +99,7 @@ int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
                bmi.conf_fdt = argv[2];
        bmi.cmd_name = "bootz";
 
-       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;
-
-       ret = bootm_run_states(&bmi, states);
+       ret = bootz_run(&bmi);
 
        return ret;
 }
index 6e6b2ad8f7ef200a04b60354311b1220103e1d73..f7d6d27ecb0a2ad075ba02019053c303b26fda54 100644 (file)
@@ -163,6 +163,19 @@ int bootm_run_states(struct bootm_info *bmi, int states);
  */
 int bootm_run(struct bootm_info *bmi);
 
+/**
+ * bootz_run() - Run the entire bootz process
+ *
+ * This runs through the bootz 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 bootz_run(struct bootm_info *bmi);
+
 void arch_preboot_os(void);
 
 /*