Post Reply

[TEAM XPOSED] [Guide]9/21/11: How to dissect a ROM and mod it to your satisfaction.

2nd August 2011, 07:20 AM   |  #1  
freeza's Avatar
OP Recognized Developer
Flag Pasadena, CA
Thanks Meter: 9,730
4,273 posts
Join Date:Joined: May 2006
Donate to Me
Hi guys, I'm back again with somewhat of a guide.

How to dissect, repackage, and flash a ROM to your satisfaction without a kitchen!

Don't let anyone else fool you. The awesome devs at XDA, one in particular dsixda have made making ROMs very easy with kitchens. But you don't need to go through the process of installing and using one to get a ROM the way you want it. If installing and working with a kitchen seems too cumbersome and/or hard, or you're tired of waiting for or asking your ROM chef to include/exclude/change a feature, then this guide is for you.

ROMs aren't scary things, they're actually quite simple in terms of structure. As long as they're built correctly from the get go, you will learn how to mod it to suit your needs.

Tools needed: (most of which will be included in this guide)
A base ROM (start with your favorite)
WinRAR (or any good archiver)
Notepad++ (Recommended or something that can handle files encoded in UNIX)
SignAPK/APK Manager/APKTOOL/smali/baksmali (optional/advanced)
Common sense (can't stress this enough)

Step 0:
-Start with a clean working environment, such as a folder or partition dedicated to this task. Your desktop probably won't be very good if you have a lot of stuff on it already.

Step 1:
-Using the archiver of your choice, you will need to extract the ROM to the work environment you've set up in Step 0.
--Your final result will look something similar to this:
NOTE: I am using my ROM as a reference.

Most ROMs will follow this structure, with some utilizing the folders "sdcard" and possibly others, depending on how customized they are. But as long as you have the /system folder, you will be fine. It is where you will probably spend the majority of your modding time. Get a feel for how the folder structure is. Navigate through them (don't make any changes). This guide will focus mainly on removing and adding apps, the more advanced stuff such as editing text files (with the exception of build.prop) and apks may come later.

NOTE: Please keep the original archive, do not delete it after extracting.

Step 2:
Navigate to the /system folder, which again should look similar to this:

Step 3:
The first folder we'll focus on is app. This is one of the most important folders when customizing your ROM. It will look something like this:

This folder is important because it houses your 'system apps', which are included in your ROM and cannot be uninstalled by traditional means. Here you can remove or add your own apps you want to include as system apps. Remember that not all apps are capable of running as system apps--actually, apps that are placed in this folder receive a higher permission level than apps that are placed in /data/app, so use caution when adding your own here. I would also suggest creating a "removed" folder [in a different location] and move any apps you decide to take away to here so you'll have them in case you remove something that causes a side effect you weren't intending to cause. If you feel comfortable with your WinRAR or 7zip skills, most of the images in these apks can be simply overwritten (this is initially how themes are created, among other ways). Be careful not to overwrite any 9.pngs because they are a special format. You can simply explore (not extract) them with your favorite archive program and replace images as you find them, which will typically reside in the res/drawable and res/drawable-hdpi folders.

Step 4:
Next up is the bin folder. This folder is very tricky and I would advise caution against removing anything that's currently in here unless you get real familiar with the contents of this folder. It will look something like this:

Most ROMs will include all the necessary scripts you will need in this folder. However, it doesn't hurt to familiarize yourself with it. Scripts such as bash and even sometimes busybox, can be installed here. If you're working with a very stock ROM, and I mean stock as in the only thing that was changed is adding root, then it wouldn't hurt to add bash here, other than that, let's move on.

Step 5:
Here we have the customize folder. This folder is pretty important as well. It holds all of your first boot activities and pretty much sets your phone up after you've flashed and/or updated ROMs. It looks like this:

Things start to get more involved and interesting around here. You'll notice three sub-folders inside of here, which house various customization scripts. To be honest, I'm not even sure how many of these get ran, but I'm almost positive the ones labeled "default" do get ran. Here's where Notepad++ will finally start to come in handy! If you're looking to do quick editing, then you can open any one of these xml files in Notepad++ and poke around. (For advanced script editing, I would suggest looking at the appropriate Android documentation. I'll see if I can get a link to that up.)

NOTE: Be VERY careful of what you remove from these xml files, the syntax has to be perfect, otherwise the script won't get initialized. I would suggest copying everything you intend on editing to another folder of the same name, in a different location of course, so that you can have copies. True beginners should not attempt editing any files in here until you familiarize yourself with their syntax.
Folder structure:
--cidProfile1.xml: I don't think this file gets parsed. However, I do take the time to remove language settings that I will never use, just for my own OCD reasons.
--cidProfile2.xml: I don't think this file gets parsed. However, I do take the time to remove language settings that I will never use, just for my own OCD reasons.
--default.xml: Settings such as screen timeouts, IME language settings, etc gets parsed here. Nothing of too much importance. However, I do take the time to remove language settings that I will never use, just for my own OCD reasons.
--default.xml: This is probably the single most important file in the customize folder. Here houses most, if not all the first boot settings that get parsed, such as widget placement, bookmarks, and a whole plethora of other settings. This is a very fun and interesting file to edit, but again i heavily caution you to edit this file if you're a beginner. One simple mistake can lead to nothing getting parsed here--a mistake I've made a few times because of incorrect syntax.
-resource: This is probably the second most important folder in the customize section. Here lies all of the thumbnails and wallpapers for Sense. If you are planning on removing Sense, you can safely remove all the files here with the exception of CCInfo.txt. You can also replace the images as well as boot/power down animations here.

Step 6:
Ah, the etc folder--you'll spend probably no more than five minutes in this folder unless you're truly advanced, which means this guide is probably meaningless to you. It houses a lot of useless epub (ereader) books and looks like this:

If you have time, you can definitely do some exploring of files in here with your favorite text editor (Notepad++) and see if anything is of significance. If you find something, please report back! So far, I don't think very much, if anyone takes advantage of the actual files in this folder (the folders are a different story)
Folder structure:
-bluetooth: nothing to see here. bluetooth configuration files. could be useful down the line.
-dhcpcd: looks like configuration files for dhcp/dns/internet. could be useful down the line.
--dhcpcd-hooks: same as above
-fakeserverxml: This folder looks strange, even has a strange name. I assume if you're removing Sense, this won't be needed either. I'm not even sure it's needed WITH Sense. Poking around revealed some configuration files for what appears to be HTC Hub and scenes, widgets, skins, and other things.
-firmware: I wouldn't touch anything in here unless you know exactly what you're doing.
-init.d: Finally, something that matters! A lot of ROM chefs make use of this folder because it initializes scripts in here upon system boot. You'll see various things in here from various ROMs including: zipaligning, overclocking, kernel stuff, apps2sd, and more. If you know what you're doing, you could even drop your on initialization scrips into this folder and have them boot with the system. Be careful what you do in this folder though. You want to make sure you are following the correct set of steps to either add or remove things. I would poke around with a text editor at those files to see any dependencies, etc.
-iproute2: Nothing here for the average user.
-permissions: If you're removing Sense, without any intent on having it return, remove the relevant files from this folder as well. Other than that, let's move on.
-ppp: Nothing here for the average user.
-security: Nothing here for the average user.
-slideshow: Safe to get rid of. Inside are pictures that Sense uses as a slideshow.
-soundimage: Nothing here for the average user. However, things in here look promising for sound enhancement!
-terminfo: Nothing here for the average user.
--l: Same as above
--u Same as above
-updatecmds: Nothing here for the average user.
-wifi: Nothing here for the average user. However, you may be able to replace the wpa_supplicant file with a modified one for WiFi improvements.
-wimax: Nothing here for the average user. However, the files in the sub-folders here may be used in the future to enhance or modify WiMAX.
--dhcp: Same.
--sequansd: Same.
Before we move on, if you're going to use any sort of adblocking, your preconfigured hosts file should go here. Downloading ad-free from the market will overwrite this file when updating hosts, but if you want to supply your ROM users with a hosts file already somewhat updated, you can place that here. Looking at the various .sh/txt/csv/cfg/* files in Notepad++ will show you some defaults you can change, if you're comfortable in your editing skills, take a look at some of them and see what you can do. Not even I have bothered to look through most of these.

Step 7:
In and out like a robbery for this folder, "fonts", which houses the default fonts that Android uses for various things. I like to replace the clocktopia (which is used on the aosp lockscreen as the clock font) with the honeycomb clock font. Other than that, fonts replaced in here must retain the Android naming structure:

Step 8:
The framework folder is very...sensitive aka dangerous. Deleting or modifying the wrong thing in here can render your system unbootable. Until you're more seasoned in modifying ROMs, I would steer clear of this folder. However, the framework-res.apk file can be used to modify a lot of images to change the look, or "theme" of your ROM. So again, if you feel comfortable, fire up that archive program and get to replacin', otherwise let's move on:

If you're anything like me (anal) then you will wanna remove anything from the framework folder that has anything to do with apps you've removed. For instance, there is a blockbuster file in here that you can safely remove if you've removed the blockbuster app. Again, be careful with what you modify or remove from here, because your system can quickly become unbootable which will leave you wondering what happened.

Step 9:
The lib folder, like the framework folder, is very sensitive aka dangerous. Deleting or modifying the wrong thing in here can render your system unbootable. Until you're seasoned in modifying ROMs, I would steer clear of this folder. However, there are a few things that can be done in here if you've deleted other apps:

Folder structure:
-bluez-plugin: nothing here for the average user.
-egl: nothing here for the average user.
-hw: nothing here for the average user.
-modules: This is where kernel modules for things like WiFi/WiMAX/TUN/CIFS/ETC go. If you are modifying a ROM, and are including a kernel, be sure to delete what's here, and add the modules that came with the kernel. Not doing so will more than likely make its associated parts not function. Example: Error starting WiFi can usually be traced to wrong modules in this folder after updating a kernel.
-plugins: This folder houses plugins for different preinstalled apps. For instance, the Adobe Flash plugin would be here, but if you remove Flash from your ROM (since you can get it from the market and may be more updated than what was included) you should remove its associated files. I wouldn't remove the flashlite plugin though.
-soundfx: nothing here for the average user.

The lib folder can be very overwhelming from the sheer number of files in here but the majority of them will have little of no value to the average user. BUT, you should definitely check here if you are removing any system apps for associated lib files. For instance, Swype is included on HTC's stock software, and if you remove it from the /system/app folder, you want to come here and remove its associated lib file. There won't be a lib file for every program you remove, but it's good to double check here afterward to make sure you get all traces of it gone.

Step 10:
The media folder, probably the easiest folder ever, and least time spent in here. This folder controls all the built in audio sounds such as notifications/ringtones/etc as well as any other media related files, like video clips, images that would indicate an animation, etc:

Folder structure:
-audio: parent folder for system sounds.
--alarms: self explanatory.
--notifications: self explanatory.
--ringtones: self explanatory
--ui: self explanatory
-GPU: nothing here for the average user. Not sure what it even is for.
-mms: nothing here for the average user. Not sure what it even is for.
-weather: This folder isn't really of any use, but it does contain weather animations that the HTC weather app uses. If by some reason you want to edit, replace, or modify those animations, here they are. I would suggest placing files of the same resolution in here.

Be sure to place the files you want in their respective folders, because they won't show up when you try and select them for things they aren't intended for. For instance, placing notification sounds in the ringtones folder will make them not show up when you go to choose a notification sound from within Android.

To be continued...
Last edited by freeza; 21st September 2011 at 07:24 AM.
The Following 92 Users Say Thank You to freeza For This Useful Post: [ View ]
2nd August 2011, 07:28 AM   |  #2  
hockeyfamily737's Avatar
Recognized Contributor
Flag Connecticut
Thanks Meter: 2,817
2,240 posts
Join Date:Joined: Apr 2011
Donate to Me
Now that this guide is progressing nicely, below you will find a list of items that I have removed or replaced. This list will be edited as I make further adjustments. For the sake of consistancy, I too am working with Freeza's rom FreEVO 3D 1.1, which can be downloaded from this same subforum. Please keep in mind that this list is based on my particular needs and is heavily dependent upon which custom rom you choose to modify.

-Here's what I've removed from /system/app

-Here's what I've removed from /system/customize/resource

-Here's what I've removed from /system/media:
-The entire /weather folder from /system/media .
-All unused ringtones (all but 2) from /system/media/audio/ringtones
-All unused notifications (all but 3) from /system/media/audio/notifications
-All unused alarms (all but 3) from /system/media/audio/alarms

I should also mention, not only can you remove these, you can also replace them with any .mp3 file you like. So in theory, you could remove every .mp3 from these folders and put your own .mp3 files in.

After removing all of the above contents from Freeza's rom, the flashable zip size has gone from 307MB to 168MB. This should just about conclude my list of removed .apk's and files from Freeza's rom. After a little more testing, I'll move the "to be tested" .apks into the list of safe to remove .apk's, and finally begin theming this thing

Congratulations on taking the first step towards customizing your rom. More information to follow as I further refine this rom. Happy flashing!
Last edited by hockeyfamily737; 11th August 2011 at 08:20 PM.
The Following 26 Users Say Thank You to hockeyfamily737 For This Useful Post: [ View ]
2nd August 2011, 07:32 AM   |  #3  
freeza's Avatar
OP Recognized Developer
Flag Pasadena, CA
Thanks Meter: 9,730
4,273 posts
Join Date:Joined: May 2006
Donate to Me
Originally Posted by hockeyfamily737

Nice tutorial. I'm sure lots of people will find it helpfull when it's finished.

You keep giving me good ideas lol
The Following User Says Thank You to freeza For This Useful Post: [ View ]
2nd August 2011, 07:58 AM   |  #4  
x4sper's Avatar
Senior Member
Thanks Meter: 86
280 posts
Join Date:Joined: Jun 2010
excellent! going to utilize this
The Following User Says Thank You to x4sper For This Useful Post: [ View ]
2nd August 2011, 08:27 AM   |  #5  
Bamba1260's Avatar
Senior Member
Flag CO
Thanks Meter: 203
757 posts
Join Date:Joined: Jun 2010
Donate to Me
Can't wait for this to evolve. I have been looking for a good place to start.
The Following User Says Thank You to Bamba1260 For This Useful Post: [ View ]
2nd August 2011, 12:53 PM   |  #6  
THunDA's Avatar
Senior Member
Flag Suffolk County NY
Thanks Meter: 356
953 posts
Join Date:Joined: Feb 2008
very cool, looking forward to this!
The Following User Says Thank You to THunDA For This Useful Post: [ View ]
2nd August 2011, 01:24 PM   |  #7  
jrmatics's Avatar
Senior Member
brooklyn, ny
Thanks Meter: 63
648 posts
Join Date:Joined: May 2009
Thanks. About time for me to get into this)

Sent from my PG86100 using XDA Premium App
The Following User Says Thank You to jrmatics For This Useful Post: [ View ]
2nd August 2011, 01:28 PM   |  #8  
SwaggaSnatcha's Avatar
Senior Member
Flag peoria,il
Thanks Meter: 21
129 posts
Join Date:Joined: Aug 2010
Thank you very much for this noobs like me will learn a lot
The Following User Says Thank You to SwaggaSnatcha For This Useful Post: [ View ]
2nd August 2011, 01:54 PM   |  #9  
st0921's Avatar
Senior Member
Flag SF Bay Area
Thanks Meter: 75
329 posts
Join Date:Joined: Jun 2010
I'm gonna reserve my weekend to go through this once complete.
Thanks for your time and effort for the tutorial in advance.
2nd August 2011, 02:05 PM   |  #10  
LouRock's Avatar
Senior Member
Flag Boston MA\San Juan PR
Thanks Meter: 539
1,161 posts
Join Date:Joined: Apr 2011
Been waiting for a "how to" tutorial on this specifically.

looking forward to it..


The Following 2 Users Say Thank You to LouRock For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Top Threads in EVO 3D CDMA Android Development by ThreadRank