This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to decompress the .gz or .zip file in u-boot.

Hi All,

I have to decompress the .gz or .zip file in u-boot from MMC card.  For this i put the .gz folder in MMC Card. In u-boot am able to read the .gz  file in RAM at address 0x82000000 .  For decompression am using the gunzip lib which supports in u-boot. Memory to Memory uncompression done using that. But i want the decompressed file on MMC again. 

How i can decompress the file and that decompressed file again created on MMC?.

(e.g in normal linux, suppose adc.gz , when i decompress it creates the  abc.txt any file and that should be on MMC) 

Thanks for reply :)

Surendra

  • The main line U-Boot has support for saving memory back out to file. The command is fatwrite. Looks it came in at version 2012-04. I believe all the TI U-boots are based on 2010-12.

    If TI pushed all their changes back up to the main line, you should be able to compile the main line U-Boot for your TI processor. Otherwise, you have to down port the fatwrite changes into your u-boot source.

  • Hi Norman,

    Thanks for your reply:).  Actually i have gone thr the fat_load command patch. But i have one doubt , Is the data stored in RAM or the mmc (flash device)?.

    If am using the fatload command it loads the data from flash device to memory(RAM). If am using fat_write , Is this writes the data from RAM to MMC(flash device)?

    Is my understanding correct ?

    Thanks,

  • I have never used the fatwrite or unzip command. You can always experiment with the commands to find out what happens. From inspection of the source code. My guess at the sequence of commands would be:

    mmcinfo
    fatload mmc 0 0x82000000 file.gz
    unzip 0x82000000 0x83000000
    fatwrite mmc 0 0x83000000 file ${filesize}

    The above should:
    1) Init the mmc device.
    2) Load "file.gz" from mmc into memory 0x82000000
    3) Unzip from 0x82000000 into 0x83000000. Env var "filesize" holds unzipped size.
    4) Save memory at 0x83000000 for filesize bytes to mmc with name "file".

    Adjust the memory ranges to suit your file sizes and memory sizes.

  • Hi Norman,

    Thanks for your valuable and detailed  suggetion. I integrated the fatwrite patch in our source code base. its works fine.