[WIP][GUIDE] PatchROM - MIUI Porting

Search This thread

farazcrx27

Senior Member
Feb 15, 2011
260
459
delhi
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:

skapez

Member
Jan 21, 2011
27
8
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.
 
  • Like
Reactions: LookedPath

N00BY0815

Senior Member
Nov 6, 2011
2,528
1,897
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
 

90amper

Senior Member
Jan 10, 2012
72
11
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://xdaforums.com/showthread.php?t=1483332
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    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
    1
    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.
    1
    Good News for you, the beta porting miui rom for p970 will be published at the end of Feb.

    Link?



    Trolling in the deep
    1
    Do you understand Chinese?

    Google translate does :)

    Trolling in the deep