[TEAM XPOSED] [Guide]9/21/11: How to dissect a ROM and mod it to your satisfaction.
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)
or something that can handle files encoded in UNIX)
SignAPK/APK Manager/APKTOOL/smali/baksmali (optional/advanced)
Common sense (can't stress this enough)
-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.
-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.
: Please keep the original archive, do not delete it after extracting.
Navigate to the /system folder, which again should look similar to this:
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.
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.
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.)
: 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.
--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.
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)
-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.
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.
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:
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.
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:
-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.
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:
-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...