]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
qfw: store loaded file size in environment variable
authorAndre Przywara <andre.przywara@arm.com>
Mon, 10 Oct 2022 17:01:20 +0000 (18:01 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 21 Oct 2022 20:06:13 +0000 (16:06 -0400)
At the moment the QEMU firmware command just prints the size of the
loaded binaries on the console.
To go with all the other load methods, and many boot scripts'
expectations, also store the size of the file loaded last in the
environment variable "filesize".
We first put the kernel size in there, but overwrite this with the
initrd size, should we have one, because this is probably the more
prominent user of $filesize (in the booti or bootz command).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
cmd/qfw.c

index ccbc967ca9f698b37a98c8557ba09c2199d2296f..c61001b771dc8566c3ce1a8d471b8004d3334f22 100644 (file)
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -40,6 +40,7 @@ static int qemu_fwcfg_cmd_setup_kernel(void *load_addr, void *initrd_addr)
        qfw_read_entry(qfw_dev, FW_CFG_KERNEL_DATA,
                       le32_to_cpu(kernel_size), data_addr);
        data_addr += le32_to_cpu(kernel_size);
+       env_set_hex("filesize", le32_to_cpu(kernel_size));
 
        data_addr = initrd_addr;
        qfw_read_entry(qfw_dev, FW_CFG_INITRD_SIZE, 4, &initrd_size);
@@ -49,6 +50,7 @@ static int qemu_fwcfg_cmd_setup_kernel(void *load_addr, void *initrd_addr)
                qfw_read_entry(qfw_dev, FW_CFG_INITRD_DATA,
                               le32_to_cpu(initrd_size), data_addr);
                data_addr += le32_to_cpu(initrd_size);
+               env_set_hex("filesize", le32_to_cpu(initrd_size));
        }
 
        qfw_read_entry(qfw_dev, FW_CFG_CMDLINE_SIZE, 4, &cmdline_size);