ZIP-based ROM Tweaking

Difficulty Level: Beginner-Intermediate

What you will need:

Basic tools


– ZIP manager tool like 7zip/WinZip/WinRAR

Advanced tools


smali (assembler/disassembler)

APKTool/APK Multi-tool


Lets Begin:

Download a ROM (we use CM in this guide) of your choice (don’t forget to get the permissions for it modding from the developer) and extract it. When you extract it, you will see atleast two folders and one file. Please note the minimum contents will be as follows


– system



– boot.img


The Folders:

The System Folder

Open the system folder and the first folder you will notice is ‘apps’. This is the place where all the system apps are situated (if you are using a stock ROM, you might also see ‘.odex’ files for most apps. These odex files are used to speed up the booting of the device but cause problems when we modify or theme apps. Just for a record, these ‘.odex’ files contain the ‘dex’ part of the apk. So,if you remove an app,you should delete the odex file too). If you want to add an app,just drag and drop. Take care not to delete each and every app you find,because each of them has their own functions. The list of removable apps can be found here.

If you want to deodex them,then use the xUltimate software. It is an auto deodexer. If you want to edit the xml files in an app, you will have to decompile it. This is where apktool comes into picture. Use apktool to decompile an app. Edit the xmls and recompile it. Here is a complete guide along with images on how to decompile and recompile apk’s.


SystemUI.apk is one of the core apps needed by the system to function. If you mess this app, your device will enter into a bootloop, or you will get a series of FC’s (Force Close) on system applications. So please edit this file with care. By editing systemui.apk,you can get transparent status bars, transparent notification bars, centre the clock, etc. So in short, this apk decides the visuals of your rom. For some systemui mods, refer this guide.

Some apk files are lib-dependent, which means that they need certain libraries to work. A few examples are, Swype keyboard, Google Maps etc. Swype wouldnt work if the lib file is not included in the rom. So if you add any lib-dependent app, make sure you add the lib file too. Same goes for removing a lib-dependent app.

The Bin Folder

The bin folder contains all the binary files required by the android operating system core to function! It may include how the system handles process and other advanced stuff. So please refrain from modifying any files in this folder.

The Etc folder

This folder contains a lot of miscellaneous files. Although miscellaneous, the files are important! The main folder which you can mod is the init.d folder. The ‘init.d folder’ handles all the scripts which run on device boot. You can command the system to carry out any function using these scripts.

Other files include NOTICE.html and CHANGELOG-CM. These files just contain the version changelogs and the CM license. Do not edit or remove these files.

The Fonts folder

This folder contains all the system fonts. Clockopia is the font used to display on the lockscreen. You can delete the fonts, but make sure you have at-least one. You can also add fonts to this folder and they will be available in the ‘Select Font’ option in the Settings.apk. When replacing fonts, take care that the new font has the exact name as the old one, otherwise the new font won’t work.

The Framework folder

In this folder, you will find all the core system framework apps. These apps act as the system skeleton. In this folder, the only app which we can mod is the ‘framework-res.apk’. This app contains battery icons, status bar icons, lockscreen icons, etc. If a framework app is incorrectly modified, the ROM won’t boot. So, please be cautious.

The Libs folder

The ‘libs folder’ contains all the library files needed by the apps to function. It contains libraries of all apps ranging from core system apps to user apps. As stated earlier, if you add a lib-dependent app, its lib file goes into this folder. Nothing to mod here.

The Media folder

This folder contains all the media used in the Android system, complete from the starting boot animation to the shutdown animation. The common contents of this folder are, ‘ringtones, notification sounds, alarms, boot animations, key press sounds’. If you need to add some audio, just drag and drop it into the correct folder. You can also create your custom boot-animations. For the process please refer this guide by Ethan Hunt (Ethan Hunt.. Seriously ?).

The Tts folder

The ‘TTS folder’ is all about Text-To-Speech. It contains all the files needed by the Android system to get Text-To-Speech working. If you are removing the TTS feature from your ROM, make sure you remove this entire folder and the TTS related apps from the ‘system folder’, as this will save a lot of space.

The WiFi and Usr folders

The WiFi folder contains the drivers required by the WiFi module to function. So i strongly recommend NOT to touch this folder. If you delete any file from this folder, you will mess up the WiFi functionality.

The usr folder contains some miscellaneous but very important stuff. It may contain anything and everything needed by the Android operating system. For instance, this folder contains all the key-mapping. If such files are messed with, your device will be non-functional although it will boot.

