Saturday, 25 May 2013

HOW TO MAKE A CUSTOM ROM FOR ANDROID(very easy noob proof guide)

HOW TO MAKE YOUR OWN CUSTOM ROM

GUYS FROM TODAY I WILL NOT ONLY MOST MY ROMS BUT ALSO I WILL POST GUIDES FOR COMPLETE ANDROID DEVELOPMENT
 Wanna know how to develop roms kernel and everything about android in a easy noob poof manner then you can from now not only posting roms and tutorial I will post everything required for making roms, kernels compiling Cyanogen mod, and also porting cwm recovery and also twrp 

IMP NOTE:
please read the complete post it may look big I have written briefly for easy understanding please read carefully

FROM TODAY I WILL POST EVERYTHING NEEDED FOR BECOMING A ANDROID DEVELOPER
YOU CAN CLICK ADS IN RETURN

Difficulty Level: Beginner-Intermediate

What you will need:

Basic tools

- Notepad++
- ZIP manager tool like 7zip/WinZip/WinRAR

Advanced tools

- Cygwin
- smali (assembler/disassembler)
- APKTool/APK Multi-tool

Lets Begin:

Download a ROM  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

Folders

- system
- META-INF

Files

- boot.img

The Folders:

The System Folder

OpeLets Begin:
Download a ROMROM is literally “read-only memory” but its usage has changed over time. Today ROM can refer to the non-volatile area of a device’s flashFlashingFlashing is the process of writing data to the internal memory on your phone. Normally, you would flash a ROM image to the phone, which would give you a different version of system software on your phone. Flashing can also refer to updating/writing to any of the other parts of the phone, such as the SPL, Radio etc.is the process of writing data to the internal memory on your phone. Normally, you would flash a ROM image to the phone, which would give you a different version of system software on your phone. FlashingFlashing is the process of writing data to the internal memory on your phone. Normally, you would flash a ROM image to the phone, which would give you a different version of system software on your phone. Flashing can also refer to updating/writing to any of the other parts of the phone, such as the SPL, Radio etc.can also refer to updating/writing to any of the other parts of the phone, such as the SPL, Radio etc.memory on which read-only data resides or the packed image to be written to that flashFlashingFlashing is the process of writing data to the internal memory on your phone. Normally, you would flash a ROM image to the phone, which would give you a different version of system software on your phone. Flashing can also refer to updating/writing to any of the other parts of the phone, such as the SPL, Radio etc.is the process of writing data to the internal memory on your phone. Normally, you would flash a ROM image to the phone, which would give you a different version of system software on your phone. FlashingFlashing is the process of writing data to the internal memory on your phone. Normally, you would flash a ROM image to the phone, which would give you a different version of system software on your phone. Flashing can also refer to updating/writing to any of the other parts of the phone, such as the SPL, Radio etc.can also refer to updating/writing to any of the other parts of the phone, such as the SPL, Radio etc.area.  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
Folders
- system
- META-INF
Files
- boot.img

The Folders:n 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. T
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

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 libswypecore.so 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 of the phone (a hard wipe), or perform an update using an update.zip file on the root of the microSD card. It is common (although not necessary) to flash a patched Recovery image, such as TWRP or ClockworkMod Recovery. This allows you to run Nandroid backup from the device, and flash modifications, such as files to the device, essentially becoming a means to install software to the device. Recovery mode is separate from ‘normal’ mode, and can be entered by holding down home whilst turning the phone on. 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 of the phone (a hard wipe), or perform an update using an update.zip file on the root of the microSD card. It is common (although not necessary) to flash a patched Recovery image, such as TWRP or ClockworkMod Recovery. This allows you to run Nandroid backup from the device, and flash modifications, such as files to the device, essentially becoming a means to install software to the device. Recovery mode is separate from ‘normal’ mode, and can be entered by holding down home whilst turning the phone on. 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 of the phone (a hard wipe), or perform an update using an update.zip file on the root of the microSD card. It is common (although not necessary) to flash a patched Recovery image, such as TWRP or ClockworkMod Recovery. This allows you to run Nandroid backup from the device, and flash modifications, such as files to the device, essentially becoming a means to install software to the device. Recovery mode is separate from ‘normal’ mode, and can be entered by holding down home whilst turning the phone on. 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:

Boot.img

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 of the phone (a hard wipe), or perform an update using an update.zip file on the root of the microSD card. It is common (although not necessary) to flash a patched Recovery image, such as TWRP or ClockworkMod Recovery. This allows you to run Nandroid backup from the device, and flash modifications, such as files to the device, essentially becoming a means to install software to the device. Recovery mode is separate from ‘normal’ mode, and can be entered by holding down home whilst turning the phone on. 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 ‘update.zip’. 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 of the phone (a hard wipe), or perform an update using an update.zip file on the root of the microSD card. It is common (although not necessary) to flash a patched Recovery image, such as TWRP or ClockworkMod Recovery. This allows you to run Nandroid backup from the device, and flash modifications, such as files to the device, essentially becoming a means to install software to the device. Recovery mode is separate from ‘normal’ mode, and can be entered by holding down home whilst turning the phone on.. 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.

No comments:

Post a Comment