[Android Software Development] MisterGT:
Hello everybody,

Recently, the MIUI team has opened up its source on GitHub. This makes it now possible for everybody to compile MIUI roms. However, the guide they've provided is completely in Chinese. Credits go to ThePCGuy for finding out how it works (original topic) I wrote this guide according to his findings and added complementary items that I found out during my attempts.

Step 1: Preparing your computer

Building your own MIUI rom can only be done on Linux-systems (or *nix, not sure). In this guide I'll be using Ubuntu 11.10.

1. First of all, download a zipball from here. Extract it and place it in a directory (I extracted it in /home/MisterGT/MiCode. From now on, I'll call this the MiCode root directory.

2. Now, it is required to get the android-sdk tools on your computer. You can find those here. Again, extract them somewhere (I put them in /home/MisterGT/Micode/android-sdk-linux).

3. Update your PATH to include the android tools. In a terminal write:

export PATH=/location/to/android-sdk-linux/platform-tools:/location/to/android-sdk-linux/tools:$PATH

And change the paths accordingly. In my case this would mean

export PATH=/home/MisterGT/MiCode/android-sdk-linux/platform-tools:/home/MisterGT/MiCode/android-sdk-linux/tools:$PATH

4. On x64 systems you are required to install some 32-bit libraries or the android toolkit will not work. In a terminal write:

sudo apt-get install ia32-libs

Step 2: Find an appropriate source rom

The package will convert a standard rom to a MIUI rom, so you'll have to choose a ROM you want to use as base. According to the manual, there are two requirements:

Android 2.3.3 - 2.3.7 supported

ROM with root abilities

Only HDPI devices are supported!

So after you've picked one, download it. In your MiCode root dir, create a new map and give it some name (I chose p990 as name). In that folder, put the ROM.zip and do not unzip it.

Step 3: Setting up the makefile

Firstly, copy the makefile from the i9100 directory which is an example. This is how it looks like:

#
# Makefile for i9100
#

# The original zip file, MUST be specified by each product
local-zip-file := I9100ZCKJ1.zip

# The output zip file of MIUI rom, the default is porting_miui.zip if not specified
local-out-zip-file := MIUI_9100.zip

# All apps from original ZIP, but has smali files chanded
local-modified-apps := LogsProvider Phone MediaProvider Settings

# All apks from MIUI execept MIUISystemUI and framework-miui-res.apk
local-miui-apps := Contacts ContactsProvider Mms TelephonyProvider ThemeManager Launcher2 \
DownloadProvider TelocationProvider Notes Music Torch DownloadProviderUi Updater

# All apps need to be removed from original ZIP file
local-remove-apps := AlipayGphone AmsComposer AndroidQQ_Samsung_Seine BuddiesNow cooldict glyder2 \
ImgoTV iReader kaixin001 Memo MiniDiary MinimalHome mreader PressReader ReadersHub Renren \
Sinamicroblog SinaNews SinaStock SinaWeather SocialHub Tencentmicroblog \
TomEbook Tonghuashun TouchWiz30Launcher Youku_Samsung_seine MusicPlayer \
MediaHub PhotoRetouching VideoEditor thinkdroid QYVideoClient \
Days DigitalClock Dlna DualClock Email EmailWidget FTC FTM FTS Kobo \
Microbesgl Navigator PostIt Protips QuickSearchBox SamsungApps SamsungAppsUNA3 \
SamsungIM SamsungWidget_ProgramMonitor SecretWallpaper1 SecretWallpaper2 \
SevenEngine SnsAccountKx SnsAccountRr SnsDisclaimer SnsImageCache SnsProvider \
Tasks TasksProvider Term TrimApp TwCalendarAppWidget Zinio \
samsungappswidget syncmldm viva_tts

# To include the local targets before and after zip the final ZIP file,
# and the local-targets should:
# (1) be defined after including porting.mk if using any global variable(see porting.mk)
# (2) the name should be leaded with local- to prevent any conflict with global targets
local-pre-zip := local-zip-misc
local-after-zip:= local-test

# The local targets after the zip file is generated, could include 'zip2sd' to
# deliver the zip file to phone, or to customize other actions

include $(PORT_BUILD)/porting.mk

# To define any local-target
local-zip-misc:
cp misc/com.google.android.maps.jar $(ZIP_DIR)/system/framework/
@echo Add google apks
cp misc/apk/* $(ZIP_DIR)/system/app/
@echo Replace build.prop
cp misc/build.prop $(ZIP_DIR)/system/build.prop

local-test:
echo "an example action"

Explanations:

'local-zip-file' = Name of your original ROM zip that you just downloaded

'local-out-zip-file' = Name for your finished MIUI rom

'local-modified-apps' = Apps that will be modified to fit in with the framework. They need to be modified because they contact with the system

'local-miui-apps' = MIUI Apps that will be integrated into the zip

'local-remove-apps' = Apps that will be removed from the original ROM

'local-pre-zip' = Refers to codeblock that should be executed before the zip is done.

'local-after-zip' = Refers to codeblock executed after the zip is completed

'local-zip-misc' = The codeblock just described at 'local-pre-zip'. It adds some Google Apps and a buid.prop

'local-test' = Another codeblock

Step 4: Decompiling apps

Before we can build the new rom, we must decompile some apps and put them in the device folder (so in my case that would be the p990 folder).

/system/framework/android.policy.jar

/system/framework/framework.jar

/system/framework/framework-res.apk

/system/framework/services.jar

/system/app/SystemUI.apk

and all apps that you defined at 'local-modified-apps' in the makefile

Update: as it seems now you need to copy the systemui folder from the i9100 folder. This fixes issues related to systemui.apk not building.

Step 5: Building the rom

Now we're done and we can start building the rom. Open up a terminal and go to the MiCode root dir. Then type:

source build/envsetup.sh
cd p990 #Or whatever you called your device folder
make zipfile

It will now do a lot of things to build the ROM. Unfortunately, I'm getting a lot of errors when it tries to modify the apps from 'local-modified-apps'. And I don't have any clue to fix it, don't know anything about that..