Record images loaded by this bootmeth.

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

Changes in v2:
- Update to use a new image-type enum in bootflow.h

 boot/bootmeth_cros.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/boot/bootmeth_cros.c b/boot/bootmeth_cros.c
index 1825293d93d..907e05b1d60 100644
--- a/boot/bootmeth_cros.c
+++ b/boot/bootmeth_cros.c
@@ -206,6 +206,7 @@ static int cros_read_buf(struct bootflow *bflow, void *buf, 
ulong size,
 {
        struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
        ulong base, setup, cmdline, kern_base;
+       struct bootflow_img img;
        ulong num_blks;
        int ret;
 
@@ -243,8 +244,27 @@ static int cros_read_buf(struct bootflow *bflow, void 
*buf, ulong size,
        ret = copy_cmdline(map_sysmem(cmdline, 0), uuid, &bflow->cmdline);
        if (ret)
                return log_msg_ret("cmd", ret);
+
+       img.fname = strdup("setup");
+       if (!img.fname)
+               return log_msg_ret("cri", -ENOMEM);
+       img.type = (enum bootflow_img_t)IH_TYPE_X86_SETUP;
+       img.addr = setup;
+       img.size = 0x3000;
+       if (!alist_add(&bflow->images, img))
+               return log_msg_ret("cri", -ENOMEM);
+
        bflow->x86_setup = map_sysmem(setup, 0);
 
+       img.fname = strdup("cmdline");
+       if (!img.fname)
+               return log_msg_ret("cri", -ENOMEM);
+       img.type = BFI_CMDLINE;
+       img.addr = cmdline;
+       img.size = 0x1000;
+       if (!alist_add(&bflow->images, img))
+               return log_msg_ret("cri", -ENOMEM);
+
        return 0;
 }
 
@@ -263,6 +283,7 @@ static int cros_read_info(struct bootflow *bflow, const 
char *uuid,
        struct udevice *blk = bflow->blk;
        struct blk_desc *desc = dev_get_uclass_plat(blk);
        ulong offset, size, before_base;
+       struct bootflow_img img;
        void *buf;
        int ret;
 
@@ -306,6 +327,15 @@ static int cros_read_info(struct bootflow *bflow, const 
char *uuid,
        }
        priv->info_buf = buf;
 
+       img.fname = strdup("kernel");
+       if (!img.fname)
+               return log_msg_ret("cri", -ENOMEM);
+       img.type = (enum bootflow_img_t)IH_TYPE_KERNEL;
+       img.addr = 0;
+       img.size = priv->body_size;
+       if (!alist_add(&bflow->images, img))
+               return log_msg_ret("cri", -ENOMEM);
+
        return 0;
 }
 
-- 
2.34.1

Reply via email to