[GUIDE][Updated 19/04/12] PatchROM - MIUI 2.3 and 4.0 Porting

Search This thread

MisterGT

Senior Member
May 12, 2010
68
54
I don't really know what the 'local-modified-apps' means, I just left this line empty (any help anyone?), and remember to decompile those apps and put the results on the 'shakira' folder

Modified apps are those that are required from the original rom because they do important stuff (like Phone.apk communicates with your phone's radio). Thus these can not be easily copied from miui but have to be modified.

I don't know what the last lines mean (help please!)

These mean the actions that should be done before and after compiling the rom, hence the 'local-pre-zip' and 'local-after-zip'.

local-pre-zip := local-zip-misc
local-after-zip:= local-test

Before the zip is done, the codeblock at local-zip-misc should be executed. And after the zip is completed, local-test will be run.

In the i9100 local-zip-misc, it adds some google apps to the zip, and inserts a modified build.prop in the zip.
 

MisterGT

Senior Member
May 12, 2010
68
54
I get an error saying /porting.mk doesn´t exist. Can anyone help me on that since i´m pretty much a noob in Linux?

Also, how can i do this deodexing?

For deodexing, there's a tool for that in the tools folder. Also a bit in the chinese manual.

As for the porting.mk, it seems that the envsetup.sh script is not doing what it should do.

Code:
PORT_BUILD=/home/yourname/MiCode/build

PORT_ROOT=/home/yourname/MiCode

Change the paths to where you have the package unzipped.
Add that to the beginning of makefile
 

deedii

Senior Member
May 25, 2011
1,647
963
There is an existing MIUI port of As-Mario (XperianPro). If i remember it right he says the only problem is the framework. So now we have sources then I guess he can continue what he promised before :) Aja.
 
  • Like
Reactions: akaSk8krew
Mar 9, 2010
41
1
Kurnool
For deodexing, there's a tool for that in the tools folder. Also a bit in the chinese manual.

As for the porting.mk, it seems that the envsetup.sh script is not doing what it should do.

Code:
PORT_BUILD=/home/yourname/MiCode/build

PORT_ROOT=/home/yourname/MiCode

Change the paths to where you have the package unzipped.
Add that to the beginning of makefile

Thanks for your tip, the make command worked after adding the above specified lines to make file.. but i ened up with an error.. I am attaching the output, please check it out and help me to fix it.


