bootstd: Update bootmeth_alloc_file() to record images
As a first step to recording images and where they came from, update this function to do so, since it is used by two bootmeths Create a helper function in the bootflow system, since recorded images are always associated with bootflows. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -976,3 +976,24 @@ const char *bootflow_img_type_name(enum bootflow_img_t type)
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
struct bootflow_img *bootflow_img_add(struct bootflow *bflow, const char *fname,
|
||||
enum bootflow_img_t type, ulong addr,
|
||||
ulong size)
|
||||
{
|
||||
struct bootflow_img img, *ptr;
|
||||
|
||||
memset(&img, '\0', sizeof(struct bootflow_img));
|
||||
img.fname = strdup(fname);
|
||||
if (!img.fname)
|
||||
return NULL;
|
||||
|
||||
img.type = type;
|
||||
img.addr = addr;
|
||||
img.size = size;
|
||||
ptr = alist_add(&bflow->images, img);
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user