FORUMS

XDA Recap: This Week In Android (May 17 – 23)

Another week, another recap. The Sunday tradition marches on this week with a fresh … more

Huawei To Sell Honor Smartphones Via Indian Retail Outlets

World’s fourth largest smartphone maker Huawei plans to now sell its … more

Sunday Debate: Are Smaller Bezels Better or Worth It?

Bezels have been getting smaller and smaller as the years go by, and while devices … more

LG G4 First Impressions and Unboxing – XDA TV

The latest in LG’s signature line of “G phones” has been released. … more
Post Reply Subscribe to Thread Email Thread

[GUIDE][LINUX][MIUI] MIUI PatchROM -- BUILD YOUR OWN MIUI ROM

6th February 2012, 10:37 AM |#1  
OP Member
Thanks Meter: 53
 
More
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:
Code:
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
Code:
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:
Code:
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:
  1. Android 2.3.3 - 2.3.7 supported
  2. ROM with root abilities
  3. 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:
Code:
#
# 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:
Code:
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..
Last edited by MisterGT; 10th February 2012 at 10:25 AM.
The Following 46 Users Say Thank You to MisterGT For This Useful Post: [ View ]
 
 
6th February 2012, 01:37 PM |#2  
lucastan96's Avatar
Senior Member
Flag Malacca
Thanks Meter: 2,109
 
More
Nice to see a X8 thread come here...

Sent from my W8 using Tapatalk
The Following User Says Thank You to lucastan96 For This Useful Post: [ View ]
6th February 2012, 02:13 PM |#3  
Senior Member
Flag Pune
Thanks Meter: 94
 
More
Does the base rom need to be in ext4 fotmat and does this work with ldpi devices like Samsung galaxy fit



Sent from my GT-S5670 using xda premium
6th February 2012, 03:54 PM |#4  
Aspire's Avatar
Senior Member
Flag Vancouver
Thanks Meter: 345
 
Donate to Me
More
Nice Informative Thread.
Gonna try it for Samsung Galaxy Fit.
The Following User Says Thank You to Aspire For This Useful Post: [ View ]
6th February 2012, 04:39 PM |#5  
Racing19969's Avatar
Senior Member
Flag Rushsylvania
Thanks Meter: 1,241
 
Donate to Me
More
Nice tutorial. I am trying it now on SGS4G.

---------- Post added at 11:39 AM ---------- Previous post was at 11:28 AM ----------

It works pretty slick. I et as far as making the zip and it does it's thing but stops at the SystemUi rebuilding. will have to figure out and will post progress...
6th February 2012, 05:20 PM |#6  
Junior Member
Thanks Meter: 0
 
More
so does anybody try this out for the Zte Blade/Skat?
6th February 2012, 05:32 PM |#7  
OP Member
Thanks Meter: 53
 
More
It will only work for HDPI devices, as those are the only ones that are supported by the MIUI team. I'm still getting errors when trying to build SystemUI.apk, I've filed a issue for that though.
6th February 2012, 05:58 PM |#8  
Aspire's Avatar
Senior Member
Flag Vancouver
Thanks Meter: 345
 
Donate to Me
More
Code:
build .build/services.jar...
--------------------------------------------
cp -r services.jar.out/ .build/services
/home/lomash/MiCode/tools/add_miui_smail.sh .build/services_miui .build/services
/home/lomash/MiCode/tools/apktool b .build/services .build/services.jar
I: Checking whether sources has changed...
W: Could not find resources
I: Building apk file...
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /home/lomash/MiCode/s5670/.build/services.jar, /home/lomash/MiCode/s5670/.build/services/build/apk]
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
	at brut.androlib.Androlib.buildApk(Androlib.java:355)
	at brut.androlib.Androlib.build(Androlib.java:174)
	at brut.androlib.Androlib.build(Androlib.java:154)
	at brut.apktool.Main.cmdBuild(Main.java:182)
	at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /home/lomash/MiCode/s5670/.build/services.jar, /home/lomash/MiCode/s5670/.build/services/build/apk]
	at brut.util.OS.exec(OS.java:87)
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
	... 5 more
Caused by: java.io.IOException: Cannot run program "aapt": java.io.IOException: error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
	at java.lang.Runtime.exec(Runtime.java:610)
	at java.lang.Runtime.exec(Runtime.java:483)
	at brut.util.OS.exec(OS.java:78)
	... 6 more
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
	at java.lang.ProcessImpl.start(ProcessImpl.java:81)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
	... 9 more
make: *** [.build/services.jar] Error 1
Can anyone help me a little?

---------- Post added at 11:28 PM ---------- Previous post was at 11:27 PM ----------

aapt is there in the android-sdk-linux/tools folder.
6th February 2012, 06:39 PM |#9  
Racing19969's Avatar
Senior Member
Flag Rushsylvania
Thanks Meter: 1,241
 
Donate to Me
More
Quote:
Originally Posted by MisterGT

It will only work for HDPI devices, as those are the only ones that are supported by the MIUI team. I'm still getting errors when trying to build SystemUI.apk, I've filed a issue for that though.


I am having the same issue. I get as far as SystemUI and get errors. LMK if you find an answer!

Thanks
6th February 2012, 07:16 PM |#10  
Account currently disabled
Thanks Meter: 52
 
More
Will this work on the exhibit II

Sent from my SGH-T679 using xda premium
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes