Wednesday, 14 December 2016

[Guide] how to edit rom android / create custom rom android

This is a Guide to help anyone who wishes to create custom ROMs. This Guide aims to be as complete as possible, and will give all information related to creating a custom ROM... editing apks, adding or removing apps, de-odexing apps, and so on.
Al suggestions to improve upon this guide are welcome. 

Quote:
0. Pre-requisites
Credits to...
1. puppet13th... My mentor, teacher, and a great friend.
2. Wanman... ApkTool for ICS
3. langthang... For a great Guide on Creating Update Script
4. lokeshsaini94... For lots of help

Downloads
You need to Download the following...
1. Apk Tool [link(ICS)|link(GB)]... A tool for De-Compiling apks
2. 7 zip [link]... A tool for un-compressing any sort of compressed file
3. ROM signer [link]... Restores the signing of the ROM zip file, which is messed up while uncompressing
4. Any Image Resizer
Setting up your PC
You need to do the following...
1. Create a folder (preferably in Desktop, and name it "Android")
2. Create Sub-Folders by the names "Base ROM" and "Custom ROM". Also make Sub Folders by the name...
a. ApkTool... Extract contents of ApkTool Here
b. Signer... Extract Autosigner here

Quote:
I. Let's get our Base ROM
You need to get the base ROM in the ./Desktop/Base ROM folder. It is also recommended that you flash the Base ROM into your phone, as it will help in testing the mods, as you make them.

The process of getting the base ROM will depend on the scenario your situation fits in, from amongst the following...
1. You want an already made Custom ROM as your Base... Download the ROM [willl come in .zip folder], and extract it in /Desktop/Android/Base ROM folder
2. You want to base your ROM on a stock firmware, which came in an ftf package... Use the following tool to extract the files from the ftf file.
3. You want to base your ROM on a stock firmware, which is instaled on your phone...
  • Take a back up of the ROM using ClockWork Mod, and copy the back up files (from /sdcard/clockworkmod/backup), somewhere to your computer. Then, using this tool, extract the files to /Destktop/Android/Base ROM
  • Copy the following folders from /system of your phone using Root Browser
/app
/bin
/etc
/fonts
/framework
/lib
/media
/semc
/usr
/xbin
build.prop
4. You want to base your ROM on a stock firmware, that comes as a ready to flash .zip file on the internet... Download the ROM, and extract it in /Desktop/Android/Base ROM folder


After completion, the Base ROM will have the following Folder Structure

Quote:
Desktop
  • Android
    • Base ROM
      • META-INF [only if you got your base from another Custom ROM][/INDENT][/INDENT][/INDENT]
      • system
        • apps
        • bin
        • etc
        • .
        • .
        • .
      • data [may be]

*ScreenShots*


Copy the contents of Base ROM folder to Custom ROM folder. 
We now have the foundation of our ROM laid out in front of us, inviting us to show our creativity. 

Quote:
II. Let's work on the Base ROM... Creation of the Custom ROM

A. Apks Make up the Android System...
We will now work, only on the /Desktop/Android/Custom ROM Folder

1. Look into the /system/apps...
You will find apk files which will be raninging frm 100 to 200 in number. Err, half or more are known as "Crapware". You need to remove files which are useless, that's a very important step to enhance performance of your final ROM. Look into your device's forums, to get the list of Safe-To-Remove appks from the respective firmware. In case your base is an already built custom ROM, you will have to remove lesser or none of the files.
2. Here, you can add your desired files as well, keeping compaitability in mind.

3 [Optional]. On a .txt file, keep a record of all the apps your removed or added, as it will help in troubleshooting at a later stage.
B. Implementing Already-Built-MODs in your ROM...
1. Download any Mod you want to keep in your ROM [Make sure your device, and the Base ROM is compaitable]
2. Extract the zip file and you will get a system folder.
3. Copy the files from the system folder to /Custom ROM/sytem, making sure the files go into the folders they came from.
That is, all apk files from /system/apps folder of the Mod should go to /Custom ROM/system/app folder, and so on...

C. Changing the Interface... Let's Mess with SystemUI[nterface].apk
Go to /system/app and copy SystemUI.apk to 
/Desktop/Android/ApkTool/place-apk-here-for-modding

Working with ApkTool
The link provided in this post is of an easy to use software called ApkTool.

1. Double Click on the Script.bat file to open up the software.

*Screenshot*

2. Decompress the SystemUI.apk using option '9'.

Wait for the process to complete

3. Go to /Projects, and you will find a folder called SystemUI.

Open the /SystemUI.apk/res/drawable folders and you will find lots and lots of .png files

