Packing lgapp partition
LGAPP partition is CramFS Linear XIP (eXecuted In Place) image packed with modified LZO.
LZO algorythm modification made by LG quite simple. They extended magic from 1 byte with 0x00 and following 32 bits is size of uncompressed image. Thus making the famous 5 bytes differing from standard lzo.
Sources from LG.
CramFS Linear XIP
Before make cramfs, XIP files in Linear XIP CramFS image should be marked with +t, to store it uncompressed and page-aligned.
More information on XIP can be found here: http://elinux.org/Application_XIP
- LGAPP partition on Saturn6 platform should contain 2 files: RELEASE and RELEASE.sym. Put them in same dir.
- chmod +t RELEASE
- mkcramfs ./ lgapp.cramfs
- lzopack -9 lgapp.cramfs lgapp.cramfs.lzo
lgapp.cramfs.lzo - ready to flash lgapp partition image.
If you plan to flash partition using u-boot loadz command - no need to do this.
For Saturn 6 & 7 devices only there is a need to adjust the image size to be multiple of 4096 bytes before flashing it from command line. Therefore the image size must be increased accordingly by appending the appropriate number of bytes (0x00 or 0xFF).
It can be done using this command on your linux pc:
ibytes=`cat lgapp.cramfs.lzo | wc -c`; blockscount=`echo $ibytes/4096 | bc -l | cut -f1 -d. `;\ obytes=`echo \($blockscount+1\)*4096 | bc -l`; abytes=`echo $obytes-$ibytes | bc -l`;\ cp lgapp.cramfs.lzo lgapp.cramfs.lzo.flash; for i in `seq $abytes`; do printf "\xff" >> lgapp.cramfs.lzo.flash; done
lgapp.cramfs.lzo - input image file
lgapp.cramfs.lzo.flash - output file