diff options
author | Tom Rini <trini@konsulko.com> | 2024-07-01 13:17:56 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-07-01 15:00:56 -0600 |
commit | 65fbdab27224ee3943a89496b21862db83c34da2 (patch) | |
tree | 775a0a54066c2e9a6bbba201676e3d896b5cb0e2 /cmd/ximg.c | |
parent | 3f772959501c99fbe5aa0b22a36efe3478d1ae1c (diff) | |
parent | b4cbd1a257d4027038b4f997d73bdb0a066db045 (diff) |
Merge branch 'next'
Diffstat (limited to 'cmd/ximg.c')
-rw-r--r-- | cmd/ximg.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/cmd/ximg.c b/cmd/ximg.c index 0e7eead8d19..c79e8a07860 100644 --- a/cmd/ximg.c +++ b/cmd/ximg.c @@ -11,11 +11,13 @@ /* * Multi Image extract */ -#include <common.h> #include <command.h> #include <cpu_func.h> #include <env.h> #include <gzip.h> +#if IS_ENABLED(CONFIG_ZSTD) +#include <linux/zstd.h> +#endif #include <image.h> #include <malloc.h> #include <mapmem.h> @@ -238,6 +240,26 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } break; #endif /* CONFIG_BZIP2 */ +#if IS_ENABLED(CONFIG_ZSTD) + case IH_COMP_ZSTD: + { + int ret; + struct abuf in, out; + + printf(" Uncompressing part %d ... ", part); + + abuf_init_set(&in, (void *)data, len); + abuf_init_set(&out, (void *)dest, unc_len); + ret = zstd_decompress(&in, &out); + if (ret < 0) { + printf("ZSTD ERROR %d - " + "image not loaded\n", ret); + return 1; + } + len = ret; + } + break; +#endif default: printf("Unimplemented compression type %d\n", comp); return 1; |