[LG Optimus Black] farazcrx27:
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:

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