mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Howto known uncompressed length when uncompress_fd_to_buf
@ 2012-11-30 11:03 张忠山
  2012-12-03  9:55 ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: 张忠山 @ 2012-11-30 11:03 UTC (permalink / raw)
  To: barebox

the function uncompress_fd_to_buf has no parameter to return
the uncompressed length, How to get the uncompressed content
length?

-- 
Best Regards,
zzs



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

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

* Re: Howto known uncompressed length when uncompress_fd_to_buf
  2012-11-30 11:03 Howto known uncompressed length when uncompress_fd_to_buf 张忠山
@ 2012-12-03  9:55 ` Sascha Hauer
  2012-12-04  1:42   ` 张忠山
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2012-12-03  9:55 UTC (permalink / raw)
  To: barebox

On Fri, Nov 30, 2012 at 07:03:36PM +0800, 张忠山 wrote:
> the function uncompress_fd_to_buf has no parameter to return
> the uncompressed length, How to get the uncompressed content
> length?

AFAIK the uncompressed size is not contained in the compressed data 
You would have to uncompress to a file and use this afterwards.
If I understand correctly you want to load a FPGA firmware which you
have in compressed form. What I would do is:

- uncompress the firmware in a script rather than uncompress it from
  C code.
- write a command to flash the firmware.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: Howto known uncompressed length when uncompress_fd_to_buf
  2012-12-03  9:55 ` Sascha Hauer
@ 2012-12-04  1:42   ` 张忠山
  2012-12-04  7:44     ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: 张忠山 @ 2012-12-04  1:42 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

In message <20121203095534.GL10369@pengutronix.de> Sascha Hauer wrote:
> On Fri, Nov 30, 2012 at 07:03:36PM +0800, 张忠山 wrote:
> > the function uncompress_fd_to_buf has no parameter to return
> > the uncompressed length, How to get the uncompressed content
> > length?
>
> AFAIK the uncompressed size is not contained in the compressed data
> You would have to uncompress to a file and use this afterwards.
> If I understand correctly you want to load a FPGA firmware which you
> have in compressed form. What I would do is:
>
> - uncompress the firmware in a script rather than uncompress it from
>   C code.
> - write a command to flash the firmware.
>
But if uncompress it to a device file, like /dev/tmpmem. the file size
is the device size, not the uncompressed size.

So now I uncompressed it to a file in C code using uncompress_fd_to_fd,
then use lseek to get the current position of target file. That is the
uncompressed size.

-- 
Best Regards,
zzs



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

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

* Re: Howto known uncompressed length when uncompress_fd_to_buf
  2012-12-04  1:42   ` 张忠山
@ 2012-12-04  7:44     ` Sascha Hauer
  2012-12-04  8:09       ` 张忠山
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2012-12-04  7:44 UTC (permalink / raw)
  To: barebox

On Tue, Dec 04, 2012 at 09:42:42AM +0800, 张忠山 wrote:
> In message <20121203095534.GL10369@pengutronix.de> Sascha Hauer wrote:
> > On Fri, Nov 30, 2012 at 07:03:36PM +0800, 张忠山 wrote:
> > > the function uncompress_fd_to_buf has no parameter to return
> > > the uncompressed length, How to get the uncompressed content
> > > length?
> >
> > AFAIK the uncompressed size is not contained in the compressed data
> > You would have to uncompress to a file and use this afterwards.
> > If I understand correctly you want to load a FPGA firmware which you
> > have in compressed form. What I would do is:
> >
> > - uncompress the firmware in a script rather than uncompress it from
> >   C code.
> > - write a command to flash the firmware.
> >
> But if uncompress it to a device file, like /dev/tmpmem. the file size
> is the device size, not the uncompressed size.
> 
> So now I uncompressed it to a file in C code using uncompress_fd_to_fd,
> then use lseek to get the current position of target file. That is the
> uncompressed size.

Why don't you uncompress to a regular file (i.e. /tmp/foo) rather than
to the device file?

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: Howto known uncompressed length when uncompress_fd_to_buf
  2012-12-04  7:44     ` Sascha Hauer
@ 2012-12-04  8:09       ` 张忠山
  2012-12-04 23:13         ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: 张忠山 @ 2012-12-04  8:09 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

> Why don't you uncompress to a regular file (i.e. /tmp/foo) rather than
> to the device file?
>
My fireware will be a huge file: about 12M bytes. I don't known How much
a regular file's size.

-- 
Best Regards,
zzs



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

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

* Re: Howto known uncompressed length when uncompress_fd_to_buf
  2012-12-04  8:09       ` 张忠山
@ 2012-12-04 23:13         ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2012-12-04 23:13 UTC (permalink / raw)
  To: barebox

On Tue, Dec 04, 2012 at 04:09:32PM +0800, 张忠山 wrote:
> > Why don't you uncompress to a regular file (i.e. /tmp/foo) rather than
> > to the device file?
> >
> My fireware will be a huge file: about 12M bytes. I don't known How much
> a regular file's size.

barebox will handle these file sizes just fine given that your malloc
area size is configured big enough. The only thing that could happen is
that the performance of the memory allocator will decrease with that
many allocations. You can work around this by increasing CHUNK_SIZE in
fs/ramfs.c.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

end of thread, other threads:[~2012-12-04 23:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30 11:03 Howto known uncompressed length when uncompress_fd_to_buf 张忠山
2012-12-03  9:55 ` Sascha Hauer
2012-12-04  1:42   ` 张忠山
2012-12-04  7:44     ` Sascha Hauer
2012-12-04  8:09       ` 张忠山
2012-12-04 23:13         ` Sascha Hauer

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