*Screenshot*

4. Look into the files carfully.

Bingo, they correspond to the various system elements of the SystemUI of the Base ROM.

5. Open any file you want to edit, edit it, and save in the original location, replacing the original un-edited file. [On a temporary notepad file, note which all files you edit]
Note: You will notce that there are .png files for, say the Battery Icon. You will find that there are files for each state of the Battery Icon. So if you intend to edit the Battery Icon, you need to edit all the files corresonding to each of the states.
5.A. A common exaple of such editing is making the elements of a Gingerbread SystemUI.apk look like ICS SystemUI.apk. For this get hands on any ICS SystemUI.apk and extract both the files in seprate locations, and then copy the files from the ICS SystemUI folder to GB SystemUI folder. However, here you must make sure that the names of the files coming from ICS SystemUI are changed to corresponding values of the GingerBread SystemUI.apk. Here, also ensure that the new files, which replace the original files, have the same dimensions as the original files. If not use any image resizing tool.

*Screenshot*

6. If you want to edit some values in the .xml files, carry on. Edit the files as you wish, and replace the original files. Once you are done with the editing...

7. Open the Script.bat file and run command 11. [Say NO when it asks if the file is a system file]You will have a new SystemUI.apk file called unsignedSystemUI.apk in /place-apk-here-for-modding folder.

Go and fill your pockets with some cookies from the kitchen. Start having them.

8. Keep the temporary notepad file on one side and open the unsignedSystemUI.apk with 7zip, and open the original SystemUI.apk using 7zip besides it.

*Screenshot*

9. Drag and extract the files you edited to a temporary folder.

10. Drag the extracted files to the SystemUI.apk, replacing the older files, making sure all the edited files go to the proper place. [That's why I asked to keep a note of which all files were edited].

*Screenshot*

11. If you edited some .xml files, then you MIGHT need to copy the resources.acrc file at the root of the unsignedSystemUI.apk file to the root of the original SystemUI.apk file.

Once done, the original SystemUI.apk has now become a modded SystemUI.apk, with your creativity embedded into it. Time to test the SystemUI.apk.

12. Using Quick ADB, push the edited SystemUI.apk to your phone.

*Screenshot*

13. Re-boot your phone and you shoud see the changes you made in the UI. .
In case it gives force close message, you messed up somewhere. So you will have to push the original SystemUI.apk [from /Base ROM/system/apps folder], and try to mod the file from scratch again.

14. Copy the sucessfully modded SystemUI.apk from /Apktool/place-apk-here-for-modding folder to /Custom ROM/system/app folder, replacing the older file.
D. Changing the Interface... Editing other .apks
1. As earlier, copy the apk you want to edit from /Custom ROM/System/app to /Apktool/**** folder, and perform the modification to optain a new modded .apk file.
2. Test this file if you wish, by pushing it using Qucik ADB.
3. If the modded file wrks, copy this new file to /Custom ROM/System/app and replace the original file

E. Changing the Interface... Editing the font
1. Take your desired font.ttf file and rename it as DroidSans.ttf..
2. Go to the folder system/fonts/
3. Now, replace the file DroidSans.ttf with your desired DoridSans.ttf...
4. To change the lock screen clock font...replace the Clocktopia.ttf with your desired one (rename first)...


If you did a good job in the above steps, the /Custom ROM folder should be having the contents of a wonderful ROM in making.
Here, I will like to mention that, if you want to upload your custom ROM on the internet and share it, you must ensure that you did lots of hard work in the above steps. There's no point making a custom ROM without modifying lots of files and adding lots of tweaks.
Just make sure that you do so much of modding that, say, your Gingerbread ROM looks like Jellybean, or say, your ROM made for Galaxy Y works as smooth as an SIII.


Quote:
III. Compiling the Custom ROM

A. If you got your base ROM as in [1 or 4] in step I above
1. Copy the META-INF folder from /Base ROM to /Desktop/Android/Custom ROM
2. Rename the Custom ROM folder to whatever-you-want-your-ROM-to-be-called.
3. Add the Folder to a zip file using 7zip.
4. Take this zip file to /Desktop/Android/Signer folder and run sign.bat.
X. The new zip file called Update.zip is your ROM. 
Copy this file to the SD Card of your phone, format /system, /data, /cache using CWM and flash your .zip file. And enjoy your custom ROM.


B. If you got your base ROM as in [2 or 3] in step I above... Creating your own Update script
Read the following Tutorial. [link]

Once you are done, try the ROM on your phone. Share it if you feel it's great.

For more information click here

No comments:

Post a Comment