diff --git a/cmd/ximg.c b/cmd/ximg.c index 1467484df8d..c79e8a07860 100644 --- a/cmd/ximg.c +++ b/cmd/ximg.c @@ -15,6 +15,9 @@ #include #include #include +#if IS_ENABLED(CONFIG_ZSTD) +#include +#endif #include #include #include @@ -237,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;