Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[WIP][GUIDE] PatchROM - MIUI Porting

OP farazfaraz

22nd February 2012, 10:28 AM   |  #1  
farazfaraz's Avatar
OP Senior Member
Flag delhi
Thanks Meter: 454
 
243 posts
Join Date:Joined: Feb 2011
Donate to Me
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
Last edited by farazfaraz; 22nd February 2012 at 10:36 AM.
The Following 5 Users Say Thank You to farazfaraz For This Useful Post: [ View ]
22nd February 2012, 11:21 AM   |  #2  
omair.fehmi's Avatar
Member
Flag Delhi
Thanks Meter: 2
 
32 posts
Join Date:Joined: Nov 2011
More
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
22nd February 2012, 02:32 PM   |  #3  
farazfaraz's Avatar
OP Senior Member
Flag delhi
Thanks Meter: 454
 
243 posts
Join Date:Joined: Feb 2011
Donate to Me
Oops I didn't see that
23rd February 2012, 01:54 PM   |  #4  
skapez's Avatar
Junior Member
Thanks Meter: 8
 
25 posts
Join Date:Joined: Jan 2011
More
Quote:
Originally Posted by farazfaraz


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: [ View ]
23rd February 2012, 03:27 PM   |  #5  
N00BY0815's Avatar
Recognized Contributor
Thanks Meter: 1,885
 
2,440 posts
Join Date:Joined: Nov 2011
Donate to Me
Quote:
Originally Posted by skapez

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
23rd February 2012, 04:38 PM   |  #6  
90amper's Avatar
Member
Flag Samara
Thanks Meter: 8
 
63 posts
Join Date:Joined: Jan 2012
More
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
Last edited by 90amper; 23rd February 2012 at 05:41 PM.
24th February 2012, 06:44 AM   |  #7  
Junior Member
Flag Beijing
Thanks Meter: 6
 
12 posts
Join Date:Joined: Feb 2012
Good News for you, the beta porting miui rom for p970 will be published at the end of Feb.
24th February 2012, 06:55 AM   |  #8  
re4lsk's Avatar
Senior Member
Flag Hermosillo
Thanks Meter: 481
 
853 posts
Join Date:Joined: Dec 2011
Donate to Me
More
Quote:
Originally Posted by lhysun

Good News for you, the beta porting miui rom for p970 will be published at the end of Feb.

Link?



Trolling in the deep
The Following User Says Thank You to re4lsk For This Useful Post: [ View ]
24th February 2012, 10:05 AM   |  #9  
Junior Member
Flag Beijing
Thanks Meter: 6
 
12 posts
Join Date:Joined: Feb 2012
Quote:
Originally Posted by re4lsk

Link?



Trolling in the deep

Do you understand Chinese?
24th February 2012, 10:26 AM   |  #10  
re4lsk's Avatar
Senior Member
Flag Hermosillo
Thanks Meter: 481
 
853 posts
Join Date:Joined: Dec 2011
Donate to Me
More
Quote:
Originally Posted by lhysun

Do you understand Chinese?

Google translate does

Trolling in the deep

The Following User Says Thank You to re4lsk For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes