Ads Top

Guide to Build Android custom rom.


Custom ROM-the word that instantaneously comes to the mind of an android user when he thinks of modifying his smartphone.Now, the process has become a lot more easier with custom ROMS gaining more ground.So, here is a kind of tutorial by which you can make your very own custom ROM even if you are a newbie.
Prerequisites 
  • Notepad++
  • WinRar or any other zip/rar manager like 7zip or WinZip
  • If you want go advanced,you would also need these things
  • Cygwin
  • Smali/Baksmali
  • APK Multi tool
So,first up,download a rom of your choice(Dont forget to get the permissions for modding from the developer) and extract it.When you extract it,you will see 2 folders and 1 file,it varies.It depends on the contents of the rom.
The folders are:
1.META-INF
2.system
The file:
1.boot.img
So,
Open up system and the first folder you are going to see is ‘apps‘.
As you already see,this is the place where all the apps go,for the history.You might also see some .odex files below the apps.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.Also,if you delete contact.apk and replace it with a better dialer like Exdialer,you wont be able to add or delete contacts.So,there are some files better left alone.
If you want to know how to merge them,then use google,there are a lot of tutorials on deodexing.If you want to edit an app,then use APK multi tool,again please use google,lots of tuts on this one too.
Also,you will find an app here and its a main one,systemui.apk By editing systemui.apk,you can get transparent status bars,transparent notification bars,centre the clock.Things like that.The idea with which you edit Systemui.apk and framework-res.apk,thats how your rom is going to look like.These files handle the visual things and they are awesome too.For some systemui mods,refer HERE
Now,some apk files are lib-dependent,meaning,they need certain lib files to work,a few examples are,Swype keyboard,now,swype wouldnt work if this lib file is not included in the rom,libswypecore.so,so if you remove swype,remove this lib file also,because its just a wastage of space and it doesnt do anything.Another example is DSP Manager in Froyo,in GB,it works native,no need to add any applications,but in Froyo,if you add DSP Manager,there are a few lib files that you should add to get them to work.
Next,the ‘bin‘ folder,this guide is aimed at the noobs,so nothing about this,this is a bit advanced stuff,so sorry.
Next up,the ‘etcfolder.There are a lot of things that go here.I wont be going to full details for the moment because i am having exams,so no time.However,i will be explaining the easy to explain files.
One thing you will notice is the ‘init.d’ folder.If you want to add any script like LagFree v2,just put the files of the init.d folder in the script’s folder here,nothing else.You dont need to copy any other files like META-INF.
Another file,is CHANGELOG-CM,just as the name suggests its a file giving you changelogs
Another file is NOTICE.html..Its just a file showing copyrights and all that stuff.You wouldnt need to edit that,would you?
Will add more about the other files soon
Next,the ‘fonts‘ folder..You guys need an explanation for that??
Next,’frameworkfolder.Here you will find framework-res.apk(Obviously,duh…).I wont tell about any other file because this is aimed at new users,not advanced guys.Framework-res is where all the icons in notification bar are.The battery icons,they are all in framework.Also,lockscreen icons
go here..Most of the icons.If i have to start on anything.It would take me weeks,theres so much to write about framework.Also take care not to mess up the framework.Because its like the skeleton(thats what i know ) of a rom.If a framework is incorrectly configured,the rom wont boot.So,keep that in your mind always when you edit framework.
Next,the ‘libs‘ folder,This guide is aimed at newbies,so not touching this part.
And comes ‘media‘..Most probably you will find 2-3 folders here.Audio,bootanimation.zip and wallpapers.
If you want to change the default,its in build.prop,not here,i will explain that later.If you need to add some audio,its just drag and drop,nothing much,just put them in the right folders,like alarms,ringtones and notifications
If you need to add wallpapers,reszie the pictures to 640×480,thats the resolution that works for ace.Also resize it to 107×80 and save it as another pic with a _small at the end.For eg,the default file is defaultwallpaper.jpg,you make another pic with 107×80 called defaultwallper_small.jpg.
Then,theres the bootanimation.zip..However way you change this thing.Always name it bootanimation.If you want to know how to make a boot animation,then refer freeyourandroid.com
Next up is ‘tts‘ folder..Sorry but i dont know much about this folder.I think this folder contains the languages for the tts app but i am not sure about it.Same goes for ‘usr’ and ‘wifi’ folders.But since this thread is aimed at newbies,i dont think there wouldnt a point in writing them up anyway
Next up is build.prop file.Open it with notepad++…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,that particular tweak is not running,so you can take out the # if its a tweak you like.You could also use it say things like,Additional build properties.You could make it #AdditionalBuildProperties and go to the next line and give your tweaks there.Some build.prop tweaks can be found in slaid480′s thread in Galaxy Ace S5830 titled “[MOD]Build.prop tweaks for SGA” or you can go to freeyourandroid.com and find some tweaks there,however the tweaks listed there are universal,so practise caution when playing with build.prop
Now to boot.img..Theres an awesome guide about this in freeyourandroid.com Please have a look at it,because there are lots to write about this one.This is where Cygwin comes in,for instructions on unpacking and repacking and commands and info about boot.img,referHERE and HERE.My summarized version,boot.img is where you can replace kernels.This is where you can make those low-level changes
Then,to META-INF folder.You would find lots of folders here but the file that you would edit consistently is update script.Find it and open it with Notepad++..Unless you edited xbin and bin files,this is not hard to do..Just change around ui_print to what you like.Dont touch anything else if you dont know what you are doing.If you DID edit xbin or bin files,you would need to touch advanced things like symlink tagged ones(I had to give them some sort of a tag)
Updater-Script References and notes:
Now,the updater-script is not something that you should mess around with,a single line of error in the script could get you in trouble.You might also have heard these words,Amend and Edify and wondered what they are,well Edify is the language with which Updater-script is written,while Amend is the language with which Update-Script is written.Now,As far as i know,Ace does NOT support Update script,it just supports Updater-script,so if you are working with kitchen,dont forget to swap the files in META-INF with the the updater-script provided by ketut.kumajaya in Blackhawk thread.So,you should learn to study updater-script of roms and patches before you mess around with them,especially patches here…Now,for example,I made a GPS patch that replaces hw folder in CyanogenMod with my patch.Now,i tell the updater script to delete the hw folder in lib and make another one and put my files in there,you,a normal user will flash it and it would work,but a rom maker without seeing that i have told the updater script to delete hw folder,adds my lib files to the existing lib files,which causes the rom not to boot.So,study the updater-script of patches and see what they do before you jump in and start doing things your own way and mess things up.I will write down a few updater-script commands here and what they do for your convenience now.Here you guys go with it:
mount-mounts a filesystem
is_mounted-checks if a filesystem is mounted
unmount-Unmounts a filesystem
format-format a filesystem (duh..)
delete-Deletes a single file
delete_recursive-Deletes a folder and all of its contents
show_progress-Display flash progress
package_extract_dir-Extract all the files present in a directory to a specified directory
package_extract_file-Extract single file from directory to specified target
file_getprop-dont know much about this one
symlink-Unlinks any existing symbolic links before creating the new symbolic links.
set_perm-Sets permissions for a file,note you dont write rw-r-r here.Its the numbers,for example,for root access,you write 777(right?),not anything else
set_perm_recursive-Sets permissions for a full directory,for example,if you specified a folder,permissions for the folder and all files in it will be set.
getprop-This function returns the value of the property specified. This is used to query platform information from the build.props file.
write_raw_image-Writes a raw image into a partition
apply_patch-Applies patches to a directory -_- (dont you guys understand it just by reading that? )
apply_patch_check-Checks if a file can be patched or if they have been patched
apply_patch_space-Checks if there is enough space to apply a patch
read_file-Reads contents of a file
sha1check-If only data is specified, then the function returns the sha1_hex string of the data. The optional parameters are used if you want to verify that the file you are checking for is one of a list of hashes. It reutrns the hash it matches, or returns nothing if it doesn’t match any of the mentioned hashses.
ui_print-It outputs a message to the users while flashing.So,if you see something like ‘This is so awesome’,know that its not such a big deal and that its just a line of editing here
run_program-Runs a program
ifelse-This is the if-then construct of the Edify scripting language. The truecondition or falsecondition arguments can be a single edify command or a script block. Script blocks can be formed by enclosing the parameter with parenthesis, and seperating the commands with semicolons
abort-duh..it aborts script execution
assert-If condition evaluates to false, stops script execution, otherwise continues processing.
Thats it,dont worry after seeing all these commands.You wont see them all in most of the roms.Here is a list of commands that you usually see in a updater-script.
ui_print
mount
unmount
delete
delete_recursive
package_extract_directory
symlink
show_progress
set_perm
set_progress
set_perm_recursive
getprop
run_program
assert
Now on making it a flashable zip,archive them to a zip file.Get a signer here
NOTE:Signing is not necessary
The instructions on using that are given with it.Just rename it back to the name you like after signing it.


Hope this tutorial helped you all and i see you very own custom ROM @ xda soon..!!!
Powered by Blogger.