Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,802,856 Members 38,703 Now Online
XDA Developers Android and Mobile Development Forum

[WIP][GUIDE] PatchROM - MIUI Porting

Tip us?
 
farazfaraz
Old
(Last edited by farazfaraz; 22nd February 2012 at 09:36 AM.)
#1  
farazfaraz's Avatar
Senior Member - OP
Thanks Meter 454
Posts: 243
Join Date: Feb 2011
Location: delhi

 
DONATE TO ME
Default [WIP][GUIDE] PatchROM - MIUI Porting

Hello guys!

actually i dont own this phone so replace "shakira" with your phone name

MIUI recently opensourced a set of tools made for porting it's ROM to other devices. here's a little guide on how it (kinda) works, maybe it helps someone.

Any contribution is welcome

Here's what I've found of PatchROM:

Get PatchROM from here (384MB)
And make sure you have apktool installed.

The overall proccess looks like this:
Extract the tools
Get an Gingerbread ROM to install MIUI stuff;
Create the required file structure
Change the Makefile
Apply MIUI changes to the selected ROM
Flash it!

STEP 1: Extracting the tools
I've extracted the tools to ~/patchrom, but you can use another directory if you want. I'll call that folder the PatchROM root folder.

STEP 2: Choosing the ROM
The PatchROM docs recommend that we use a stock Gingerbread ROM from the device manufacturer, but there's no official Gingerbread for our device, so I used a MiniCM7 zip instead.
EDIT: make sure you use an deodexed rom or deodex your rom.

STEP 3: Creating the file structure
To port, we need to create a folder inside the PatchROM root directory for our device. There's an example device for the Samsung Galaxy S on the i9000 folder, we'll use that as a base. I created a folder called 'shakira' and copied the makefile file from the i9000 folder and the MiniCM7(thats a gb rom for my device you can take any gb rom ) zip to it.

You also need to decompile the following APK files and put the resulting folder on the 'shakira' folder:
/system/framework/android.policy.jar
/system/framework/framework.jar
/system/framework/framework-res.apk
/system/app/SystemUI.apk
/system/framework/services.jar
and the apps defined on the 'local-modified-apps' below
STEP 4: Editing the Makefile
The makefile has the following structure:
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"
STEP 5: Apply MIUI Changes
To apply the MIUI changes on the choosen ROM, type those commands in the root of PatchROM:
Code:
source build/envsetup.sh
cd shakira # CHANGE THIS LINE TO MATCH THE FOLDER YOU CREATED IN STEP 3
make
Now it should decompile the ROM and merge the ROM's smali files with the MIUI files, and create an ZIP file with the MIUI rom
using namespace std;
cout << "Hit thanks button if i helped you " ;
return 0;

My works

-Fa kernel for U20
-GingerDX v21 port for U20
The Following 5 Users Say Thank You to farazfaraz For This Useful Post: [ Click to Expand ]
 
omair.fehmi
Old
#2  
omair.fehmi's Avatar
Member
Thanks Meter 2
Posts: 32
Join Date: Nov 2011
Location: Delhi
We already have a guide of ' Porting Official MIUI ' here is the link :
http://forum.xda-developers.com/show...highlight=miui

but yea for sure understanding your guide seems to be way easier......thanks for the efforts
 
farazfaraz
Old
#3  
farazfaraz's Avatar
Senior Member - OP
Thanks Meter 454
Posts: 243
Join Date: Feb 2011
Location: delhi

 
DONATE TO ME
Oops I didn't see that
using namespace std;
cout << "Hit thanks button if i helped you " ;
return 0;

My works

-Fa kernel for U20
-GingerDX v21 port for U20
 
skapez
Old
#4  
skapez's Avatar
Junior Member
Thanks Meter 7
Posts: 24
Join Date: Jan 2011
Quote:
Originally Posted by farazfaraz View Post

The PatchROM docs recommend that we use a stock Gingerbread ROM from the device manufacturer, but there's no official Gingerbread for our device, so I used a MiniCM7 zip instead.
Maybe I misunderstand, but why you say there isn't gingerbread for OB? We have different version of Ginger, as the 20N and the 20B. And also we have source code from LG of 20N.
The Following User Says Thank You to skapez For This Useful Post: [ Click to Expand ]
 
