Howto known uncompressed length when uncompress_fd_to_buf

张忠山 zzs213 at 126.com
Mon Dec 3 20:42:42 EST 2012


In message <20121203095534.GL10369 at 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





More information about the barebox mailing list