EZXCodec - editing of EZX-based cellphones' firmware in Windows environment.

What program can do at the moment:
 -extract codegroups from firmware file (*.SBF)
 -extract files and folders CramFS from codegroups
 -compile CramFS codegroups from files and folders keeping original properties and codegroup size (based on the info, obtained when decompile codegroups)
 -compile firmware file from codegroups (based on the info, obtained when decompile firmware)
 -extract files from Motoskin (iconres.ezx) file (recognizes and renames GIF, JPEG and PNG picture files, converts "k"-format files to BMP)
 -compile Motoskin (iconres.ezx) file from picture files (simply changes GIF, JPEG and PNG files' extension to .g, converts BMP to "k")
 -extract and change bootscreen picture in CG39 (known to work with least A1200 and E6)
 -script support - it is possible to launch commands from special text files to apply patches replacing, adding or deleting files from CramFS codegroups or from Motoskin (iconres.ezx) files, or editing configuration files in CramFS codegroups

Starting from version 1.0 EZXCodec does not require help of external programs cramfsck.exe and mkcramfs.exe when working with CramFS. You can safely remove "tools" subfolder of EZXCodec's folder, if it exists, file from there won't be used anyway.
  
  
Manual

1. Working directory
  Before you start to work you should choose "Working directory". This is the place where program stores temporary files and files you probably want to edit. It's recommended that you select empty directory so you won't mess something up. All subfolders created automatically.

2.1. Decompiling firmware files (*.SBF)
  Under working directory selection field you'll find three tabs "SBF", "CramFS", "Motoskin" and "About". To decompile SBF firmware file you need to switch to "SBF" tab and choose *.SBF file you want to decompile in "Original SBF file" field. After you select the file you want, press "Open". Information about codegroups in firmware file will fill the table, positioned further down. When "Completed" appears in the "Log" field you can select which groups you want to extract. Press "Extract". Checked groups (along with some necessary additional information) will be placed in "smg" subfolder of working directory.
  NEW IN 1.3: If checkbox "From CramFS too" near button "Extract" is checked, then, while extracting codegroups from SBF, program will perform extraction from all codegroups (except for RDL), which contaiin CramFS header.

2.2. Compiling firmware files (*.SBF)
  To compile SBF file from codegroups you must have already extracted codegroup files in "smg" subfolder of working directory (edited codegroups must be placed there too, overwriting the originals). In the same directory "sbf_info.txt" file must exist, which contains additional information and which created when extracting codegroups from firmware. In other words - you must decompile firmware with this program before you can compile new one.
  If you close program between decompiling and compiling of SBF, and the table, which should contain information about codegroups, is empty, press "Open" and the table will be filled. But be sure, that the same original file is chosen in "Original SBF file" field. Working directory path should not be changed too. All filename fields and working directory path are saved on exit.
  Check codegroups you want to compile new firmware from, select path and name for the new SBF file in "New SBF file" field, press "Compile".
  NEW IN 1.3: If checkbox "New CGs" near button "Compile" is checked, then, while compiling SBF, *.SMG files with "_new" suffix in the filename will have more priority, if they exist in "smg" subfolder of working directory.

3.1. Decompiling CramFS codegroups
  Switch to "CramFS" tab. Choose needed *.SMG file of codegroup from "smg" subfolder of working directory in "Original CramFS file/info" field. Press "Open", table will be filled with information about file system of codegroup. In order to extract files to "cramfs-root" subfolder of Working directory, press "Extract".
  NEW IN 1.3: For a fast choice of original CramFS file from "smg" subfolder of working directory choose "From working directory" and use drop-down list. In this mode path and name for the new CramFS file offered automatically and is the same as for original CramFS file, but with "_new" suffix.
  NEW IN 1.3: "cramfs-root" folder name will have suffix with a name of CG which is extracted.

3.2. Editing and compiling CramFS codegroups
  After you extracted files from CramFS, you probably want to change some files' content, or add some new files.
  In first case you just edit (or replace) files.
  In second case (when adding new files) just copy file you wish to add, to corresponding directory, remembering that the root of codegroup is - <Working directory>\cramfs-root. Next, for the firmware to work properly you must specify correct info about owner (user, group) and permissions for the new files. After copying new files press "Show" in "Original CramFS file/info" field. "CramFS file list" window will show up (open delay depends on the number of files). In that window you'll see files contained in <Working directory>\cramfs-root. For the new files which you just added info is not available until you provide it, and "n/a" is displayed in "uid", "gid" & "permissions" columns. You can edit this info by double-clicking the line you need or by pressing Enter key or "Edit" button. When you finish working with this window, just close it.
  After comitting all your changes choose a name for the new codegroup file in "New CramFS file" field and press "Compile".
  NEW IN 1.3: Folder name displayed on "Show" button press and used as source for new CramFS file, depends on selected original CramFS file name and have the following format: <Working directory>\cramfs-root-<Selected original CramFS filename without extension>.

4.1. Decompiling Motoskin (iconres.ezx) files
  Switch to "Motoskin" tab. Further actions are similar to 3.1 except files will be placed placed in "motoskin" subfolder of working directory.

4.2. Editing and compiling Motoskin (iconres.ezx) files
  Just edit/replace files in "motoskin" subfolder of working directory and press "Compile".

5. Bootscreen picture
  Go to "Bootscreen" tab and choose *.smg file that contains bootscreen picture (for A1200 and E6 it is CG39.smg). Pressing "Open" will show you original picture. If you want to save it (e.g. for a backup) press "Extract" and choose path and file name. If you want to replace bootscreen picture press "Replace" and find a *.gif file that you want to replace with.
  New GIF should satisfy following conditions:
  - must have the same dimensions as the original (240x320);
  - must contain only one single frame (i.e. no animation permitted);
  - must not contain transparency;
  - file size of the new GIF should not be bigger than bootscreen CG minus start offset of GIF in this CG (131072 - 2048 = 129024 bytes maximum).
  EZXCodec will tell you if selected GIF file not satisfies these parameters.
  After you choose the new file, you'll should see it instead of the original. To apply changes, press "Compile", and the new picture will be written to the same CG file, that you opened as original.

6. Launching scripts.
  Script support was implemented to simplify modding of firmware files. You must check that the script you want to use is created specially for the firmware you want to patch, or at least compatible with it.
  It is not necessary to choose working directory - you can leave this field empty, then EZXCodec will use temporary folder defined by Windows.
  Choose original firmware file and filename for the new firmware. Press "Script" on "SBF" tab and choose *.ecs script file. You'll know about the script completion when "SCRIPT: Completed" appears in the "Log" field.
  For script format see file "script_format_v4_en.txt"

Thanks for the help in creating program
  forum.motofan.ru, and it's members:
   lucrece - for sharing info about SBF file format and "k" graphic file format
   DemosN - for countenance and testing
   demonvex - for help curbing motoskin, bug-reports and program inmpovement tips
   Xronos - for testing first verions and countenance

Hosting at http://ezxcodec.medoosa.ru provided by Exoundeeq.

  Special thanks
   to Vladimir Kladov for one of his great creation - KOL and MCK. Without these tools EZXCodec's executable could be much bigger, and it could be more complex to implement and support.

(C) 2007-2008 Eugene Nesterov aka Rocket @ http://forum.motofan.ru
