Sunday, February 19, 2012

[GUIDE][LINUX][MIUI] MIUI PatchROM -- BUILD YOUR OWN MIUI ROM - xda-developers

[GUIDE][LINUX][MIUI] MIUI PatchROM -- BUILD YOUR OWN MIUI ROM - xda-developers
: "Recently, the MIUI team has opened up its source on GitHub. This makes it now possible for everybody to compile MIUI roms. However, the guide they've provided is completely in Chinese. Credits go to ThePCGuy for finding out how it works (original topic) I wrote this guide according to his findings and added complementary items that I found out during my attempts.
MisterGT
[WIP][GUIDE] PatchROM - MIUI Porting

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

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:

  1. Extract the tools
  2. Get an Gingerbread 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!

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

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

SOURCES:
PDF in the docs folder on PatchROM (thank you Google Translate!)



Step 1: Preparing your computer
Building your own MIUI rom can only be done on Linux-systems (or *nix, not sure). In this guide I'll be using Ubuntu 11.10.

1. First of all, download a zipball from here. Extract it and place it in a directory (I extracted it in /home/MisterGT/MiCode. From now on, I'll call this the MiCode root directory.

2. Now, it is required to get the android-sdk tools on your computer. You can find those here. Again, extract them somewhere (I put them in /home/MisterGT/Micode/android-sdk-linux).

3. Update your PATH to include the android tools. In a terminal write:

Code:
export PATH=/location/to/android-sdk-linux/platform-tools:/location/to/android-sdk-linux/tools:$PATH

And change the paths accordingly. In my case this would mean

Code:
export PATH=/home/MisterGT/MiCode/android-sdk-linux/platform-tools:/home/MisterGT/MiCode/android-sdk-linux/tools:$PATH

4. On x64 systems you are required to install some 32-bit libraries or the android toolkit will not work. In a terminal write:

Code:
sudo apt-get install ia32-libs

Step 2: Find an appropriate source rom
The package will convert a standard rom to a MIUI rom, so you'll have to choose a ROM you want to use as base. According to the manual, there are two requirements:

  1. Android 2.3.3 - 2.3.7 supported
  2. ROM with root abilities
  3. Only HDPI devices are supported!

So after you've picked one, download it. In your MiCode root dir, create a new map and give it some name (I chose p990 as name). In that folder, put the ROM.zip and do not unzip it.

Step 3: Setting up the makefile
Firstly, copy the makefile from the i9100 directory which is an example. This is how it looks like:
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"

Explanations:

  • 'local-zip-file' = Name of your original ROM zip that you just downloaded
  • 'local-out-zip-file' = Name for your finished MIUI rom
  • 'local-modified-apps' = Apps that will be modified to fit in with the framework. They need to be modified because they contact with the system
  • 'local-miui-apps' = MIUI Apps that will be integrated into the zip
  • 'local-remove-apps' = Apps that will be removed from the original ROM
  • 'local-pre-zip' = Refers to codeblock that should be executed before the zip is done.
  • 'local-after-zip' = Refers to codeblock executed after the zip is completed
  • 'local-zip-misc' = The codeblock just described at 'local-pre-zip'. It adds some Google Apps and a buid.prop
  • 'local-test' = Another codeblock

Step 4: Decompiling apps
Before we can build the new rom, we must decompile some apps and put them in the device folder (so in my case that would be the p990 folder).
  • /system/framework/android.policy.jar
  • /system/framework/framework.jar
  • /system/framework/framework-res.apk
  • /system/framework/services.jar
  • /system/app/SystemUI.apk
  • and all apps that you defined at 'local-modified-apps' in the makefile

Update: as it seems now you need to copy the systemui folder from the i9100 folder. This fixes issues related to systemui.apk not building.

Step 5: Building the rom
Now we're done and we can start building the rom. Open up a terminal and go to the MiCode root dir. Then type:
Code:
source build/envsetup.sh cd p990  #Or whatever you called your device folder make zipfile

It will now do a lot of things to build the ROM. Unfortunately, I'm getting a lot of errors when it tries to modify the apps from 'local-modified-apps'. And I don't have any clue to fix it, don't know anything about that..

"

'via Blog this'

22 comments:

  1. thanx for sharing guyzz i like your your post..its very awesome...http://www.sabkigaadi.com/

    ReplyDelete
  2. http://realquiz.blogspot.in/ check out the blog thanks

    ReplyDelete
  3. Excellent written article and very helpful.
    CET

    http://www.cetjob.com
    http://www.mytelesupport.com

    ReplyDelete
  4. 10 Mind-Blowing MIUI 8 Features That Make Your Life Easy

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Jobs Chat is one of the biggest Indian Job Site so here you will getJobs in gujarat 2017-2018so


    Jobschat is one of the biggest Indian Job Site so here you will getFor Latest jobs in Tamilnaduso

    ReplyDelete
  7. thanks for Shearing Information Keep Shearing
    Admit Card 2017

    ReplyDelete
  8. i feel very happy this your webpage..thank you for this great article..
    Result 2017

    ReplyDelete
  9. The above information is very much useful to every one. keep writing like this.flipkart big billion day cashback offers

    ReplyDelete
  10. Thank for the information. I am really looking forward for your upcoming posts. Check my Website promo codes.

    for Exclusive Flipkart cashback offers vist my webiste once.

    ReplyDelete

  11. Flipkart CashBack Offers,telugu bloggers ,telugu websites

    Flipkart CashBack Offers - SBI, HDFC, ICICI, Citibank Cards,flipkart sbi debit card emi,flipkart upcoming offers on mobiles,flipkart credit card,flipkart cashback phonepe,flipkart credit card generator,flipkart cashback offer phonepe,flipkart american express,india fake debit card generator,flipkart american express gift card,sbi credit card offers on flipkart today,sbi flipkart offer,sbi debit card offers cash back,sbi flipkart offer 2018,,telugu bloggers ,telugu websites


    Offers.Flipkart .

    flipkart bank offers,flipkart cash back coupons, flipkart offers,flipkart cashback offers ,flipkart cashback offers,flipkart cash back offers,flipkart cashback coupons,flipkart cashback,Flipkart Cashback Offers,Flipkart Bank Offers, flipkart upcoming offers on mobiles, flipkart hdfc offer, flipkart icici offer,sbi credit card offers on flipkart today,sbi flipkart offer, hdfc credit card offers on flipkart, flipkart upcoming offers on mobiles, flipkart offers


    flipkart today deal offer,flipkart todays deal,flipkart best offer today,flipkart cashback offer today,flipkart mobile app offers today,flipkart mobile deals today

    "Flipkart Cashback Offers || Flipkart Bank Offers || Flipkart Deals 2018 ||" "flipkart upcoming offers on mobiles, hdfc credit card offers on flipkart 2018, sbi credit card offers on flipkart today, flipkart hdfc offer terms and conditions, sbi flipkart offer 2018, flipkart cashback phonepe, flipkart hdfc offer august 2018, flipkart icici offers

    Flipkart CashBack Offers July 2018 - SBI, HDFC, ICICI, Citibank Cards,Cashback Offers Coupons,

    Today Special deals offers,

    Flipkart 2018 deals,

    Flipkart Today offers


    Flipkart CashBack Offers June 2018 - SBI, HDFC, ICICI, Citibank Cards

    Best of Home Furnishing min 40% off:

    flipkart Mobile Accessories,flipkart Storage devices,flipkart Brands at best prices,flipkart Top Offers,flipkart Fashion for Travel Lovers,FLIPKART Great Offers On Furniture,FLIPKART Discounts for You,flipkart Deals of the Day


    flipkart axis cashback offer,

    flipkart discount coupon codes, flipkartcashbackoffers

    ReplyDelete
  12. Looking forward to reading more. Great article post. Thanks Again. Fantastic.

    BA 1st Year Result

    .

    ReplyDelete
  13. thanks for sharing. it's very helpful contant...BCom 3rd Year Result

    ReplyDelete
  14. Biit is one of the Most astonishing programming getting ready establishment in Laxmi Nagar. It is one of the notable Best advanced advertising foundation in Best software training institute in Laxmi Nagar local area which you can join in all actuality reasonable for you. They gives you the master understudy who settles your inquiry with respect to your inquiries and explain eevrything. You can approach 9311441524 or can visit to A-115 , First Floor , Near Panna Sweet, Shakarpur, Vikas Marg, Laxmi Nagar, Computer Institute, Opposite Metro Piller No. 33, Delhi, 110092.

    ReplyDelete
  15. The Cambridge English Academy (CEA) India is a one-of-a-kind online training institute in the globe, well-known for its OET | IELTS online training and foreign language tutoring training centre. It provides foreign language online training tutoring in French, Spanish, German, Japanese, and Arabic by highly experienced and qualified native speakers. It is a rapidly expanding teaching centre that provides superior occupational English exam and IELTS training online.
    For More Information To Visit Us - bbest ielts coaching in delhi

    ReplyDelete