[Desire HD Android Development] bliind:
Okay.. so, how I put this ROM together consists of two 'sections:' the easy stuff, and the nitty gritty. I'm gonna post the easy stuff now, then the nitty gritty stuff after I build the ROM so I have logcats to show off to help explain the process more.

So, the easy stuff...

Preparations:

Grab MIUI for the Nexus S (crespo), and an AOSP ROM (CM10 or AOKP work.. something straight AOSP might work better), and the latest gapps

Extract them both into their own folders. At this point, you may want to rename the MIUI folder from 'crespo' to the device name.

Delete these files/folders from the MIUI folder:

/boot.img

/recovery

/META-INF/com/android

/system/usr

/system/vendor

/system/lib/egl

/system/lib/hw

/system/app/LegacyCamera.apk (this is replaced with Gallery2.apk from your AOSP ROM, because LegacyCamera is 3MP max (or at least used to be))

Now, we're ready to copy the majority of the AOSP ROM into the MIUI folder..

Copy boot.img (obviously one of the most important pieces)

From /system, copy:

**etc

bin

lib

usr

vendor

When asked, overwrite existing files.

Now, copy /system/xbin and do NOT overwrite existing files.

Copy over any needed system apks into /system/app - Gallery2.apk for example.

At this point, I copy the gapps over. I just copy the entire system folder (except for addon.d - I don't know how much it makes a difference), and overwrite existing files.

Now, edit the build.prop and updater-script - you can usually just use the updater-script from your AOSP ROM, and you can use *most* of the build.prop as well. Things that should be copied from the MIUI build.prop into the AOSP one are:

ro.build.version.incremental=2.11.9
ro.build.version.sdk=16
ro.build.version.codename=REL
ro.build.version.release=4.1.2

and

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

And then that's it for the easy stuff... you will need a bootanimation.zip that's the proper size for your phone. crespo's is 480x800 - which will work on a larger resolution, it will just have a big black border.

Now at this point, if you don't yet know what smali edits to make, zip it up and flash it and follow the logcat (examples on that later).

MAKE SURE YOU'VE REPLACED THE UPDATER-SCRIPT AND BOOT.IMG WITH ONES FOR YOUR DEVICE BEFORE FLASHING. MISSING ONE OR BOTH IS A VERY EASY WAY TO PERMANENTLY BRICK A PHONE

Now, the nitty gritty... I will answer some questions about this stuff, but honestly, I don't have time to walk anyone step by step (no offense to anyone).

Things needed: smali/baksmali, apktool (apktool will baksmali and smali jar files just fine, but I've always used smali and baksmali for jar files)

One of the most important things about modifying MIUI apks is to use the old APK's signatures. The easiest way IMO, is to compile to a new apk, pull out the compiled files, and place them into the old apk. For example:

apktool d Mms.apk
----decompile, make edits----
apktool b Mms new.apk

If you edited anything in the "values" folder, it will be contained in resources.asrc in the root of the apk, so simply move that over with any zip manager. If you edited anything anywhere else, it will be where it was (ie res/xml/* is still res/xml/*)

The major things that need to be edited (usually) are framework-res.apk, framework.jar and services.jar (also android.policy.jar for 4way reboot, but I'm not going to delve into that in this guide). In some cases, you may need to also modify some APKs. For example, I make some edits to the mms_config.xml from Mms.apk for working MMS on the One XL.

SO, grab framework-res.apk, framework.jar and services.jar from your AOSP ROM and decompile them. (I put all my jars in the same folder, so I rename them all to jb_filename to differentiate from the MIUI ones I'll place in later). Then, do the same for the MIUI ones.

So, if you do it like me, you'll have a folder with "framework.jar" and "jb_framework.jar" - it really doesn't matter how you separate the apks, but I've noticed for my ADHD brain, this seems to work well.

This is where the guide stops for now, I want to wait until I have logcats that show errors so I can show how you know what smali files to move over/edit.

Edit: made a typo earlier. Do not copy the app folder from the AOSP ROM.