summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-12-15 20:14:14 -0700
committerTom Rini <trini@konsulko.com>2023-12-21 16:07:52 -0500
commitc2211ff65136c39d8d2aefa76803b5da737daf8c (patch)
treeb30e8a31d60675ae82bdfc2bec5592dc146d2289
parenta48336e5ea19ca0d32dfff1c4eaeececa8d2f570 (diff)
downloadu-boot-c2211ff65136c39d8d2aefa76803b5da737daf8c.tar.gz
u-boot-c2211ff65136c39d8d2aefa76803b5da737daf8c.tar.bz2
u-boot-c2211ff65136c39d8d2aefa76803b5da737daf8c.zip
bootm: Add more fields to bootm_info
Add fields for the three bootm parameters and other things needed for booting. Also add a helper to set up the struct correctly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r--boot/bootm.c8
-rw-r--r--include/bootm.h35
2 files changed, 43 insertions, 0 deletions
diff --git a/boot/bootm.c b/boot/bootm.c
index f1c45c3806..9e42fa5117 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -1192,6 +1192,14 @@ int bootm_boot_start(ulong addr, const char *cmdline)
return ret;
}
+void bootm_init(struct bootm_info *bmi)
+{
+ memset(bmi, '\0', sizeof(struct bootm_info));
+ bmi->boot_progress = true;
+ if (IS_ENABLED(CONFIG_CMD_BOOTM))
+ bmi->images = &images;
+}
+
/**
* switch_to_non_secure_mode() - switch to non-secure mode
*
diff --git a/include/bootm.h b/include/bootm.h
index 85c560d5a0..7cfaa0a7d0 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -19,17 +19,52 @@ struct cmd_tbl;
/**
* struct bootm_info() - information used when processing images to boot
*
+ * These mirror the first three arguments of the bootm command. They are
+ * designed to handle any type of image, but typically it is a FIT.
+ *
+ * @addr_img: Address of image to bootm, as passed to
+ * genimg_get_kernel_addr_fit() for processing:
+ *
+ * NULL: Usees default load address, i.e. image_load_addr
+ * <addr>: Uses hex address
+ *
+ * For FIT:
+ * "[<addr>]#<conf>": Uses address (or image_load_addr) and also specifies
+ * the FIT configuration to use
+ * "[<addr>]:<subimage>": Uses address (or image_load_addr) and also
+ * specifies the subimage name containing the OS
+ *
+ * @conf_ramdisk: Address (or with FIT, the name) of the ramdisk image, as
+ * passed to boot_get_ramdisk() for processing, or NULL for none
+ * @conf_fdt: Address (or with FIT, the name) of the FDT image, as passed to
+ * boot_get_fdt() for processing, or NULL for none
+ * @boot_progress: true to show boot progress
* @images: images information
+ * @cmd_name: command which invoked this operation, e.g. "bootm"
* @argc: Number of arguments to the command (excluding the actual command).
* This is 0 if there are no arguments
* @argv: NULL-terminated list of arguments, or NULL if there are no arguments
*/
struct bootm_info {
+ const char *addr_img;
+ const char *conf_ramdisk;
+ const char *conf_fdt;
+ bool boot_progress;
struct bootm_headers *images;
+ const char *cmd_name;
int argc;
char *const *argv;
};
+/**
+ * bootm_init() - Set up a bootm_info struct with useful defaults
+ *
+ * Set up the struct with default values for all members:
+ * @boot_progress is set to true and @images is set to the global images
+ * variable. Everything else is set to NULL except @argc which is 0
+ */
+void bootm_init(struct bootm_info *bmi);
+
/*
* Continue booting an OS image; caller already has:
* - copied image header to global variable `header'