[U-Boot] [PATCH 2/2] Add unlzo command

Mike Frysinger vapier at gentoo.org
Sat Aug 18 01:26:23 CEST 2012


On Friday 17 August 2012 16:59:44 Joe Hershberger wrote:
> --- a/common/Makefile
> +++ b/common/Makefile
>
>  ifdef CONFIG_LZMA
>  COBJS-$(CONFIG_CMD_UNLZMA) += cmd_unlzma.o
>  endif
> +ifdef CONFIG_LZO
> +COBJS-$(CONFIG_CMD_UNLZO) += cmd_unlzo.o
> +endif

imo, these ifdefs shouldn't exist.  the commands shouldn't get silently 
ignored because someone omitted an option.  add an #ifdef check to the .c file 
and have it #error out if the necessary config options aren't defined.

> --- /dev/null
> +++ b/common/cmd_unlzo.c
>
> +int do_unlzo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

static

> +	ret = lzop_decompress((void *)src, src_len, (void *)dst, &dst_len);
> +	if (ret != LZO_E_OK) {
> +		printf("unlzo: uncompress or overwrite error %d\n", ret);
> +		return -1;

how about returning ret ?

> +	sprintf(buf, "%lX", (unsigned long) dst_len);
> +	setenv("filesize", buf);

setenv_ulong() ?

> +U_BOOT_CMD(
> +	unlzo,	5,	1,	do_unlzo,
> +	"unlzo a memory region",
> +	"srcaddr srcsize dstaddr [dstsize]"
> +);

isn't there a way you could "stream" this so you don't need the srcsize ?  or 
does the lzop API not support that ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120817/e71f188e/attachment.pgp>


More information about the U-Boot mailing list