summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2024-11-15 16:19:13 -0700
committerTom Rini <[email protected]>2025-01-15 08:48:42 -0600
commit8a6bf2fb31b6a02227818e679d567ae012494467 (patch)
treee56c0eda2726950e78a93779287a340a79231f83 /boot
parent49867e804543f64ca216653c3905d8022c31fc84 (diff)
bootstd: Maintain a list of images
We want to keep track of images which are loaded, or those which could perhaps be loaded. This will make it easier to manage memory allocation, as well as permit removal of the EFI set_efi_bootdev() feature. Add a list of these, attached to the bootflow. For now the list is empty. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'boot')
-rw-r--r--boot/bootflow.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/boot/bootflow.c b/boot/bootflow.c
index 7ce04fd92cd..94f34dcad0f 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -23,6 +23,13 @@ enum {
BF_NO_MORE_DEVICES = -ENODEV,
};
+static const char *const bootflow_img[BFI_COUNT - BFI_FIRST] = {
+ "extlinux_cfg",
+ "logo",
+ "efi",
+ "cmdline",
+};
+
/**
* bootflow_state - name for each state
*
@@ -455,10 +462,13 @@ void bootflow_init(struct bootflow *bflow, struct udevice *bootdev,
bflow->dev = bootdev;
bflow->method = meth;
bflow->state = BOOTFLOWST_BASE;
+ alist_init_struct(&bflow->images, struct bootflow_img);
}
void bootflow_free(struct bootflow *bflow)
{
+ struct bootflow_img *img;
+
free(bflow->name);
free(bflow->subdir);
free(bflow->fname);
@@ -467,6 +477,10 @@ void bootflow_free(struct bootflow *bflow)
free(bflow->os_name);
free(bflow->fdt_fname);
free(bflow->bootmeth_priv);
+
+ alist_for_each(img, &bflow->images)
+ free(img->fname);
+ alist_empty(&bflow->images);
}
void bootflow_remove(struct bootflow *bflow)
@@ -950,3 +964,15 @@ int bootflow_cmdline_auto(struct bootflow *bflow, const char *arg)
return 0;
}
+
+const char *bootflow_img_type_name(enum bootflow_img_t type)
+{
+ const char *name;
+
+ if (type >= BFI_FIRST && type < BFI_COUNT)
+ name = bootflow_img[type - BFI_FIRST];
+ else
+ name = genimg_get_type_short_name(type);
+
+ return name;
+}