N00BY0815
Old
#5  
N00BY0815's Avatar
Recognized Contributor
Thanks Meter 1,885
Posts: 2,436
Join Date: Nov 2011

 
DONATE TO ME
Quote:
Originally Posted by skapez View Post
Maybe I misunderstand, but why you say there isn't gingerbread for OB? We have different version of Ginger, as the 20N and the 20B. And also we have source code from LG of 20N.
This is from another device. Thats why this is stated. I dont remember which exactly, but I think it wasnt even lg. So just grab a stock ROM and try to port ;)

Sent from my LG-P970 using Tapatalk

Read it, if you're new in this forum!

 
90amper
Old
(Last edited by 90amper; 23rd February 2012 at 04:41 PM.)
#6  
90amper's Avatar
Member
Thanks Meter 8
Posts: 63
Join Date: Jan 2012
Location: Samara
I tryed that, but have error in V step, in compiling decompiled apks,
Can anyone help me? What I can do with that?

Code:
build .build/Phone.apk...
--------------------------------------------
cp -r Phone .build
/home/amper/PatchROM/tools/apktool b  .build/Phone .build/Phone.apk
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
/home/amper/PatchROM/p970fiesta/.build/Phone/res/values-kk/strings.xml:267: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
/home/amper/PatchROM/p970fiesta/.build/Phone/res/values-kk/strings.xml:267: error: Unexpected end tag string
/home/amper/PatchROM/p970fiesta/.build/Phone/res/values-uk/strings.xml:268: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
/home/amper/PatchROM/p970fiesta/.build/Phone/res/values-uk/strings.xml:269: error: Unexpected end tag string
aapt: warning: string 'badPin' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'badPuk2' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'card_title_dialing' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'card_title_on_hold' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'invalidPin' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'invalidPin2' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'menu_add' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'menu_delete' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'menu_edit' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'menu_ignore' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'mismatchPin' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'name' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'puk_requested' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'puk_unlocked' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'roaming_reenable_message' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'roaming_warning' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'save' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'simContacts_emptyLoading' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'simContacts_title' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
aapt: warning: string 'sum_carrier_select' has no default translation in /home/amper/PatchROM/p970fiesta/.build/Phone/res; found: pt_PT
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL7887371696031411068.tmp, -I, /root/apktool/framework/1.apk, -S, /home/amper/PatchROM/p970fiesta/.build/Phone/res, -M, /home/amper/PatchROM/p970fiesta/.build/Phone/AndroidManifest.xml]
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
	at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
	at brut.androlib.Androlib.buildResources(Androlib.java:248)
	at brut.androlib.Androlib.build(Androlib.java:171)
	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, /tmp/APKTOOL7887371696031411068.tmp, -I, /root/apktool/framework/1.apk, -S, /home/amper/PatchROM/p970fiesta/.build/Phone/res, -M, /home/amper/PatchROM/p970fiesta/.build/Phone/AndroidManifest.xml]
	at brut.util.OS.exec(OS.java:83)
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
	... 6 more
make: *** [.build/Phone.apk] Error 1
root@AmpBunta:/home/amper/PatchROM/p970fiesta#
UPD: go to general thread http://forum.xda-developers.com/show....php?t=1483332
Google TranslateŽ user
 
lhysun
Old
#7  
Junior Member
Thanks Meter 6
Posts: 12
Join Date: Feb 2012
Location: Beijing
Good News for you, the beta porting miui rom for p970 will be published at the end of Feb.
 
re4lsk
Old
#8  
re4lsk's Avatar
Senior Member
Thanks Meter 481
Posts: 853
Join Date: Dec 2011
Location: Hermosillo

 
DONATE TO ME
Quote:
Originally Posted by lhysun View Post
Good News for you, the beta porting miui rom for p970 will be published at the end of Feb.
Link?



Trolling in the deep
use search, then, if is not enough, use the force young skywalker.
The Following User Says Thank You to re4lsk For This Useful Post: [ Click to Expand ]
 
lhysun
Old
#9  
Junior Member
Thanks Meter 6
Posts: 12
Join Date: Feb 2012
Location: Beijing
Quote:
Originally Posted by re4lsk View Post
Link?



Trolling in the deep
Do you understand Chinese?
 
re4lsk
Old
#10  
re4lsk's Avatar
Senior Member
Thanks Meter 481
Posts: 853
Join Date: Dec 2011
Location: Hermosillo

 
DONATE TO ME
Quote:
Originally Posted by lhysun View Post
Do you understand Chinese?
Google translate does

Trolling in the deep
use search, then, if is not enough, use the force young skywalker.

The Following User Says Thank You to re4lsk For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes