mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* gunzip error when uncompress to buf
@ 2012-11-30 11:00 张忠山
  2012-11-30 11:38 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 4+ messages in thread
From: 张忠山 @ 2012-11-30 11:00 UTC (permalink / raw)
  To: barebox

On host use the flowwing cmd build a gziped file

----------------
$ gzip -c9 zbarebox.bin > xxx

$ ls zbarebox.bin xxx -l
-rw-rw-r-- 1 zzs zzs 127605 2012-11-30 17:46 xxx
-rwxrwxr-x 1 zzs zzs 136769 2012-11-30 18:44 zbarebox.bin*
----------------

Then on barebox write it to /dev/nor0.kernel

----------------
[barebox@SSR600]:/
# tftp xxx /dev/nor0.kernel
----------------


And add a barebox cmd to uncompress it:

----------------
char ptr[SZ_512K];
static int do_tx(int argc, char *argv[])
{
	int ret = 0, size = 0, fd, fd1;

	fd = open("/dev/tempmem", O_RDWR);
	if(fd < 0)
		printf("error open tempmem\n");
	fd1 = open("/dev/nor0.kernel", O_RDONLY);
	if(fd1 < 0)
		printf("error open kernel\n");
	ret = uncompress_fd_to_fd (fd1, fd, uncompress_err_stdout);
	printf("ret is %d\n", ret);

	close(fd1);
	fd1 = open("/dev/nor0.kernel", O_RDONLY);
	if(fd1 < 0)
		printf("error open kernel\n");
	ret = uncompress_fd_to_buf(fd1, ptr, uncompress_err_stdout);
	printf("ret is %d\n", ret);

	return 0;
}

BAREBOX_CMD_START(tx)
	.cmd		= do_tx,
BAREBOX_CMD_END
----------------

Compile barebox, download to board and run this command

----------------
[barebox@SSR600]:/
# tx
ret is 0
uncompression error
ret is -1
----------------

The result is:

uncompress_fd_to_fd is OK
uncompress_fd_to_buf fail and lib/decompress_inflate.c:gunzip()
output a message "uncompression error"

Anybody help me!

-- 
Best Regards,
zzs



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-01 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30 11:00 gunzip error when uncompress to buf 张忠山
2012-11-30 11:38 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-30 11:49   ` 张忠山
2012-12-01 14:06     ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox