On Tue, Dec 04, 2012 at 09:42:42AM +0800, 张忠山 wrote: > In message <20121203095534.GL10369@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox