1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2013 Patrice Bouchand <pbfwdlist_gmail_com>
4 * lzma uncompress command in Uboot
6 * made from existing cmd_unzip.c file of Uboot
9 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
17 #include <lzma/LzmaTools.h>
19 static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
21 unsigned long src, dst;
22 SizeT src_len = ~0UL, dst_len = ~0UL;
27 dst_len = simple_strtoul(argv[3], NULL, 16);
30 src = simple_strtoul(argv[1], NULL, 16);
31 dst = simple_strtoul(argv[2], NULL, 16);
37 ret = lzmaBuffToBuffDecompress(map_sysmem(dst, dst_len), &src_len,
38 map_sysmem(src, 0), dst_len);
42 printf("Uncompressed size: %ld = %#lX\n", (ulong)src_len,
44 env_set_hex("filesize", src_len);
50 lzmadec, 4, 1, do_lzmadec,
51 "lzma uncompress a memory region",
52 "srcaddr dstaddr [dstsize]"