The Build.prop

The build.prop file is pretty self-explanatory. Here, you can change the most basic things, like the android version that setting shows. Wondered how people are making 2.3.4 look like 4.0.3 in settings? Its build.prop. Also,you can change what ‘About phone’ shows here.

Other things,you can change things like,how long your wifi scans,how much battery your phone saves while in sleep, Dalvik VM heapsize and default ringtones. If you are wondering what # stands for, it signifies that, the particular line is commented out, and the system does not read it. You can use it add comments to the build.prop. This helps others understand, what is the function of a particular tweak.

A guide for some basic build.prop tweaks can be found here.

Please be aware that, these build.prop modifications are not universal. So, you will have to experiment with the tweaks and their values.

The META-INF folder

This folder contains instructions for the Android Recovery about how to work with the files present in the zip. This folder contains many folders, but the only one we need to edit is the update-script file.

Updater-script reference

Now,the updater-script is not something that you should mess around with, as a single line of error in the script could result in an error.

The two common languages used in the update-script are ‘Amend’ (update-script) and ‘Edify’ (updater-script & update-binary). Amend has been discontinued since Android version 1.5 (Donut). Now only Edify is used, and thus, we will deal only with Edify.

Please understand that all the commands used in the updater-script are functions. Thus if you have some knowledge of C or Java, this file is easy to understand.

Lets look at a simple example of how the script works.

If you flash an Amend script for a version of Android newer than 1.5, or a version of CWM newer than 3.x, there is a risk it will not operate correctly.

This command will attempt to mount the MTD partition named “system” to “/system” partition. If the mount succeeds, the script will display Successfully Mounted!, otherwise(else) it will display Mount Failed!


Some common updater-script commands are :

  • mount : Mounts a filesystem to the defined mount point
  • is_mounted : Checks if a filesystem is mounted
  • unmount : Unmounts the filesystem
  • format : Formats a filesystem as specified
  • delete : Deletes a file.  Must specify at least one file; multiple files can be specified as multiple arguments with the use of ‘,’
  • delete_recursive : Deletes a folder and all of its contents.  At least 1 directory must be specified;  multiple directories can be specified as additional arguments
  • show_progress : Displays flashing progress in the recovery system
  • package_extract_dir :  Extract the all of the files in a directory in the package to the target specified
  • package_extract_file : Extracts a single file from your update package to the target specified
  • symlink : Unlinks any existing symbolic links before creating the new symbolic links.
  • set_perm :  Sets permissions of a file or set of files specified.  At least one file must be specified (the first four parameters are required)
  • set_perm_recursive : Set permissions of a directory or set of directories and all files and folders within them.  At  least one directory must be specified (The first 5 parameters are required)
  • write_raw_image : This function writes an img file to a partition
  • ui_print : This function prints/echos a message to the console while the script is running.  At least 1 parameter needs to be specified, you can specify additional msg parameters and they will be concatenated to the output
  • run_program : Executes a program with the arguments specified.   Returns a string, I assume it is the buffer of the stdout of the program executed, need to test
  • assert : If condition evaluates to false, stops script execution, otherwise continues processing



A complete guide on Edify Scripting can be found here.

The Files:


The boot.img is a very important file. If you are reading this then, probably you have to wait a little bit more to modify this image file.

This image file contains the kernel, ramdisk, recovery etc. These files are very important and may vary from modules to system partition layouts.

NOTE: A kernel is the file that acts as an intermediary between the hardware and the software. A pretty decent explanation about the android kernel can be found here.

Making Flashable ZIP

In order to create a flashable zip, first zip the ‘system, META-INF’ folder and the ‘boot.img’. Let’s name this zip as ‘’. Next we need to sign the zip. Get a signer here. Put your update zip in the same folder as the signer. Then run the ‘signer.bat’ file. This will sign your zip file. After the signing process is complete, you can change the name of the zip to your liking.

Signing is not necessary. You can turn Signature Verification OFF in the recovery. But i strongly recommend signing to reduce incompatibilities.

If you are reading this, you just made your first custom rom. Cheers.

Some Tips:

  • Always use NotePad++ to edit files related to Android.
  • Always stick to the guide.
  • If you have any problems, first search for similar cases. If you still fail to find the solution, post your problem in a forum. The correct way of posting can be found here. Please adhere to it.