Results 1 to 20 of 41
-
04-15-2012, 12:00 PM #1
[CASE STUDY] Porting v4 to the Nexus One

Porting the Nexus One (Passion)
Since there is no exact formula to porting v4, at least not one that works across all devices, I'm going to use specific devices as examples to give you a feel for the steps required to port your device. I'm starting off with the Nexus One since it was the easiest device to port from the ones I own. So let's get started.
Gather your tools
First thing you need to do, if you haven't done so already, is get the tools needed to get the job done. Lucky for you I've already covered that in this Getting Started guide.
MIUI v4 Base ROM
Next thing you are going to need is a MIUI v4 ROM to use as a base. As more devices are ported over, your choice of bases is going to increase as well. A good rule of thumb is to pick a device that best matches the one you are working on. You will want to do some research to see which ones match the closest. I try to find ones that match the processor as I have had less issues going this route. Since I did not have the luxury of choosing a device that matched well, I used the only one available at the time which was the official MIUI port of the Nexus S, aka crespo.
AOSP Based ICS ROM
You are going to need some device specific files and to get those you will need to have an ICS based port for your device. Without this you are not going to have much luck getting v4 ported over. For the nexus one, I have been using the ICS port done by the Evervolv team. These guys have been busting their asses to get ICS running decently on the Nexus One's old hardware and they have done a hell of a job.
Now that I've got that all out of the way, let's start having some fun! First we need to setup a folder to work out of and get our base ROM and ICS ROM extracted.
- Create a working folder for your device. In my case I created one called passion.
- Create a folder named miui and extract the MIUI base ROM you are using.
- Create a folder named ics and extract the AOSP based ICS ROM for your device.
It is now time to get started with the actual porting of v4. For this we need to copy some folders and files from the AOSP ROM folder over to the MIUI folder. Let's start out with a simple list.
- META-INF (entire folder)
- boot.img
That's the easy stuff, so now let's get to the more complicated parts where we need to be a bit more selective about what to copy over. We are going to be copying files and folders from the system of the AOSP ROM. I'll start in alphabetical order for the folders, starting with app and ending with xbin. This is where using something like Beyond Compare will come in handy so if you haven't downloaded and installed it already, do so now.
app
Leave this one alone
bin
Copy everything from this folder except logcat, logwrapper and su
etc
Delete the following folders from MIUI's etc and replace them with the ones found in the AOSP ROM.
- bluetooth
- dhcpcd
- wifi
While comparing, if there are any files and/or folders that are in the AOSP ROM and not in MIUI, go ahead and copy those over now. Here is the list from the Nexus One (your's may differ)
- firmware (folder)
- init.d (folder)
- nano (folder)
- terminfo (folder)
- AdieHWCodecSetting.csv
- AudioBTID.csv
- ecclist_for_mcc.conf
- profile
- sysctl.conf
- vpimg
Finally we need to copy some folders and files that exist in both ROMs. When copying folders, go ahead and overwrite any files that are the same. For example, we want all the files from inside the permissions folder as well as any that only exist in MIUI. Here is the list of files and folders to copy over from AOSP
- permissions (folder) - delete any android.hardware.*.xml files from MIUI that only exist in that folder and not the AOSP permissions folder.
- apns-conf.xml
- audio_effects.conf
- dbus.conf
- event-log-tags
- gps.conf
- init.goldfish.sh
- media_profiles.xml
- mkshrc
- vold.fstab
fonts
Leave this one alone
framework
Leave this one alone
lib
This is where it becomes a bit more complicated. We need to be selective about which files we copy over. Missing or incompatible libraries are a big cause of bootloops but we'll tackle that later. First start off by deleting any folders, contained within the lib folder from MIUI. Now copy all the folders (no files yet) from the AOSP ROM to MIUI lib folder.
Next copy any files that only exist in the AOSP ROM over to MIUI. With the easy stuff out of the way for the lib folder, it's time to start replacing files with those in AOSP. The following is a list of those files I copy from the Nexus One's ICS ROM and yours may differ slightly but this is a good reference to make use of.
- libandroid_runtime.so
- libbinder.so
- libbluedroid.so
- libbluetoothd.so
- libbluetooth.so
- libbtio.so
- libcamera_client.so
- libcameraservice.so
- libc.so
- libdbus.so
- libdl.so
- libdvm.so
- libEGL.so
- libGLESv1_CM.so
- libGLESv2_dbg.so
- libGLESv2.so
- libgui.so
- libhardware_legacy.so
- libhardware.so
- libhwui.so
- libinput.so
- libreference-ril.so
- libskia.so
- libstagefright_amrnb_common.so
- libstagefright_avc_common.so
- libstagefright_enc_common.so
- libstagefright_foundation.so
- libstagefrighthw.so
- libstagefright_omx.so
- libstagefright_soft_aacdec.so
- libstagefright_soft_amrdec.so
- libstagefright_g711dec.so
- libstagefright_soft_h264dec.so
- libstagefright_soft_mp3dec.so
- libstagefright_soft_mpeg4dec.so
- libstagefright_soft_vorbisdec.so
- libstagefright_soft_vpxdec.so
- libstagefright_yuv.so
- libsurfaceflinger.so
- libui.so
- libwebcore.so
- libwpa_client.so
media
Leave this one alone
tts
Leave this one alone
usr
Copy all the folders from the AOSP ROM over to the MIUI usr folder, replacing any files with the same name.
vendor
Delete this folder from MIUI and copy the one from your AOSP in place of it.
xbin
Copy all files except for su. Make sure you DO NOT copy su from AOSP. The MIUI permissions app will not function correctly using a different su binary.
build.prop
For build.prop, the easiest thing to do is to use the one from your AOSP ROM with only a few lines copied over from the MIUI build.prop. Here are the lines to use from MIUI's build.prop, simply add them to the end.
Note: make sure to that these items are not defined elsewhere in build.prop. If they are go ahead and remove them.Code:ro.config.ringtone=MI.ogg ro.config.notification_sound=FadeIn.ogg ro.config.alarm_alert=GoodMorning.ogg ro.config.sms_received_sound=FadeIn.ogg ro.config.sms_delivered_sound=MessageComplete.ogg
That's it for getting your device specific files into MIUI v4. All that is left to do now is zip it up, copy it to your device and flash it. To package it up you need to zip META-INF, system, and boot.img. I'll leave troubleshooting and debugging the ROM for another tutorial. This should at least give you a decent foundation to get MIUI v4 ported to your device.
I am now opening the floor up to Q&A. Please leave questions about debugging problems for another thread and focus on putting together the ROM in this thread.
Last edited by |0xD34D|; 04-16-2012 at 12:39 PM.
-
-
04-21-2012, 12:09 AM #2Junior Member
- Join Date
- Mar 2012
- Posts
- 4
- Thanks
- 0 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
This should work for X2/G2x!!?
-
04-21-2012, 02:47 PM #3
-
04-22-2012, 12:14 AM #4Junior Member
- Join Date
- Mar 2012
- Posts
- 4
- Thanks
- 0 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
Well I meant the Process!
Tried many times no go... the closes I've been is last year Dec where all works but the data.Last edited by LEGEND94; 04-22-2012 at 10:43 AM.
-
05-02-2012, 02:36 AM #5Junior Member
- Join Date
- Apr 2012
- Posts
- 7
- Thanks
- 3 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
That's the topic I searched a lot! I hope I can move forward now. OK, my question is not hard, I hope. There is a MIUI ICS v4 ROM made by smokin901 for HD2 (the link). It was based in on one of MIUI.us builds or ports. In the past smokin was updating his build with just new MIUI ICS v4 fixes and I have the ROM on my phone (EU HD2) and it's for my daily use. But recently smokin switched to another ROM base to support HWA kernel for HD2. I agree it's a great event and fully support this but the HWA is not stable enough and now I am more interested in new MIUI fixes than in a new unstable ROM.
Said this could you please advise what changes should I copy over from new MIUI 2.4.27 ROM (and all future ROM versions) to my existing ROM to incorporate new MIUI 2.4.27 fixes? My initial thoughts were to copy app and framework folders. But what about libs? I might assume there are changes in libs also related to MIUI. Other files/dirs?
Thanks in advace
-
05-02-2012, 08:56 AM #6Junior Member
- Join Date
- Apr 2012
- Posts
- 7
- Thanks
- 3 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
I did some comparison of two builds for HD2 and that cleared many questions. The first one is NexusHD2-ICS-CM9_V1.6, another is MIUI.us-ICS-Leo-2.4.20-1. I tried both and both works ok but I am interested in MIUI. Actually the last one is the ROM I am using right now.
I found that they are "mostly" the same in the systems parts. It looks like they differ mostly in parts which I assume are MIUI itself: app, framework, fonts, media. Is that correct? So I assume I could move this dirs from newest appropriate MIUI V4 build and will get the latest MIUI fixes. Please, correct me if I am wrong.
One more thing I noticed and would like to get clarification. In lib directory there are files with the same names but with different size and date. Like, lights.htcleo.so, there are others (libdrm*.so files. What is the right thing to do - get the newest file or keep the old one from my ROM I am using right now? My thoughts are the new file has some updates which might be useful to have.
-
05-02-2012, 03:47 PM #7Super User
- Join Date
- Apr 2011
- Location
- Hamden, CT
- Posts
- 557
Donate - Thanks
- 28 Times
- Thanked
- 117 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
app, framework, media are the core components of any ROM (maybe not so much media). The libs tell the software how to interact with the hardware (this is a very very basic explanation) - you want to keep as many of the MIUI libs as possible, but you will need some from the AOSP port to tell the software how to communicate with your phone. Some libs are app-specific, some are phone-specific.
hTC Inspire 4G
MIUI v4

Feel like donating? Not at all necessary. But if you still would like to Click Here
How to logcat:
Probably the easiest way to provide a logcat is with aLogcat.
Open aLogcat after whatever incident you would like to report,
Hit Menu > Save
Files save to /sdcard/alogcat/
-
05-02-2012, 11:19 PM #8Junior Member
- Join Date
- Apr 2012
- Posts
- 7
- Thanks
- 3 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
Thanks for the answer but it's too generic (I am a compiler developer so have good understanding SW and HW interaction
) and it did not answer my specific questions. I am a newbie in Android stuff and ROM development and want to understand all these better to update my current ROM. My specific questions are:
- if I copy app, framework from new MIUI version to my current MIUI ROM will I get updated MIUI ROM?
- I have two system libraries, both for HD2, with the same name but with different size and date? Which one is preferable to use, the old or the new? What does usual experience of ROM developers say in this case?
-
05-03-2012, 11:15 AM #9Super User
- Join Date
- Apr 2011
- Location
- Hamden, CT
- Posts
- 557
Donate - Thanks
- 28 Times
- Thanked
- 117 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
There might a few small lib changes with the updates, especially with ICS in as early development as it is, they're always changing things.
You have two system libraries because one set is the MIUI libraries, and the other set your CM9. Like I said before, you want to keep as much of it MIUI as possible.. only copy the libs you need to make your port boot and run from CM9, the rest should be MIUI.... date/size matters nothTC Inspire 4G
MIUI v4

Feel like donating? Not at all necessary. But if you still would like to Click Here
How to logcat:
Probably the easiest way to provide a logcat is with aLogcat.
Open aLogcat after whatever incident you would like to report,
Hit Menu > Save
Files save to /sdcard/alogcat/
-
The Following User Says Thank You to blind For This Useful Post:
tigor.nsk (05-05-2012)
-
05-05-2012, 03:12 AM #10Junior Member
- Join Date
- Apr 2012
- Posts
- 7
- Thanks
- 3 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
Thanks, blind! I hit the "Thanks" button
. But I still get confused
. Ok, I will ask mostly the same question but in a different way.
Here is a logical chain. I read one more time the first post made by|0xD34D|,
- It says Given my case, I have HTC HD2 EU, there is a MIUI.us port for Google Nexus One made by |0xD34D|. The underline HW is the same for both phones. That means I can take the ROM for N1 as a base.A good rule of thumb is to pick a device that best matches the one you are working on.
- The description also says that app and framework dirs That means that these dirs can be used from MIUI base ROM without any modification. In my case the base rom is MIUI.us port for Google Nexus One.should be left alone
Given this reasoning I made a conclusion I could just copy apps and framework dirs from the base MIUI rom (in my case it's MIUI.us port for Google Nexus One) to my existing HD2 ICS rom. Doing so I will get the latest MIUI changes to my existing rom. And that's exactly what I need. I know that have I have to port some other files from MIUI but my main question is
Can I took apps and framework dirs as is? I should not do any special treatment for the files from these dirs, is that correct?
-
Advertisement
-
05-05-2012, 04:25 AM #11Super User
- Join Date
- Apr 2011
- Location
- Hamden, CT
- Posts
- 557
Donate - Thanks
- 28 Times
- Thanked
- 117 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
I suppose you technically can do that, yes, however you may have a bunch of stupid issues later on down the road. Maybe not the first 'update' but the one after that, or whenever. Your libs and bins will eventually get out of date, and they're still heavy into development of the ICS ROM, so they could be updating some libs every week, which could cause FCs or random reboots or lag, etc etc.
Some devices need some modifications to certain framework files. For my Desire HD port, I have to merge in a bunch of files from my ICS framework.jar into my MIUI one.. someone the other day had to do the same for a file in services.jar.. just so you know that you're not leaving them completely alone, you just don't have to figure out which ones to use from MIUI and which from ICS - use all from MIUI, but make modifications as needed.hTC Inspire 4G
MIUI v4

Feel like donating? Not at all necessary. But if you still would like to Click Here
How to logcat:
Probably the easiest way to provide a logcat is with aLogcat.
Open aLogcat after whatever incident you would like to report,
Hit Menu > Save
Files save to /sdcard/alogcat/
-
05-05-2012, 05:12 AM #12Junior Member
- Join Date
- Apr 2012
- Posts
- 7
- Thanks
- 3 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
I see... Then it looks like my wish is trending to become some sort of ROM development. I thought it could be much easier as I had described earlier. I am a newbie to the ROM development so I have to learn many things. I would assume it's not hard when the process has settled down. I have general knowledge in that field but not the detailed process. Eh-h... Is there any docs, tutorials, posts or whatever to start with and to understand whether I would like to go this way. Thanks!
-
05-05-2012, 06:21 AM #13Member
- Join Date
- Jun 2011
- Posts
- 31
- Thanks
- 1 Time
- Thanked
- 8 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
I had replied to your PM on XDA. and had asked you to take 2.4.20-1 which non HWA and delete apps and framework then copy over apps and framework from latest miui build, you will at least get a rom which boots. later you can look at the logcat for errors and replace libs accordingly. it cannot get easier than this. or other option is miui patch rom.
From this week onwards I'll be making two ports HWA and non-HWA. but HWA version will gets posted first.
-
The Following User Says Thank You to smokin901 For This Useful Post:
tigor.nsk (05-05-2012)
-
05-05-2012, 10:13 AM #14Junior Member
- Join Date
- Apr 2012
- Posts
- 7
- Thanks
- 3 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
Hi smokin901, thanks a lot. This is good news from you. I am sure as HWA becomes stable it will be the only rom needed.
-
05-06-2012, 12:59 PM #15Site Founder
- Join Date
- Apr 2011
- Location
- Los Angeles
- Posts
- 364
Donate - Thanks
- 36 Times
- Thanked
- 168 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
I don't recommend "updating" your MIUI rom by just copying over framework and apps. If you want to resort to that method, this is what I would do (version numbers are just examples)
Grab MIUI 2.4.20 v4 for Nexus One
Grab MIUI 2.5.3 v4 for Nexus One
Diff the two roms and see what has changed between the two versions - most system apps and framework will have changed. Sometimes libs get changed as well so keep an eye out.
Apply those changes to MIUI 2.4.20 v4 HD2.
-
07-08-2012, 06:46 AM #16Junior Member
- Join Date
- Jul 2012
- Posts
- 3
- Thanks
- 0 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
IDK why I can't post new threads so I'll hop on to this one.
I've successfully ported MIUI to the i9100G and it boots. the only problem is making phone calls.
Whenever I try to make a phone call it will force close. and I can't receive any calls too.
Any help will be appreciated
-
07-08-2012, 09:20 PM #17Super User
- Join Date
- Apr 2011
- Location
- Hamden, CT
- Posts
- 557
Donate - Thanks
- 28 Times
- Thanked
- 117 Times
hTC Inspire 4G
MIUI v4

Feel like donating? Not at all necessary. But if you still would like to Click Here
How to logcat:
Probably the easiest way to provide a logcat is with aLogcat.
Open aLogcat after whatever incident you would like to report,
Hit Menu > Save
Files save to /sdcard/alogcat/
-
07-10-2012, 02:13 PM #18Junior Member
- Join Date
- Jul 2012
- Posts
- 3
- Thanks
- 0 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
sec. i have it here
http://pastebin.com/VH6BQfcm
-
08-07-2012, 08:30 AM #19Junior Member
- Join Date
- Jul 2012
- Posts
- 2
- Thanks
- 0 Times
- Thanked
- 0 Times
Re: [CASE STUDY] Porting v4 to the Nexus One
Hello... Need some help debugging a bug. Settings.apk and Phone.apk is Fc's along with a couple more apps
Logcat: http://pastebin.com/YcezyKcT
-
08-07-2012, 09:04 AM #20Junior Member
- Join Date
- Jul 2012
- Posts
- 2
- Thanks
- 0 Times
- Thanked
- 0 Times
Reply With Quote
Bookmarks