[GUIDE] How I port

rukin5197

Well-known member
May 26, 2011
1,105
628
0
Visit site
Okay, so there have been many many many requests on porting ever since I've ported things. Instead of getting requests all the time to port things, I'm going to give you my knowledge on porting. Sorry if it is scrambled everywhere, but I like to get off topic a lot :)

First of all, you're going to need to know a zip file inside and out. That means what all the files mean, especially the .so files. These are a matter of boot or not on a ROM.

Second, of course, you're going to need to know obviously which version of the ROM you are trying to port. So if it is a GB ROM, try to use CM7 as your base. Or even our new AOSP gingerbread (thanks redbaron :D)

Third, there's three folders in a zip that are the most important ones you're going to deal with. The apps, frameworks, and media folders. These are what makes the ROM (especially themed ROMs) so cool. All the features, options, etc.

Fourth, patience and adb are going to be your best friends. If it doesn't boot, you're going to need to read the adb to see the problems and patience, because a lot of pulled batteries are going to be needed in these situations.

Fifth, I'm going to be referring to the ROM you are basing it off of, be it tdm's CM9, any of the IHOs, as BASE. I'm going to be referring to the ROM you are porting as PORT. Just to simplify things and not let things get a little confusing.

So, if you're wanting to port a regular ol' CM7 themed ROM from another phone, you're going to do this -
Delete the apps, framework, and media folder from BASE. Replace them with the folders from the PORT. Then it should boot.
If it doesn't boot, there's usually one .so file in /system/lib that determines boot or not. That file is 60% of the time libandroid_runtime.so. Delete it from BASE and replace it with PORT.

That is a plain port. Simple.

Now, for CM9, there is a little bit of a difference. There are two important files located in BASE in /system/media called LMprec_508.emd and LMprec_600.emd that are VERY important. Without these, I couldn't get MIUIv4 to boot. It took a little while to figure this out, lol. So just make sure when you port CM9 based ROMs that you have the originals in there.

Now don't go off thinking you can do this with just any ROMs. There are limits. For example, you can't port Sense, TW, MotoBlur, or any other ROMs that big for that matter. If it is based off of CM7, then you can port it. If it is based off CM9, then you can port it.

Remember- This isn't full proof. I have encountered problems with CM9 based ROMs with this method (phone FC) and a few other problems with other ROMs.

Some fixes I've run into that might be note worthy
For LeWa, for data, I've had to replace the apn.xml from the framework-res.apk (/res/xml). from BASE to PORT
For MIUIv4, for phone FC, I had to decompile the framework.jar in /system/framework (for both BASE and PORT) and go to com/internal/android/telephony/cdma and replace all the files with the ones from BASE.

For 99% of ROMs
To fix MMS on almost all ROMs, you're going to have to do this:
decompile the framework.jar (use apktool), go into the folder I mentioned for the phone FC fix for MIUIv4, and replace a file called CdmaSMSDispatcher.smali with the one from the BASE.

Now hopefully this causes two things:
-More of an option of ROMs available
-Me stop getting requests ;)
Happy porting :)
 
Last edited:

rukin5197

Well-known member
May 26, 2011
1,105
628
0
Visit site
For the Hardcore advanced wannabe porters only!
I thought that I would throw this guide in here because I made it for another person and it somewhat belongs. I made this for a person porting Sense to the Triumph and thought some of you could contribute. You could most likely use this to port ROMs such as Sense, TW, MotoBlur, etc.

How to port Sense.
This is a very difficult process that I hope you'll understand.
First step is to find a device that is preferably VERY similar to your device, in this instance I guess we would use the htc thunderbolt, which I've been told multiple times that it is used for the MT.
You're going to want to use CM7 for parts. Simple enough.
I will be referring the Sense ROM to SENSE and CM7 as BASE to simple things up. So remember that.

When I say replace, I would recommend deleting from one and adding it with the other

Open up Sense and Base in different windows.
Put in the boot.img from Base into Sense (make sure you put the original boot.img in some other place that you'll remember)
go into /system/usr on both
replace keylayouts and keychars from Base into Sense (this is just your keys)

download dsixda's kitchen (http://forum.xda-developers.com/showthread.php?t=633246)
Get the ROM you have so far set up in it and what not (I'm a little fuzzy at this part)
Once you get done with that, run the menu in terminal and navigate your way to decompile the boot.img (action key- "a") and then run the same thing except run the action key "w" to decompile the original boot.img. So the key here is to decompile both boot.img's.

Go into the ramdisk on both and go into init.rc
THE MOST IMPORTANT PART IN THIS (THE MATTER OF BOOT AND BOOTLOOP) IS THE LINE
"export BOOTCLASSPATH" near the top. It will have a bunch of lines after it. Now in the Base's boot.img, delete this whole line. Replace it with the lines from Sense's boot.img.
Now you can add anything else you want that looks like it belongs (preferably anything sense related)
Don't recompile the boot.img yet.

Now we add a2sd. To do this, just follow this guide (https://www.facebook.com/note.php?note_id=158823170833688)
The only thing you do in there is the edits to the init.rc, don't listen to the decompiling/recompiling mentions. Now you can go back into the menu for the kitchen and recompile the boot.img (action key - "b"). Now don't compile the WHOLE ROM, just take the new boot.img in working_** and put it into the Sense zip.

Now you're going to want to download my ROM (sorry, just don't feel like uploading each individual file) http://gannon5197.blogspot.com/2012/03/got-sense-booted.html
And go into the /system/bin on both
these are the files you're going to need: a2sd, bash, apps2sd.hlp, busybox.a2sd, chka2sd, jita2sd, launcha2sd, starta2sd, and maybe possibly sh (try once without it)
And you're going to want to set permissions for each one of these in the updater-script (look at mine for references)

Now also look at my zip and you'll see move_cache_sd. Put that in yours and set permissions for it in updater-script (use mine for references)

After that, the other stuff is mainly just getting rid of all the bloatware, (look in /system/app and /system/media) I wouldn't delete any libs as of right now. If you try to flash it and it reboots recovery then it is too big.

If it is too big, you're probably going to want to move a lot of the apps to data. To do this, just make a file called data/app/put_your_apps_here on the root of the zip. You're going to have to set permissions for it in the updater-script, but use the test.zip I sent you in the original.

This will most likely get you booted. Nothing will likely work. Which is expected. If you have any problems, just use logcat. It will be your bestfriend. Have fun porting :)
 
Last edited:

arnold1997

Well-known member
Jan 12, 2012
693
117
0
Visit site
is it possible to port the sense 2.1 gingerbread from galaxy ace lol im going to see if it can be done

Sent from my LG-VM670 using Tapatalk 2 Beta-5
 

cole2kb

Retired Moderator
Apr 7, 2011
2,503
547
0
Visit site
I'm not a dev, but I'd like to add that anyone who ports something please think VERY hard before posting / releasing it. Be prepared to support it, be as detailed as possible about problems / issues and realize the responsibility you undertake by distributing software for others to use. Yes, it's their choice, but there are those who flash blindly.
 

kcls

Well-known member
May 5, 2011
901
307
63
Visit site
I'm not a dev, but I'd like to add that anyone who ports something please think VERY hard before posting / releasing it. Be prepared to support it, be as detailed as possible about problems / issues and realize the responsibility you undertake by distributing software for others to use. Yes, it's their choice, but there are those who flash blindly.

Yup, I agree with this 100 percent. I really, really don't want the Optimus V forums to be more cluttered then they already are with ROMs people port and then don't support. Even worse, one that has bricking abilities. Then we'll get 50 more "Help I've bricked my phone with [such and such's unsupported ROM]"
 

olmos.lalo

Well-known member
Nov 11, 2010
112
3
0
Visit site
So can we use the cmdasmsdispatcher trick to fix mms on ics roms for the v and s? Would switching it out from CM7 work? Or from another CM9 Virgin phone like the triumph?:D?
 

rukin5197

Well-known member
May 26, 2011
1,105
628
0
Visit site
I'm not a dev, but I'd like to add that anyone who ports something please think VERY hard before posting / releasing it. Be prepared to support it, be as detailed as possible about problems / issues and realize the responsibility you undertake by distributing software for others to use. Yes, it's their choice, but there are those who flash blindly.

Oh I agree as well. I'm just trying to teach the community to help them become better. These guides are obviously noob proof, and not just anybody can do it. Although I was a little specific.. lol.
If it turns for the worse I can just take down the guide.
But after all, this is where I started so maybe others could blossom from this?
 

rukin5197

Well-known member
May 26, 2011
1,105
628
0
Visit site
So can we use the cmdasmsdispatcher trick to fix mms on ics roms for the v and s? Would switching it out from CM7 work? Or from another CM9 Virgin phone like the triumph?:D?

I haven't tried that but I wouldn't think it would work. But the Triumph thing was brought up before, I don't remember if it worked or not.
 

olmos.lalo

Well-known member
Nov 11, 2010
112
3
0
Visit site
Hmm I tried last night but I couldn't get the damn jar to sign. Don't know why (using apktool) But Btw Thanks For This! Im a complete noob and I already ported the newest LeWa from O1 :) Thanks a lot!
 

rebel69ization

Well-known member
Jan 23, 2012
501
106
0
Visit site
Gannon, if you can port it ill try it. I'm not scared, I just like seeing the different systems and such on a phone that's not supposed to have them. Thanks for all you do for us.:)

tappin',talkin' from my ov
 

Trending Posts

Forum statistics

Threads
943,141
Messages
6,917,483
Members
3,158,838
Latest member
jm_rookie2