Title: Packing and unpacking codegroups in Windows Post by: Exploited on September 10, 2008, 03:50:18 am This is a nice tutorial, written for V8, which I found on this website: http://www.rasputin007.co.uk/storage/webpages/cygwin/index.htm
Quote This guide has changed so much over the last few days, but hopefully it is now at the final stage. Thanks to acidland, who compiled mksquashfs.exe and unsquashfs.exe, it is possible to unpack CG.smg files and repack them, all under Windows. This is meant as a help for all those that either can not run Linux or do not want to run Linux, but still would like to edit either the CG43 with FlexBit-Editor or change the CG52. I have mounted those two CG's from 4 firmwares (2 x 512 MB V8 and 2 x 2GB V8) and packed them into rar files. They are all unedited original CG's from those firmwares. 2 of them, one for each V8 version, are China Mobile based and have some strange looking file names in the CG52, remember to change them or otherwise you will face problems with the repacking into a smg file. To recompile them into flashable smg files you still need a bit of Linux-Magic, which comes in form of Cygwin. Cygwin creates a linux based enviroment with a command prompt interface, just like DOS used to have. It is just like any other software you can run under Windows, with the advantage that you can use Cygwin to unpack the original CG's and recompile your finished CG43 or CG52 with mksquashfs, which will create a CG.smg file in squashfs format which then can be flashed onto your V8 or Z6, as it has the same OS. I have tried this now on a PC that did not had ever had Cygwin installed, and after installing Cygwin with the "default" package selection plus the zlib package, it worked straight away. What you need to do first: 1.) Go to the Cygwin website and download the "Setup.exe" file, then double click on it which will open the Cygwin setup window. Normally all default settings should be fine, you just have to select a mirror that is closest to your location. When it comes to the program software install options, just go with the default, apart from one section and that is the section Libs, see picture At the bottom of the Libs section select the zlib package, as you need this. Any depending packages will be selected automatically. Now sit back and let the program fetch those files, install them and set them up. For future reference I assume that you have choosen the default installation, if you have not then you have to adjust the path I mention accordingly. 2.) Now download and unrar the squashfs.rar and copy the two *.exe files into C:\cygwin\bin. Now start Cygwin and type "mksquashfs -version" at the command prompt and you should see some info like mksquashfs version 2.1. Now type "unsquashfs -v" and again you should see some info about it. Well, you are ready to go now! 3.) You will need SBF Recalc 1.2.8 to split and repack firmware. Optional software, but highly recommended 4.) You might want the FlexBit-Editor if you want to edit the CG43 5.) You might want the Iconres-Tool V1.0 if you want to edit the iconres.ezx in the CG52 Thats it! Let's get started by unsquashing a CG52.smg (works the same with CG43.smg). You have to use SBF Recalc 1.2.8 to split a firmware first in order to get the CG52.smg, but usually those file names are far too long to type them into the command prompt, so we just shorten the name to simply CG52.smg and copy this file to C:\cygwin\usr\local. Now create a folder called test in C:\cygwin\usr\local, so it looks like C:\cygwin\usr\local\test, next type the following command "unsquashfs -d /usr/local/test -f /usr/local/CG52.smg". Here is a explanation of the code: -d gives the destination folder (this is a must do, otherwise it will create a "squash-root" folder in your current location, which would be the /home directory), -f forces to write/overwrite existing files and folders that might be already in the text folder (this is optional, so it is up to you if you want to use -f), /usr/local/CG52.smg is the location and the name of the CG52.smg file which should be unsquashed. Now create a CG52 folder in C:\cygwin\usr\local and copy the whole content of C:\cygwin\usr\local\test into C:\cygwin\usr\local\CG52 or use one of the already "unsquashed" CG's from the table at the bottom. Now you can edit it to your liking and when done then type the following command "mksquashfs /usr/local/CG52/* /usr/local/My_CG52.smg -le" Please notice the change of \ to /, because Windows uses \ to divide folders whereas Linux uses / for the same purpose, do not mix them up!!! The command basically contains "make a squasfs file from everything (*) in usr/local/CG52 and pack it into the My_CG52.smg file and place it in /usr/local, also use the little endian (-le) system", which is very important, leave this out and your flash will end in bootloader!!!. It is the same command line for both CG's, but obviously the CG number is different. One important tip when using asian CG52's, they often/always have file names with funny characters, because the conversion from chinese to european characters is not perfect and mksquashfs will complain about them. If this happens then either replace those files with files from an european CG or rename those files, but remember that especially the files in the picture folder are pointed to by the themes!!! You can easily edit those theme.phm with Wordpad. All you have to do now is copy the My_CG52.smg file into a new folder together with the *.hmg and *RAMDLD.smg file from the firmware you are currently running. You get those 2 files when you split the firmware with SBF Recalc 1.2.8. Make sure all those 3 file have the same name like My_new_flash.hmg, My_new_flashCG52.smg and My_new_flashRAMDLD.smg now use SBF Recalc 1.2.8, check the 2 top options (Calculate All New CGs and Write New Descriptor) under "Advanced" and press "ReCalc Checksum", when that has finished press "Create SBF-File" to create a new flash file. Done! If you have done everything correctly and remembered that the CG52 have a size limit, 512 MB V8 CG52 ~14MB and 2GB V8 CG52 ~19MB, otherwise SBF Recalc will tell you that the CG is too big, so back to the drawing board and try to lose some weight and when successfully finished your reflash should flash fine and your V8 should startup with the changed CG in place. If this is not happening then there was a mistake somewhere in the creation process, find it and correct it and it will work Squashfs - attached. SBF Recalc (http://www.rasputin007.co.uk/storage/others/SBF-Recalc%201.2.8.rar) IconRes Composer 1.1 (http://www.rasputin007.co.uk/storage/others/MotoLinux%20Iconres%20Composer%201.1.rar) Title: Re: Packing and unpacking codegroups in Windows Post by: nobody on January 10, 2009, 08:21:37 pm Thanks for sharing!
|