diff options
author | Sean Anderson <sean.anderson@seco.com> | 2023-07-31 18:42:55 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-02 12:46:04 -0400 |
commit | 569bdc173ac4fc404df37fe77e5dc2ac788c9d55 (patch) | |
tree | be45b9f9ae79ff256a817b5c42470acc7665ef48 | |
parent | 80589488a364584b6573c47ba1c859e302b000bf (diff) | |
download | u-boot-569bdc173ac4fc404df37fe77e5dc2ac788c9d55.zip u-boot-569bdc173ac4fc404df37fe77e5dc2ac788c9d55.tar.gz u-boot-569bdc173ac4fc404df37fe77e5dc2ac788c9d55.tar.bz2 |
spl: Convert ext to use spl_load
This converts the ext load method to use spl_load. As a consequence, it
also adds support for FIT and IMX images.
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
-rw-r--r-- | common/spl/spl_ext.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c index 2bf3434..2c39799 100644 --- a/common/spl/spl_ext.c +++ b/common/spl/spl_ext.c @@ -9,17 +9,30 @@ #include <errno.h> #include <image.h> +static ulong spl_fit_read(struct spl_load_info *load, ulong file_offset, + ulong size, void *buf) +{ + int ret; + loff_t actlen; + + ret = ext4fs_read(buf, file_offset, size, &actlen); + if (ret) + return ret; + return actlen; +} + int spl_load_image_ext(struct spl_image_info *spl_image, struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition, const char *filename) { s32 err; - struct legacy_img_hdr *header; - loff_t filelen, actlen; + loff_t filelen; struct disk_partition part_info = {}; - - header = spl_get_load_buffer(-sizeof(*header), sizeof(*header)); + struct spl_load_info load = { + .read = spl_fit_read, + .bl_len = 1, + }; if (part_get_info(block_dev, partition, &part_info)) { printf("spl: no partition table found\n"); @@ -41,19 +54,8 @@ int spl_load_image_ext(struct spl_image_info *spl_image, puts("spl: ext4fs_open failed\n"); goto end; } - err = ext4fs_read((char *)header, 0, sizeof(struct legacy_img_hdr), &actlen); - if (err < 0) { - puts("spl: ext4fs_read failed\n"); - goto end; - } - - err = spl_parse_image_header(spl_image, bootdev, header); - if (err < 0) { - puts("spl: ext: failed to parse image header\n"); - goto end; - } - err = ext4fs_read((char *)spl_image->load_addr, 0, filelen, &actlen); + err = spl_load(spl_image, bootdev, &load, filelen, 0); end: #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT |