diff options
author | Simon Glass <sjg@chromium.org> | 2025-03-05 17:25:11 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-03-18 13:12:15 -0600 |
commit | ecd50bb4643c9052e5f8b6171ab6c3905ed0ca70 (patch) | |
tree | 1136f6906118e2ea376800ac08a566bbf440f2e8 /boot/image-board.c | |
parent | d6bb0ea535e4384ed1975ee9c755488f5036a79e (diff) |
boot: Support compressed booti images in bootm
A compressed booti image relies on the compression-format's header at
the start to indicate which compression algorithm is used.
We don't support this elsewhere in U-Boot, so assume that a compressed
file is always a booti file. Once it is compressed, a check is made to
make sure that it actually is.
Simplify the implementation by adding a new function which returns the
booti image-type if compression is detected.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/image-board.c')
-rw-r--r-- | boot/image-board.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/boot/image-board.c b/boot/image-board.c index 07931c64198..a2bafba7ae1 100644 --- a/boot/image-board.c +++ b/boot/image-board.c @@ -257,6 +257,17 @@ enum image_fmt_t genimg_get_format(const void *img_addr) return IMAGE_FORMAT_INVALID; } +enum image_fmt_t genimg_get_format_comp(const void *img_addr) +{ + enum image_fmt_t fmt = genimg_get_format(img_addr); + + if (IS_ENABLED(CONFIG_CMD_BOOTI) && fmt == IMAGE_FORMAT_INVALID && + image_decomp_type(img_addr, 2) != IH_COMP_NONE) + fmt = IMAGE_FORMAT_BOOTI; + + return fmt; +} + /** * fit_has_config - check if there is a valid FIT configuration * @images: pointer to the bootm command headers structure @@ -353,7 +364,7 @@ static int select_ramdisk(struct bootm_headers *images, const char *select, u8 a * check image type, for FIT images get FIT node. */ buf = map_sysmem(rd_addr, 0); - switch (genimg_get_format(buf)) { + switch (genimg_get_format_comp(buf)) { case IMAGE_FORMAT_LEGACY: if (CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)) { const struct legacy_img_hdr *rd_hdr; |