THIS ONLY WORKS FOR MIUIV4, I WILL GET A GUIDE TOGETHER ON HOW TO PORT MIUIV5 WHEN I HAVE TIME

Out of popular request, I have made this guide on how to port yourself.

Credit for this goes to @mirGantrophy and @AdhvanIt. If it wasn't for either of them, I wouldn't know as much as I do.

Code:

First off, this will be made as noob friendly as possible
but we all know that there will be things that just can't be made noob friendly.
Don't ask for a "one click" for this it will never happen because
It's a manual process you have to do yourself.
I am not in any way, responsible if you brick.
You should have some knowledge as to what you're doing.
If you're not confident/comfortable doing this...
DON'T EVEN THINK ABOUT IT!!!

Any and all questions, please post in the thread. You're also more than welcome to PM me and I'll help as much as possible.

Now, let's explain what porting is.

Quote:

In the easiest terms I can put it.. It's just taking a ROM from your device as your BASE ROM, then finding a ROM on a different device that's the same build number. As in, 4.1.X won't work with 4.2.X. You delete certain system files in you base, and copy those same files you deleted from your PORT ROM. Compile, test, decompile, fix: repeat.

What you'll need:

Code:

PATIENCE - this is most important because it won't always work the way you want it too.
a working computer
apktool
smali/baksmali
Android Kitchen - I use dsixda's kitchen in the dev/hacking forum
a diff tool - I use Meld as it's the easiest to use
Android SDK or just ADB/Fastboot

Before we start getting into the thick. Let me explain how this will be set up. Our BASE ROM will be from our device(Evita). Our PORT ROM will be from another device other than Evita. I personally like to use Crespo(Nexus S) but this can be done wil any other phone.

Also, let's make sure we aren't trying to port TouchWiz/Sense onto AOSP/AOKP that just won't work. As much as you try, it won't.. And I will probably laugh at you if I find out you tried doing that... Make sure your porting Sense/Sense, AOSP/AOSP, AOKP/AOKP.

Now tha we have the BASIC port done... time to get into the nitty-gritty.

Here I won't be doing this in steps like I did the first part of this guide... Just because it's a little more "hands on" if you will.

Go ahead and open both WORKING_Folders
My set up, just as an example:

With this, you're moving files from left -> right

Navigate to /system/bin

Code:

compare both and see what's missing in BASE
move that over from your POR
Most of the time there isn't anything to move over,
but it doesn't hurt to check.

After that folder navigate to /system/etc/permissions

Code:

scroll through and compare file by file
move over the ones that are in your PORT to your BASE

After that, if your PORT and BASE both have init.d support it wouldn't hurt to move those files over as well. If there are any to move.
Now to move on to /system/lib

Code:

This one will be the most time consuming...Your ROM won't boot if your missing some libs!!!!
So make sure your being as careful as possible to look at each file.
The ones that are in your PORT and aren't in your BASE
move those over.

I know that one was a little rough on the eyes but, we're almost done. Hang in there.

Last one, /system/xbin

Code:

delete the su binary from your BASE
move the one from your PORT over.

Now, ladies and gentlemen... This is your BASIC port. You still need to diff the framework.jar and services.jar. That's with the help of logcats. I'll walk you through those when you come around to it.

This ROM, by far, is the hardest to port from any device. Mainly because it's unlike any other AOSP/AOKP ROM out there. There are certain binaries that you need and without them, your port WILL NOT boot, period.

Code:

First, pick what ROM yore porting. SENSE base MIUI or a NON-SENSE MIUI.
If you decide to use a SENSE based MIUI, use a stock SENSE ROM.
If you choose a NON-SENSE MIUI, use an AOSP/AOKP base.
It will work with either one.
If you're porting from another device to EVITA,
use cm10 for AOSP or Rohans AOKP.

If you decide to port MIUI, work through the first part of my guide. Then follow what's below.

Navigate to /system/bin
Pull the installd binary from MIUI and put it in your base

Navigate to /system/xbin
pull the shelld binary from MIUI and put it in your base
same with the invoke-as binary

Navigate to /system/lib
There are 4 libs that are specific for MIUI, make sure you have them in your base.

Remember I told you not to mess with symlinks? Well.. You need to if you have SU problems...
put this line into your Updater-script

Code:

symlink("/system/xbin/su", "/system/bin/su");

paste it somewhere after

Code:

symlink("busybox"[big code bunch like "/system/xbin/etc]

but before

Code:

Unmount("/system")

Logcat showing something to the effect of "failed to initialize shell service?
That would be a shelld problem..
Use the Android kitchen to break down your boot.img in your base into the ramdisk and zImage(kernel)

In the ramdisk there is a file called init.rc
Open with a text editor
At the very bottom, paste these lines:

Code:

service shelld /system/xbin/shelld
class main

Then.../dance.
You now have a working MIUI port, bugs are your only issue now.

XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality.Are you a developer?