All of lore.kernel.org
 help / color / mirror / Atom feed
From: 张忠山 <zzs213@126.com>
To: barebox <barebox@lists.infradead.org>
Subject: gunzip error when uncompress to buf
Date: Fri, 30 Nov 2012 19:00:29 +0800	[thread overview]
Message-ID: <20121130110029.GA7099@greatfirst.com> (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!

-- 
Best Regards,
zzs



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

             reply	other threads:[~2012-11-30 11:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-30 11:00 张忠山 [this message]
2012-11-30 11:38 ` gunzip error when uncompress to buf Jean-Christophe PLAGNIOL-VILLARD
2012-11-30 11:49   ` 张忠山
2012-12-01 14:06     ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121130110029.GA7099@greatfirst.com \
    --to=zzs213@126.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.