mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-24 04:34:22 +08:00
0914011310
We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
47 lines
1.0 KiB
C
47 lines
1.0 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2020
|
|
* FUJITSU COMPUTERTECHNOLOGIES LIMITED. All rights reserved.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <command.h>
|
|
#include <env.h>
|
|
#include <lz4.h>
|
|
|
|
static int do_unlz4(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
char *const argv[])
|
|
{
|
|
unsigned long src, dst;
|
|
size_t src_len = ~0UL, dst_len = ~0UL;
|
|
int ret;
|
|
|
|
switch (argc) {
|
|
case 4:
|
|
src = simple_strtoul(argv[1], NULL, 16);
|
|
dst = simple_strtoul(argv[2], NULL, 16);
|
|
dst_len = simple_strtoul(argv[3], NULL, 16);
|
|
break;
|
|
default:
|
|
return CMD_RET_USAGE;
|
|
}
|
|
|
|
ret = ulz4fn((void *)src, src_len, (void *)dst, &dst_len);
|
|
if (ret) {
|
|
printf("Uncompressed err :%d\n", ret);
|
|
return 1;
|
|
}
|
|
|
|
printf("Uncompressed size: %zd = 0x%zX\n", dst_len, dst_len);
|
|
env_set_hex("filesize", dst_len);
|
|
|
|
return 0;
|
|
}
|
|
|
|
U_BOOT_CMD(unlz4, 4, 1, do_unlz4,
|
|
"lz4 uncompress a memory region",
|
|
"srcaddr dstaddr dstsize\n"
|
|
"NOTE: Specify the destination size that is sufficiently larger\n"
|
|
" than the source size.\n"
|
|
);
|