diff options
| author | Tom Rini <[email protected]> | 2022-03-31 14:12:30 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2022-03-31 14:12:30 -0400 |
| commit | 52d8100b1d60b656e3e311e3312fed43d388088a (patch) | |
| tree | cb370025bcc386ef741cce94bda1b4dd58fe2d76 /common | |
| parent | 23e354f82c04a1c070ca59907abc6b042761b0e7 (diff) | |
| parent | 7bebc11c42351c8f0364f0e3eb922f5af7b6e826 (diff) | |
Merge branch '2022-03-31-image-add-a-stage-pre-load' into next
To quote the author:
This series adds a stage pre-load before launching an image. This stage
is used to read a header before the image and this header contains the
signature of the full image. So u-boot may check the full image before
using any data of the image.
The support of this header is added to binman, and a command verify
checks the signature of a blob and set the u-boot env variable
"loadaddr_verified" to the beginning of the "real" image.
The support of this header is only added to binman, but it may also be
added to mkimage.
Diffstat (limited to 'common')
| -rw-r--r-- | common/spl/spl_ram.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c index 3f7f7accc11..82964592571 100644 --- a/common/spl/spl_ram.c +++ b/common/spl/spl_ram.c @@ -24,9 +24,17 @@ static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector, ulong count, void *buf) { + ulong addr; + debug("%s: sector %lx, count %lx, buf %lx\n", __func__, sector, count, (ulong)buf); - memcpy(buf, (void *)(CONFIG_SPL_LOAD_FIT_ADDRESS + sector), count); + + addr = (ulong)CONFIG_SPL_LOAD_FIT_ADDRESS + sector; + if (CONFIG_IS_ENABLED(IMAGE_PRE_LOAD)) + addr += image_load_offset; + + memcpy(buf, (void *)addr, count); + return count; } @@ -37,6 +45,17 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADDRESS; + if (CONFIG_IS_ENABLED(IMAGE_PRE_LOAD)) { + unsigned long addr = (unsigned long)header; + int ret = image_pre_load(addr); + + if (ret) + return ret; + + addr += image_load_offset; + header = (struct image_header *)addr; + } + #if CONFIG_IS_ENABLED(DFU) if (bootdev->boot_device == BOOT_DEVICE_DFU) spl_dfu_cmd(0, "dfu_alt_info_ram", "ram", "0"); |
