Skip to contentSkip to conversation

gunzip error when uncompress to buf

DISCUSSION 张忠山 2 participants 4 messages Nov 30, 2012 – Dec 1, 2012

lore
Share & tools
lore

张忠山

author
#0 lore raw

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!

Signature · 9 lines
Best Regards,
zzs



_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
author
#2 lore raw
Quoted 7 lines · In message <[email protected]> Jean-Christophe…
Quoted 4 lines · 张忠山

On host use the flowwing cmd build a gziped file

----------------

$ gzip -c9 zbarebox.bin > xxx

this is a binary with a decompressor insode you just need to flash it

I known zbarebox.bin is a compressed image. I just use this file to test uncompress_fd_to_buf.

I will compress my fpga firmware and flash it, So I need to uncompress this image to a buf, then use it to config fpga

But uncompress_fd_to_buf works wrong!

Signature · 9 lines
Best Regards,
zzs



_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
Quoted 9 lines · 张忠山
Quoted 7 lines · In message <[email protected]> Jean-Christophe…
Quoted 4 lines · 张忠山

On host use the flowwing cmd build a gziped file

----------------

$ gzip -c9 zbarebox.bin > xxx

this is a binary with a decompressor insode you just need to flash it

Quoted 7 lines

I known zbarebox.bin is a compressed image. I just use this file to test uncompress_fd_to_buf.

I will compress my fpga firmware and flash it, So I need to uncompress this image to a buf, then use it to config fpga

But uncompress_fd_to_buf works wrong!

so debug it

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox