]> Git Repo - J-u-boot.git/blame - cmd/zip.c
cmd: zip: automatically pull in gzip()
[J-u-boot.git] / cmd / zip.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
f2b96dfb
LW
2/*
3 * (C) Copyright 2012
4 * Lei Wen <[email protected]>, Marvell Inc.
f2b96dfb
LW
5 */
6
7#include <common.h>
8#include <command.h>
c7694dd4 9#include <env.h>
f2b96dfb 10
09140113 11static int do_zip(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
f2b96dfb
LW
12{
13 unsigned long src, dst;
14 unsigned long src_len, dst_len = ~0UL;
f2b96dfb
LW
15
16 switch (argc) {
17 case 5:
18 dst_len = simple_strtoul(argv[4], NULL, 16);
19 /* fall through */
20 case 4:
21 src = simple_strtoul(argv[1], NULL, 16);
22 src_len = simple_strtoul(argv[2], NULL, 16);
23 dst = simple_strtoul(argv[3], NULL, 16);
24 break;
25 default:
26 return cmd_usage(cmdtp);
27 }
28
29 if (gzip((void *) dst, &dst_len, (void *) src, src_len) != 0)
30 return 1;
31
d6670909 32 printf("Compressed size: %lu = 0x%lX\n", dst_len, dst_len);
018f5303 33 env_set_hex("filesize", dst_len);
f2b96dfb
LW
34
35 return 0;
36}
37
38U_BOOT_CMD(
39 zip, 5, 1, do_zip,
40 "zip a memory region",
41 "srcaddr srcsize dstaddr [dstsize]"
42);
This page took 0.361486 seconds and 4 git commands to generate.