Code:
cp /home/jayasimha/thepatcher/miui/system/framework/framework-miui-res.apk .build/ZIP/system/framework/framework-miui-res.apk
build .build/framework-res.apk...
--------------------------------------------
cp -r framework-res .build
/home/jayasimha/thepatcher/tools/apktool b  .build/framework-res .build/framework-res.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'wifi_available' has no default translation in /home/jayasimha/thepatcher/i9100G/.build/framework-res/res; found: ms
aapt: warning: string 'wifi_available_detailed' has no default translation in /home/jayasimha/thepatcher/i9100G/.build/framework-res/res; found: ms
I: Building apk file...
cp apks-unsinged to zip dirs
cp .build/framework-res.apk .build/ZIP/system/framework/framework-res.apk
/home/jayasimha/thepatcher/tools/apktool d -f /home/jayasimha/thepatcher/miui/system/app/MIUISystemUI.apk .build/SystemUI
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: /home/jayasimha/apktool/framework/1.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x060e006b
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x060e0075
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x060e0075
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x060e0075
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x060e0075
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x060e0075
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x060e0075
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=textAppearance, value=0x060e0007
W: Could not decode attr value, using undecoded value instead: ns=android, name=textAppearance, value=0x060e0007
W: Could not decode attr value, using undecoded value instead: ns=android, name=drawable, value=0x0602037c
W: Could not decode attr value, using undecoded value instead: ns=android, name=textAppearance, value=0x060e0036
W: Could not decode attr value, using undecoded value instead: ns=android, name=textAppearance, value=0x060e0036
W: Could not decode attr value, using undecoded value instead: ns=android, name=textAppearance, value=0x060e0005
W: Could not decode attr value, using undecoded value instead: ns=android, name=textAppearance, value=0x060e0005
W: Could not decode attr value, using undecoded value instead: ns=android, name=textAppearance, value=0x060e0005
W: Could not decode attr value, using undecoded value instead: ns=android, name=textColor, value=0x0607003a
W: Could not decode attr value, using undecoded value instead: ns=android, name=textAppearance, value=0x060e0005
W: Could not decode attr value, using undecoded value instead: ns=android, name=textColor, value=0x0607003a
I: Decoding values*/* XMLs...
Can't find framework resources for package of id: 6. You must install proper framework files, see project website for more info.
make: *** [.build/SystemUI] Error 1
 
Mar 9, 2010
41
1
Kurnool
As the error i got previously was related to miui framework files for apktool, I thought of installing miui framework for apktool and did so.. after that performed the make command, now i got different error
Code:
cp /home/jayasimha/thepatcher/miui/system/framework/framework-miui-res.apk .build/ZIP/system/framework/framework-miui-res.apk
build .build/framework-res.apk...
--------------------------------------------
cp -r framework-res .build
/home/jayasimha/thepatcher/tools/apktool b  .build/framework-res .build/framework-res.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'wifi_available' has no default translation in /home/jayasimha/thepatcher/i9100G/.build/framework-res/res; found: ms
aapt: warning: string 'wifi_available_detailed' has no default translation in /home/jayasimha/thepatcher/i9100G/.build/framework-res/res; found: ms
I: Building apk file...
cp apks-unsinged to zip dirs
cp .build/framework-res.apk .build/ZIP/system/framework/framework-res.apk
build .build/MIUISystemUI.apk...
--------------------------------------------
cp -r SystemUI .build
/home/jayasimha/thepatcher/tools/apktool b  .build/SystemUI .build/MIUISystemUI.apk
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
res/drawable-hdpi/status_bar_background.png:0: error: Resource entry status_bar_background is already defined.
res/drawable-hdpi/status_bar_background.9.png:0: Originally defined here.
/home/jayasimha/thepatcher/i9100G/.build/SystemUI/res/values/styles.xml:3: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Holo.Light.Panel'.
/home/jayasimha/thepatcher/i9100G/.build/SystemUI/res/values/styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Holo.Light.Panel'.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL2651416676899838457.tmp, -I, /home/jayasimha/apktool/framework/1.apk, -S, /home/jayasimha/thepatcher/i9100G/.build/SystemUI/res, -M, /home/jayasimha/thepatcher/i9100G/.build/SystemUI/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/APKTOOL2651416676899838457.tmp, -I, /home/jayasimha/apktool/framework/1.apk, -S, /home/jayasimha/thepatcher/i9100G/.build/SystemUI/res, -M, /home/jayasimha/thepatcher/i9100G/.build/SystemUI/AndroidManifest.xml]
	at brut.util.OS.exec(OS.java:83)
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
	... 6 more
make: *** [.build/MIUISystemUI.apk] Error 1
 

lucastan96

Senior Member
Dec 9, 2011
2,945
2,083
27
Malacca
Hi guys! I found this... I dont now if it will help, but I decided to share anyway..

It's a MIUI porting thread to HTC Hero CDMA. There you will find a zip file with with all MIUI apps & the framework ported for MDPI screens.

http://xdaforums.com/showthread.php?t=858935

Hit the THANKS button if I helped!!
Sent from my W8 using Tapatalk
 

kamarush

Inactive Recognized Developer
Sep 26, 2011
844
3,746
36
Salzburg
Mar 9, 2010
41
1
Kurnool
I replaced the patchrom/mymobile/.build/SystemUI folder of my model with i9100's patchrom/i9100/.build/SystemUI folder(given by patchrom), and finally i succesfully created zip file using make command. But when i flashed it using cwm, it stuck on boot.. :(
Needhelp from MIUI guys
 

RockitOut11

Senior Member
Dec 28, 2010
553
140
@jayasimhareddy

probably the problem is that the MIUI Framework is writen for ARMv7

we need someone to port it



i'm now working on a port from the FileExplorer from their sources to MDPI and translate to Portuguese, i hope i can do it sucessfull and make it work on our roms ;)
 
  • Like
Reactions: lucastan96

Top Liked Posts

  • There are no posts matching your filters.
  • 31
    Hello guys!

    MIUI recently opensourced a set of tools made for porting it's ROM to other devices. Although I haven't managed to build a working ROM for our dear X8, here's a little guide on how it (kinda) works, maybe it helps someone.

    Any contribution is welcome :D

    Here's what I've found of PatchROM:

    Edit: MIUI changed the way to download the source code. Now you can use PatchROM on Android 2.3 and 4.0!

    And make sure you have apktool installed.

    The overall proccess looks like this:
    1. Download the tools
    2. Get an Gingerbread/ICS ROM to install MIUI stuff;
    3. Create the required file structure
    4. Change the Makefile
    5. Apply MIUI changes to the selected ROM
    6. Flash it! :D

    STEP 1: Downloading the tools

    If you want to patch a 2.3 ROM, just click the 'ZIP' button on the PatchROM Github: https://github.com/MiCode/legacy-patchrom

    If you want to patch a 4.0 ROM, do the following:

    Supposing you are on Linux:

    1. Make sure you have the Android SDK installed and on your PATH.
    2. Install repo following this guide. Do only the 'Installing repo' section.

    Then, create a new folder (in my case, ~/patchrom), enter it and type the following commands:
    Code:
    repo init -u git://github.com/MiCode/patchrom.git -b ics
    repo sync

    This command will download the PatchROM system to the ~/patchrom folder.

    STEP 2: Choosing the ROM
    The PatchROM docs recommend that we use a stock AOSP ROM from the device manufacturer, but there's no official Gingerbread or ICS for our device, so we need to use one of the CM7/CM9 roms. Use an CM7 rom if you are using patchrom-legacy, and use an CM9 rom if you are using the regular patchrom. Make sure you use an deodexed rom or deodex your rom.

    The rest of this guide was tested on patchrom-legacy (2.3), not tested on the regular patchrom for 4.0.

    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 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"

    Here's how it works:

    • The 'local-zip-file' should match your rom's ZIP (on my case MiniCM-2.1.ZIP)
    • The 'local-out-zip-file' is the MIUI ROM output name (put any name you want here)
    • The 'local-modified-apps', as pointed by MisterGT, 'are those that are required from the original rom because they do important stuff (like Phone.apk communicates with your phone's radio). Thus these can not be easily copied from miui but have to be modified.'
    • The 'local-miui-apps' point to the MIUI files; I didn't changed those
    • The 'local-remove-apps' indicates apps to be removed from the ROM
    • As MisterGT also pointed out here (thanks mate!), the "local-pre-zip := local-zip-misc" line executes the code block before the zip is done, and the "local-after-zip:= local-test" executes the code block after the zip is done.

    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, but I got some errors decompiling SystemUI.apk :( maybe some of the awesome devs there can solve this :D

    EDIT: The 'sh build/envsetup.sh' command was wrong; it's actually 'source build/envsetup.sh'. Fixed it above. That fixes the porting.mk errors :D

    SOURCES:
    PDF in the docs folder on PatchROM (thank you Google Translate!)
    Github README
    4
    Guys, just updated the guide, now you can patch both GB and ICS!
    4
    Thanks, there is a screenshot. Superuser working, but I have to add permisions on zip (META-INF). I have to learning for test now, so you guys must to be patient!

    screenshot2012022217323.png



    Hope you like it! Cheers!
    3
    This myProject on LWW, but i dont know my x8:)
    device-2012-02-08-205100.png
    3
    I heard from somewhere that we could try to use Defy's official miui to help us in porting... Not sure if it works...

    Yup, but nobody care about port it to our phone. I'll install Linux on Saturnday, and try to port and boot it from this MIUI sources. Cheers.

    ...