1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.


Discussion in 'DEV & TRANSLATION GENERAL / RAZVOJNE & PREVODILAČKE OSNOVE' started by BalcanGSM, Mar 26, 2014.

  1. BalcanGSM

    BalcanGSM Founder


    VELIKO HVALA MIUI EN ČLANU @Tquetski Na Ogromnoj Pomoći U Kreiranju Ovog Programa I Tutorijala

    Manual MIUI General Porting Requirements
    - CyanogenMod 10.1 built without SElinux
    *Skia edits to fix Blur are optional
    - MIUI Donor Rom, usually a PatchROM based on the same CM codebase as your source-built CM.
    * Check Build.prop to confirm it shares the same 'Build ID' as your CM10.1 base
    * Build date / time should be similar to your CyanogenMod base.
    * MIUI version must be the same version as your Patch Resources, otherwise this will not work
    - WinRAR
    - Oracle JDK7

    This is not a guide, just a list of every change needed to fork MIUI that shares the same codebase as your source-built CM // Lucky base-ROM find (Gl with this option..)





    Build version


    MiCode version flags

    MIUI Ringtones

    Torch fix

    Kernel changes


    Shelld Service (It is the last service called)


    System Folder changes





    - Use CMs apns-conf.xml If you plan to have working data


    Open this in WinRAR and navigate to res/xml in your MIUI framework-res, replace them with the ones found in CMs Framework-res.apk:


    Decompile CMs Telephony-common.jar and find your device specific RIL file, it's generally listed in build.prop and will look something like this:

    In my case, mine is 'MotorolaQualcommRIL.smali'.

    Take your RIL file and place it somewhere, decompile MIUIs Telephony-common.jar and place your device RIL in the 'Telephony' folder, found at:

    Build it and place iit in MIUIs framework folder, this will resolve com.android.phone force quits.

    If you build this zip and it works, regardless of how things look resolution wise you're good, now I'll talk about patching resolution.

    PatchROM resources

    Grab the latest MIUI resources here.
    They can be used to correct resolution issues, just make sure to omit Downloadprovider.apk and MediaProvider.apk, also make sure the patch resources and your MIUI base version align.

    Closing Notes
    Ok, that's it, since you were on your game and picked a MIUI base that has the same code as your CM base there is no need to do any smali editing whatsoever.
    The most important thing when forking a Patch build is that your CM base uses a similar code revision and has the same Build ID, if these two conditions are met you can fork a PatchRom build based on CM or AOSP very quickly.

    With Patch resources not even the device resolution matters, all you need to do is find frameworks that will work in your phone.

    Strange Kernels

    kexec kernel is located in CMs etc folder, when compiling CM it will appear as if there is no kernel present.. but it's in the etc folder.
    Edits for MIUI will need to be made to the Ramdisk.img, which cannot be split in windows unless cygwin is used.

    There is a Ramdisk unpacking script, Google will be your friend for this format



    This is pretty minimal, I like minimal things and I feel it's self explanatory.
    I've posted the source to this at the bottom so folks can see exactly what is going on; options to backup files and so on are absent and will never be included ever.

    The methodology behind this has a lot of uses, If you have an already functional MIUI you may use it with this to fork new versions of MIUI to your phone.
    If you have built for an entire device tree it can be used to fork your CM based PatchROM build to all of the devices in it

    Manual methodology can be extrapolated from source it is also a mini-tutorial on what to move

    -CM10.1 source-built for MIUI
    * Boot.IMG modded for MIUI // Kexec Ramdisk modded for MIUI
    * Updater-Script modded for MIUI
    * Build.prop modded for MIUI

    -MIUIv5 Donor ROM
    *Must use the same/very similar codebase as your CM/AOSP
    *Ensure the Build ID is identical to cyanogenmod, found in build.prop

    -PatchROM Resources
    *some libs, apks and resolution bits for device specific forking are used.

    Download MiPatcher
    3/07/2014: MiPatcher 0.02b

    Getting started
    The 'root' folder is the working directory for this tool.

    Extract your CyanogenMod10.1 with modded stuff for MIUI into:

    root\ROM\bases\rom1 (or any folder name)

    These folders never has to be touched again, except to update build.prop version to reflect an updated MIUI (unless you use a generic version tag like 'V5-Devicename'.

    Extract your MIUI Donor ROM into:


    and finally, download PatchROM resources for your device and MIUI revision, extract the contents into:


    Optionally, extract the contents of any custom Keyboards, G-apps or a Camera into:

    root\other\keyboard(or camera or Gapps)

    When opening your PatchROM resources, there will be a folder inside of it denoting the branch your patch-tools belong to, extract the contents of THAT folder, which contains the folders: xHDPI xxHDPI Data and so on.

    How to use
    Select the Resolution your device uses, and also enter the Vendor RIL your phone uses which can be found in build.prop, you don't have to use /data, it does not matter.

    Once you've entered your RIL and Resolution, check the extended options for anything you may want and execute 'Make Workspace' and wait.

    No promts will remove message boxes containing instructions for the only manual semi-part of this, which is moving XMLs.

    One last step
    If you're a developer chances are WinRAR already associates .apk as a file type, it may not and you may have to set this manually.

    Toward the end of this, CM and MIUI Framework-res.apk will automatically be opened move the needed XMLs from CMs archive into MIUIs.

    After you can add keyboard or whatever else to the Workspace, zip the contents and flash it to begin using MIUI

    Special Thanks
    - Bmarko, thank you for making Blur edits public, you were the only person I've seen cover it thank you, thank you..!
    - To everyone I know who frequents MIUI porting team QQ, It's a rich experience getting to be around you talented people and I've learned a lot; thank you!
    - Brut.all and iBotPeaches, APKtool is amazing
    - MiCode developers!
    - AHK development team