[GUIDE][COMPLETE] Build or Port MIUI ROM to Any Device

Search This thread
Stuck in OPPO Logo and the devices restart to recovery automatically.

Hi,
I try using this guide, but not boot just oppo logo then the devices restart to recovery automatically.
Can you help me ?
Thanks.

Perhaps someone it will be useful.
I used MIUI8 based on CM13 and portes used CM13 for my device.
I add/replace/edited files like this:

System
  • In System folder my CM13 i deleted folders: "app", "priv-app", "media"
    and add folders: "app", "priv-app", "media" from MIUI8

  • from MIUI8 "system/bin" add to my CM13 "system/bin"
    Code:
    fdpp
    install-recovery.sh
    mcd
    miuindbg_post
    miuizip
    namespaceInit
    ssServices
    zip_utils
  • from MIUI8 "system/etc" add to my CM13 "system/etc"
    Code:
    cust/cust_prop_white_keys_list
    device_features/htc_m8.xml
    miui_feature
    permissions/android.hardware.ethernet.xml
    permissions/com.google.android.maps.xml
    permissions/com.securespaces.android.feature.encryption.xml
    permissions/com.securespaces.android.feature.hidden_space.xml
    permissions/com.securespaces.android.feature.notification_badges.xml
    permissions/com.securespaces.android.platform.full.xml
    permissions/com.securespaces.android.platform.version.xml
    permissions/com.securespaces.android.sdk.xml
    permissions/platform-miui.xml
    WhetstonePermission
    fonts.xml
    init.miui.rc
    install_app_filter.xml
    mcd_default.conf
    mdb_pub.key
    mdbversion
    miui-spn-conf.xml
    preloaded-classes
    system_fonts.xml
  • from MIUI8 "system/font" add to my CM13 "system/font"
    Code:
    Miui-Bold.ttf
    Miui-Light.ttf
    Miui-Regular.ttf
    Miui-Thin.ttf
    MiuiEx-Bold.ttf
    MiuiEx-Light.ttf
    MiuiEx-Regular.ttf
  • from MIUI8 "system/framework" add to my CM13 "system/framework" (but you may have to use the entire contents of a folder)
    Code:
    activation.jar
    android-support-v13.jar
    android-support-v7-recyclerview.jar
    cloud-common.jar
    com.google.android.maps.jar
    eventbus.jar
    framework-ext-res/framework-ext-res.apk
    framework-res.apk
    framework.jar
    gson.jar
    libspacescompat.jar
    microlog4android.jar
    miui-update.jar
    miuipushsdkshared.jar
    miuistatssdkshared.jar
    org.cyanogenmod.platform-res.apk
    org.cyanogenmod.platform.jar
    patchrom-core.jar
    patchrom-server.jar
    picasso.jar
    protobuf.jar
    security-device-credential-sdk.jar
    services.jar
    telephony-common.jar
    volley.jar
    wifi-service.jar
    zxing.jar
  • from MIUI8 "system/lib" add to my CM13 "system/lib"
    Code:
    libACRCloudEngine.so
    libadvanced_crypto.so
    libadvanced_crypto_jni.so
    libairtunes.so
    libairtunes_jni.so
    libams-1.1.7-m-mfr.so
    libams-1.1.7-mfr.so
    libanw.10.so
    libanw.13.so
    libanw.14.so
    libanw.18.so
    libanw.21.so
    libapssdk.so
    libautotoucher.so
    libavast-utils.so
    libavast-vps-interface.so
    libavcodec.so
    libavformat.so
    libavresample.so
    libavutil.so
    libBankCardRecognizer.so
    libbigo265mobile_nmob.so
    libbigofacelib.so
    libbigofacewapper.so
    libCameraEffectJNI.so
    libcdc.so
    libconnectionbase.so
    libdatabase_sqlcipher-ss40103.so
    libdce-1.1.6-mfr.so
    libdce-1.1.9-mfr.so
    libDecRes_sdk.so
    libDexHelper.so
    libdidi_secure.so
    libdigit_ocr.so
    libDToken.so
    libduokantext.so
    libentryexpro.so
    libfamily_jni.so
    libfdpp.so
    libfdpp_jni.so
    libffmpeg-miplayer.so
    libffmpeg_xm.so
    libgnustl_yynmob.so
    libhttpserver.so
    libhwocr_cntools_shared.so
    libhw_instanttrans.so
    libidcardquality_v1.0.3.so
    libImageSearchAPI.so
    libjavastackimpl.so
    libJeejenAisound.so
    libjeejenmsc.so
    libjni_load_serinum.so
    libjni_resource_drm.so
    libkcmutil.so
    libkeygen_jni.so
    libmediandk_19.so
    libmiio.so
    libmilinkconnection.so
    libminivenus.so
    libmiomxinterface_lc_19.so
    libmiomxinterface_mt_19.so
    libmiomxinterface_nv_19.so
    libmiomxinterface_qc_19.so
    libMiuiBluetooth.so
    libmiuiclassproxy.so
    libmiuidiffpatcher.so
    libMiuiGalleryNSGIF.so
    libmiuiimageutilities.so
    libmiuinative.so
    libmiuindbg.so
    libmiuinet_jni.so
    libmiui_chromium_support.so
    libmiui_security.so
    libmorpho_memory_allocator.so
    libmorpho_panorama.so
    libmp3lame.so
    libmresearch.so
    libnamespaces.so
    libnap.so
    libNative.so
    libnexcralbody_mc_jb.so
    libnexeditorsdk.so
    libnexralbody_audio.so
    libnmob_audiosdk.so
    libnmob_commonlib.so
    libnmob_newaudio.so
    libnmob_newvideo.so
    libnmob_util.so
    libnmob_videosdk.so
    liboctvm.so
    liboctvm_drv.so
    liboctvm_runtime.so
    liboctvm_utils.so
    libpatcher_game_jni.so
    libpatcher_jni.so
    libPinguoImageSDK.so
    libplayer_jni.so
    libpowerkeeper_jni.so
    libQuadrangleRecognizer.so
    libsechook.so
    libsecurities_sdk.so
    libsecuritysdk-3.1.27.so
    libsecurity_device_credential_sdk.so
    libsgmain.so
    libsgmainso-5.1.2011.so
    libShare.so
    libshell.so
    libshellservice.so
    libshell_jni.so
    libShopSigned.so
    libsic_helper.so
    libsmsprotocol.so
    libspaces_jni.so
    libsqlcipher_android-ss40103.so
    libssutil.so
    libtbdecode.so
    libtcp.so
    libthemeutils_jni.so
    libtinyxml.so
    libTmsdk-2.0.8-mfr.so
    libTmsdk-2.0.9-mfr.so
    libunipaychsec.so
    libvip_channel.so
    libvip_channel_iface.so
    libwebp.so
    libweibosdkcore.so
    libweibosdkcore_sogou.so
    libwhetstone_jni.so
    libwhetstone_sdk.so
    libwrapnexpcmcalbody.so
    libxiaomimediaplayer.so
    libxiaomiplayerwrapper.so
    libxl_stat.so
    libxl_thunder_iface.so
    libxl_thunder_sdk.so
    libxmpass_sdk_patcher.so
    xmpass_libweibosdkcore.so

    from MIUI8 "system/lib64" add to my CM13 "system/lib64"
    Code:
    libACRCloudEngine.so
    libadvanced_crypto.so
    libadvanced_crypto_jni.so
    libairtunes.so
    libairtunes_jni.so
    libams-1.1.7-m-mfr.so
    libams-1.1.7-mfr.so
    libapssdk.so
    libautotoucher.so
    libavast-utils.so
    libavast-vps-interface.so
    libavcodec.so
    libavformat.so
    libavresample.so
    libavutil.so
    libBankCardRecognizer.so
    libbigo265mobile_nmob.so
    libbigofacelib.so
    libbigofacewapper.so
    libCameraEffectJNI.so
    libcdc.so
    libconnectionbase.so
    libdce-1.1.9-mfr.so
    libDexHelper.so
    libdidi_secure.so
    libdigit_ocr.so
    libduokantext.so
    libfdpp.so
    libfdpp_jni.so
    libffmpeg_xm.so
    libgnustl_yynmob.so
    libhttpserver.so
    libhwocr_cntools_shared.so
    libhw_instanttrans.so
    libidcardquality_v1.0.3.so
    libjavastackimpl.so
    libjni_load_serinum.so
    libjni_resource_drm.so
    libkeygen_jni.so
    libmiio.so
    libmilinkconnection.so
    libMiuiBluetooth.so
    libmiuiclassproxy.so
    libmiuidiffpatcher.so
    libMiuiGalleryNSGIF.so
    libmiuiimageutilities.so
    libmiuinative.so
    libmiuindbg.so
    libmiuinet_jni.so
    libmiui_chromium_support.so
    libmiui_security.so
    libmorpho_memory_allocator.so
    libmorpho_panorama.so
    libmp3lame.so
    libnamespaces.so
    libnap.so
    libnexcralbody_mc_jb.so
    libnexeditorsdk.so
    libnexralbody_audio.so
    libnmob_audiosdk.so
    libnmob_commonlib.so
    libnmob_newaudio.so
    libnmob_newvideo.so
    libnmob_util.so
    libnmob_videosdk.so
    liboctvm.so
    liboctvm_drv.so
    liboctvm_runtime.so
    liboctvm_utils.so
    libpatcher_game_jni.so
    libpatcher_jni.so
    libPinguoImageSDK.so
    libplayer_jni.so
    libpowerkeeper_jni.so
    libQuadrangleRecognizer.so
    libsechook.so
    libsecurity_device_credential_sdk.so
    libsgmain.so
    libsgmainso-5.1.2011.so
    libShare.so
    libshell.so
    libshellservice.so
    libshell_jni.so
    libsmsprotocol.so
    libssutil.so
    libtbdecode.so
    libtcp.so
    libthemeutils_jni.so
    libtinyxml.so
    libTmsdk-2.0.9-mfr.so
    libunipaychsec.so
    libvip_channel.so
    libvip_channel_iface.so
    libweibosdkcore.so
    libwhetstone_jni.so
    libwhetstone_sdk.so
    libwrapnexpcmcalbody.so
    libxl_stat.so
    libxl_thunder_iface.so
    libxl_thunder_sdk.so
    libxmpass_sdk_patcher.so
    xmpass_libweibosdkcore.so
  • from MIUI8 "system/xbin" add to my CM13 "system/xbin"
    Code:
    busybox
    miuioneshots
    mqsasd
    shelld
  • in system build.prop in my CM13

    red line - replace, green line - add in end
    Code:
    ro.config.notification_sound=[COLOR="Red"]pixiedust.ogg[/COLOR]
    ro.config.alarm_alert=[COLOR="red"]Alarm_Classic.ogg[/COLOR]
    ro.config.ringtone=[COLOR="red"]Ring_Synth_04.ogg[/COLOR]
    ...
    [COLOR="Green"]ro.miui.ui.version.code=5
    ro.miui.ui.version.name=V8
    ro.config.sms_received_sound=FadeIn.ogg
    ro.config.sms_delivered_sound=MessageComplete.ogg
    persist.sys.strictmode.disable=true
    ro.product.mod_device=Unknown[/COLOR]

    if need navigation bar also add in end this line
    Code:
    [COLOR="green"]qemu.hw.mainkeys=0[/COLOR]



Boot.img

(Green line - add, Red line - replace)

boot.img-ramdisk:

  • default.prop:
    Code:
    #
    # ADDITIONAL_DEFAULT_PROPERTIES
    #
    ro.adb.secure=[COLOR="Red"]0[/COLOR]
    ro.secure=[COLOR="red"]0[/COLOR]
    security.perf_harden=1
    ro.allow.mock.location=[COLOR="red"]1[/COLOR]
    ro.debuggable=[COLOR="red"]0[/COLOR]
    ro.zygote=zygote32
    dalvik.vm.image-dex2oat-Xms=64m
    dalvik.vm.image-dex2oat-Xmx=64m
    dalvik.vm.dex2oat-Xms=64m
    dalvik.vm.dex2oat-Xmx=512m
    ro.dalvik.vm.native.bridge=0
    debug.atrace.tags.enableflags=0
    ro.enable_boot_charger_mode=1
    ro.usb.pid_suffix=195
    [COLOR="Green"]persist.service.adb.enable=0
    persist.sys.usb.control=disable[/COLOR]
    #
    # BOOTIMAGE_BUILD_PROPERTIES
    #
    ro.bootimage.build.date=Mon Oct 10 00:45:42 PDT 2016
    ro.bootimage.build.date.utc=1476085542
    ro.bootimage.build.fingerprint=Sony/cm_huashan/huashan:6.0.1/M4B30X/e4e845e232:userdebug/test-keys
    persist.sys.usb.config=[COLOR="red"]adb[/COLOR]
  • init.cm.rc
    Code:
    # CyanogenMod Extras
    [COLOR="Green"]#[/COLOR]import /init.superuser.rc
    ...
  • init.environ.rc
    Code:
    # set up the global environment
    on init
        export ANDROID_BOOTLOGO 1
        export ANDROID_ROOT /system
        export ANDROID_ASSETS /system/app
        export ANDROID_DATA /data
        export ANDROID_STORAGE /storage
        export EXTERNAL_STORAGE /sdcard
        export ASEC_MOUNTPOINT /mnt/asec
        export BOOTCLASSPATH /system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/apache-xml.jar:/system/framework/org.apache.http.legacy.boot.ja[COLOR="green"]r:/system/framework/tcmiface.jar:/system/framework/libstagefrighthw.jar:/system/framework/patchrom-core.jar:/system/app/miui/miui.apk:/system/app/miuisystem/miuisystem.apk[/COLOR]
        export SYSTEMSERVERCLASSPATH /system/framework/org.cyanogenmod.platform.jar:/system/framework/org.cyanogenmod.hardware.jar:/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar[COLOR="Green"]:/system/framework/patchrom-server.jar[/COLOR]
        export LD_PRELOAD libsigchain.so
  • init.rc
    Code:
    # Copyright (C) 2012 The Android Open Source Project
    #
    # IMPORTANT: Do not create world writable files or directories.
    # This is a common source of Android security bugs.
    #
    
    import /init.environ.rc
    import /init.usb.rc
    import /init.${ro.hardware}.rc
    import /init.usb.configfs.rc
    import /init.${ro.zygote}.rc
    import /init.trace.rc
    [COLOR="Green"]import /init.miui.rc[/COLOR]
    # Include CM's extra init file
    import /init.cm.rc
    ...
  • init.miui.rc & init.miui8.rc - This file will be added in ramdisk. Unpack ZIP-archive with these files: View attachment 3907628

boot.img-cmdline:
Code:
[COLOR="Green"]androidboot.selinux=permissive[/COLOR] androidboot.hardware=qcom androidboot.baseband=msm user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 vmalloc=340M
 

Palugula uday

New member
Aug 24, 2017
3
0
Use MIMAX 2

First of all thanks for this helpful tutorial.
I also want to port MIUI 9 for my 10 or G device because still now no developers build any custom ROMs for this device only TWRP recovery image luckily build.
I'm a noob here. though I decide to build but don't know is it possible or not. Let's Get to the point.
1) I have chosen the MIUI 9 of Redmi Note 4 for porting, everything (GPU, ram, processor architecture, DPI ) is similar in both the devices but the Problem is "REDMI NOTE 4 HAVE SD 625 AND 10 OR G HAVE SD 626" . Please tell me will it work or not?
2) karnal source code and stock rom are same or not? which are the main differences between these?
3) is it possible for me to make a custom ROM from karnal source code?

Please Answer.

You can use MI MAX 2 as they both have same processor it will work for you !
 

vancouvertnt

Member
Apr 20, 2015
17
1
Hello, I am following the tutorial, from the vendor folder there is nothing to carry ?? I am with a miui12 base.
Regards.
 
Last edited:

Bap062

Senior Member
Nov 29, 2017
69
22
This guide should be update for android 10 rom atleast....google changed so much in android and its not easy to do with vendor partition.....if anyone know about porting for android 10 rom please update here.....no perfect and complete guide available on net nowdays for android 9 or 10
 

Shigenta

New member
Jul 31, 2021
3
0
13
Huawei P Smart
Hi, I hope this guide will help me port the firmware. I have already ported the firmware, only boot.img remains. Can you help port boot.img if I have a boot loop?
 

Owais00

New member
Oct 11, 2022
2
0
How can i decompile & recompile miui settings apk

I got errors when i recompile settings apk.

Framework-res.apk
Framework-ext-res.apk
Miui.apk
Miuisystem.apk


Im attached these frameworks apktool

please help me how can i recompile miui settings apk










 

HYDRA13

New member
Oct 25, 2022
2
0
Sir thank you for the guide but it's not similar to miui 12 could you please tell me how to port miui 12 or 13 based rom please thank you
 

Top Liked Posts

  • There are no posts matching your filters.
  • 161
    attachment.php


    Introduction:-

    Hey guys! Here's a complete tutorial for building or porting MIUI to your device! I know there are already some guides for it but I felt none of them were noob-friendly and many were confusing and missing some important instructions. So I decided to share this complete guide which will teach you how to build MIUI from scratch. This is a basic guide in which I have taken building latest MIUI v7 as example. So let's start! :D

    POST 1- Guide to build MIUI using PatchROM Sources
    POST 2- Modifying boot.img
    POST 3- Guide to port MIUI from another device

    attachment.php


    Basically,There are two methods by which you can build MIUI ROM for your device.
    1. Build from source using PatchROM Method
    2. Port manually from another device which already has MIUI

    Let's start with PatchROM Method:-

    Requirements:-
    1. Ubuntu 14.04 64-bit. (Installed as virtual machine like in VMware will also work)
    2. Base ROM for your device.
      NOTE- Preferably take pure AOSP built for your device as base ROM rather than CyanogenMod. You'll get less rejects while patching MIUI framework. But CM works too! Your choice.. ;)
    3. Apktool. You can use Advanced Apktool by BDFreak. It's easier to use.
    4. Working brain and a lot of patience!! :D

    Prerequisites:-
    • First of all, take framework-res.apk, framework.jar, framework2.jar, services.jar, android.policy.jar and telephony-common.jar from your base ROM zip.
    • Now using apktool, decompile all above files.
    • If you're using advanced apktool then go to 3-Out folder and rename the respective folders to-
      PHP:
      framework-res
      framework.jar.out
      framework2.jar.out
      services.jar.out
      android.policy.jar.out 
      telephony-common.jar.out
    • We'll need these folders further for MIUI framework patching.
    STEP-1: Preparing build environment
    • Switch to Ubuntu 14.04. We'll have to prepare ROM building environment.
    • Next step is to setup android sdk. Follow THIS guide. (Look at 2nd answer graphical image explanation. Follow till step 5.)
    • Now run the following commands as superuser from terminal-
      PHP:
      sudo apt-get update
      Then after run this-
      sudo apt-get install bison build-essential curl flex git git-core gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-7-jdk openjdk-7-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev unzip lib32readline-gplv2-dev lib32z1-dev make python-networkx zlib1g-dev:i386 phablet-tools
    • All the necessary packages are now installed. Now the next step is to configure repository.
    • In terminal,run following commands-

      PHP:
      mkdir -p ~/bin

      PHP:
      PATH=~/bin:$PATH

      PHP:
      cd ~/bin

      PHP:
      curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

      PHP:
      chmod a+x ~/bin/repo

      PHP:
      mkdir ~/patchrom

      PHP:
      cd ~/patchrom

      PHP:
      repo init -u git://github.com/MiCode/patchrom.git -b miui-7 -m android-4.4.4.xml
    • Now you'll have to configure git. Run following commands in terminal-

      Code:
      git config --global user.email [COLOR="Red"]ENTER_YOUR_EMAIL_ID_HERE[/COLOR]

      Code:
      git config --global user.name [COLOR="Red"]ENTER_YOUR_REAL_NAME_HERE[/COLOR]
    • Now it's time to download the MIUI source code! Run the following command in terminal-

      PHP:
      repo init -u git://github.com/MiCode/patchrom.git -b miui-7 -m android-4.4.4.xml

      PHP:
      repo sync
    • Now grab a cup of coffee while the MIUI source gets downloaded. Required time depends on speed of your internet connection. The MIUI source is of size about 600-700 MB (With .repo total is 1.5 GB).
    • After the source is downloaded,create a new directory in /home. Name it whatever you want. (Preferably codename of your device) In my case, it's taoshan.

      PHP:
      cd /home/stryder/

      PHP:
      mkdir taoshan

      PHP:
      cd taoshan
    • Now create a makefile for your device. If you want, you can make changes to this my makefile and use.

      PHP:
      gedit makefile

      You can copy the following content in makefile (Don't forget to make changes in it according to your device) and save it.
      Code:
      #
      # Makefile for taoshan
      #
      
      # The original zip file, MUST be specified by each product
      local-zip-file     := stockrom.zip
      
      # The output zip file of MIUI rom, the default is porting_miui.zip if not specified
      local-out-zip-file := MIUI7_taoshan.zip
      
      # All apps from original ZIP, but has smali files chanded
      local-modified-apps :=
      
      local-modified-priv-apps := 
      
      local-modified-jars := 
      
      # All apks from MIUI
      local-miui-removed-apps := 
      
      local-miui-removed-priv-apps := 
      
      local-miui-modified-apps := 
      
      # All apps need to be removed from original ZIP file
      local-remove-apps   := Gallery2 Exchange2
      
      # Config density for co-developers to use the aaps with HDPI or XHDPI resource,
      # Default configrations are HDPI for ics branch and XHDPI for jellybean branch
      local-density := XHDPI
      
      PORT_PRODUCT := taoshan
      
      # 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-pre-zip-misc
      #local-after-zip:= local-put-to-phone
      
      # 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 phoneapps.mk
      
      include $(PORT_BUILD)/porting.mk
      
      local-pre-zip-misc:
      	@echo Update boot.img
      	cp other/boot.img $(ZIP_DIR)/boot.img
      	
      	@echo Update build.prop
      	cp other/build.prop $(ZIP_DIR)/system/build.prop
      
      	@echo Delete some unneeded files
      	rm -rf $(ZIP_DIR)/system/etc/.has_su_daemon
      
      	rm -rf $(ZIP_DIR)/system/priv-app/Dialer.apk
      
      	rm -rf $(ZIP_DIR)/system/priv-app/Keyguard.apk
      
      	rm -rf $(ZIP_DIR)/system/priv-app/SystemUI.apk
      
      	rm -rf $(ZIP_DIR)/system/priv-app/VoiceDialer.apk
      
      	rm -rf $(ZIP_DIR)/system/priv-app/Launcher3.apk
      
      	rm -rf $(ZIP_DIR)/system/priv-app/ParanoidOTA.apk
      
      	rm -rf $(ZIP_DIR)/system/priv-app/ThemeChooser.apk
      
      	rm -rf $(ZIP_DIR)/system/priv-app/ThemesProvider.apk

      Explanations:-
    • 'local-zip-file' = Name of your original Base ROM zip
    • '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-remove-apps' = Apps that will be removed from the original ROM
    • 'local-pre-zip' = Refers to code-block that should be executed before the zip is done.
    • 'local-after-zip' = Refers to code-block executed after the zip is completed
    • 'local-zip-misc' = The code-block just described at 'local-pre-zip'. It adds some Google Apps and a build.prop
    • 'local-test' = Another code-block
    • Now, manually copy the previously decompiled framework folders to your device folder.
      PHP:
      framework-res
      framework.jar.out
      framework2.jar.out
      services.jar.out
      android.policy.jar.out 
      telephony-common.jar.out
    • Next,copy your Base ROM zip in your device folder.
    • Now move to patchrom folder.

      PHP:
      cd ~/patchrom

      PHP:
      source build/envsetup.sh
    • Again move to your device folder and start MIUI framework patching.

      PHP:
      cd /home/stryder/taoshan

      PHP:
      make firstpatch
    • Now a new folder folder temp will be created. In that you'll find the reject folder in which there will be rejects which you have to fix manually. Follow THIS excellent guide by @JavierAlonso to fix rejects. Also see THIS guide.
    • After fixing all the rejects, type following command to create a flashable zip of your MIUI ROM.

      PHP:
      make fullota

      or you can also use

      PHP:
      make zipfile
    • With this, the flashable zip file is built. Now follow the tutorial from next post to modify your boot.img and include this new boot.img in your flashable MIUI ROM zip. Then flash the zip from recovery and enjoy your source built MIUI ROM!
    • Sometimes, your device might get stuck on bootanimation so in this case, take LOGCAT and look for the error and solve it. You can use some tools like Advanced Logcat Viewer to read the log. :)
    100
    Port MIUI from another device

    Requirements:-
    • 7-zip, Winrar or similar software
    • Notepad++

    Instructions:-
    First of all, make 2 folders- 1. BASE ROM 2. PORT ROM

    attachment.php


    • What is Base ROM: It is the ROM which is built for your device. (AOSP or CM etc.)
    • What is Port ROM: MIUI ROM of other device which you want to port to your device.
    • NOTE- It's better if the port device and your device has same CPU architecture and specifications. If you couldn't find same specification device then try the device having almost similar specification of your device.
    • Now extract the Base ROM zip in BASE ROM folder and Port ROM zip in PORT ROM folder.
    • Next, Delete addon.d (If present), app, framework, fonts, media and priv-app folder in System folder of BASE ROM.
      attachment.php
    • Now copy addon.d (If present), app, framework, fonts, media and priv-app folder from system folder of PORT ROM to system folder of BASE ROM.
    • Now open etc folder in both ROMs folder. Go to init.d folder of PORT and copy and replace any extra files except 00banner to init.d of BASE ROM.
    • Now open permissions folder in etc of both ROMs and copy and replace all the permissions files from PORT ROM to your BASE ROM folder except handheld_core_hardware.xml and platform.xml. (In case of CM based BASE ROM, also don't replace org.cyanogenmod.hardware.xml).
    • Also copy any extra folder available in PORT ROM etc/ to BASE ROM etc/ e.g. miui_feature folder.
    • Now open your system_fonts.xml in etc folder of BASE ROM and copy this before </familyset> end of file
      PHP:
          <family>
              <nameset>
                  <name>miui</name>
              </nameset>
              <fileset>
                  <file>Miui-Regular.ttf</file>
                  <file>Miui-Bold.ttf</file>
              </fileset>
          </family>
      
          <family>
              <nameset>
                  <name>miuiex</name>
              </nameset>
              <fileset>
                  <file>MiuiEx-Regular.ttf</file>
                  <file>MiuiEx-Bold.ttf</file>
              </fileset>
          </family>
      
          <family>
              <nameset>
                  <name>miuiex-light</name>
              </nameset>
              <fileset>
                  <file>MiuiEx-Light.ttf</file>
              </fileset>
          </family>
    • Now copy all the extra files from PORT ROM bin, lib and xbin folder to BASE ROM respective folders. Remember, DO NOT REPLACE anything. Just copy and paste and skip the files with same name.
    • Now, open build.prop of BASE ROM. You can change these value to anything you like-
      PHP:
      ro.build.id=
      ro.build.display.id=
      ro.build.date=
      ro.build.date.utc=
      ro.product.locale.language=en
      ro.product.locale.region=US
      ro.cm.version=
      ro.modversion=
    • Now copy paste these values at the end of your BASE ROM build.prop. You can edit the fields but keep the structure same.You can look at PORT ROM build.prop for reference.
      PHP:
      ro.build.description=devicename-user 4.4.2 yourname C2104XXUCNG1 release-keys
      ro.build.fingerprint=devicemanufacturer/devicemodel/device:4.4.2/yourname/C2104XXUCNG1:user/release-keys
      ro.product.model=Xperia L
      ro.product.device=taoshan
      ro.build.characteristics=default
      #MIUI_Features
      ro.miui.has_real_blur=0
      ro.miui.has_handy_mode_sf=1
      ro.config.sms_received_sound=FadeIn.ogg
      ro.config.sms_delivered_sound=MessageComplete.ogg
      ro.product.manufacturer=Xiaomi
      ro.config.elder-ringtone=Angel.mp3
      persist.sys.mitalk.enable=true
      ro.miui.ui.version.code=5
      ro.miui.ui.version.name=V7
      persist.sys.strictmode.disable=true
      ro.product.mod_device=yourdevice
    • Change these fields in BASE ROM build.prop according to PORT ROM build.prop-
      PHP:
      ro.config.notification_sound=
      ro.config.alarm_alert=
      ro.config.ringtone=
    • If your device has On-screen buttons, then add this value at the end of BASE ROM build.prop-
      PHP:
      qemu.hw.mainkeys=0
    • Now we're done with build.prop.
    • Next, open META-INF/com/google/android/updater-script from BASE ROM using Notepad++ and change, compare and replace all the symlink and set_metadata lines in updater-script according to PORT ROM updater-script.If some extra lines are there in BASE ROM updater-script, keep it as it is.
      NOTE:-I have attached one sample updater-script with this post. Look below. You can refer from that if you feel any difficulty. :cowboy:
    • Add these before unmount("/system"); at the end of updater-script-
      PHP:
      set_perm(0, 1000, 06750, "/system/xbin/shelld");
      run_program("/sbin/busybox", "mount", "/data");
      package_extract_dir("data", "/data");
      package_extract_file("META-INF/com/miui/relink", "/tmp/relink");
      set_perm(0, 0, 0555, "/tmp/relink");
      run_program("/tmp/relink");
      delete("/tmp/relink");
      set_perm_recursive(1000, 1000, 0755, 0644, "/data/miui");
      set_metadata("/system/bin/debuggerd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
      set_metadata("/system/bin/debuggerd_vendor", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:debuggerd_exec:s0");
      set_metadata("/system/xbin/su", "uid", 0, "gid", 2000, "mode", 06755, "capabilities", 0x0, "selabel", "u:object_r:su_exec:s0");
      delete_recursive("/data/miui/preinstall_apps");
      delete_recursive("/data/miui/cust/preinstall_apps");
      ui_print("Installation finished...Enjoy!");
      unmount("/data");
    • Also copy META-INF/com/miui and data folder to BASE ROM from PORT ROM.
    • Now modify your BASE ROM boot.img using the tutorial from previous post and put that new boot.img in BASE ROM folder.
    • Finally, select META-INF, system, boot.img, file_contexts(If present) and data folder in BASE ROM.
    • Right click and select Add to Archive. Select Zip. Type the name of zip. (Don't delete ".zip" at the end!) Click OK.

      attachment.php

    • Now you're ready to flash this zip from recovery.
    • Sometimes, your device might get stuck on bootanimation so in this case, take LOGCAT and look for the error and solve it. You can use some tools like Advanced Logcat Viewer to read the log. Look HERE for fixing bootloop. :D

    I hope you guys understood how to build and port MIUI. I wish you good luck! If you get stuck anywhere, If you become successful building MIUI, feel free to post here. Also if you succeed, I'll appreciate if you give me credits and add link to this thread in your ROM thread on XDA. :)
    76
    Modifying boot.img

    Now, let's modify the boot.img from base ROM zip to it make compatible with our MIUI ROM.
    • First of all, download any boot image kitchen or editor. I used Android Image Kitchen for Windows.
    • Assuming you're using the same kitchen, Extract the files from Android Image Kitchen in a separate folder. Copy your base ROM boot.img in that folder.
    • Now drag and drop the boot.img on unpackimg. The kernel files will be extracted in ramdisk and split_img folder.
    • We have to modify the ramdisk so move to that. In sbin folder, you'll see the extracted files.
    • Now there are two chances- First, Your ramdisk is already extracted with various folders and files. In that case ignore the next steps and directly modify in respective files using Notepad++.
    • While in second case, you'll get the ramdisk as ramdisk.cpio file. If you get this the you'll have to move to Ubuntu again for extracting it.
    • Now in Ubuntu, copy your ramdisk.cpio in a seperate folder (suppose in stryder folder) in your home directory.
    • Now, open terminal and run the following command-[No need as superuser]
      PHP:
      cd stryder
      PHP:
      cpio -i -F ramdisk.cpio
    • Some output will be shown in terminal as 2320 blocks or something like that!
    • Now in your folder, you'll see the extracted ramdisk files.
    • Now comes the actual modification.
    • First of all, download attached zip and extract the files in appropriate folders. (If the folder is not present, add that folder).
    • Open default.prop and edit the lines like this-
      PHP:
      #
      # ADDITIONAL_DEFAULT_PROPERTIES
      #
      ro.adb.secure=0
      ro.secure=0
      ro.allow.mock.location=0
      ro.debuggable=1
      persist.sys.usb.config=mtp,adb
      persist.service.adb.enable=1
      persist.service.debuggable=1
    • Save the changes and open init.cm.rc (In case of CyanogenMod) or init.pa.rc (In case of AOSPA). Add # before the import line like this-
      PHP:
      # Superuser
      #import /init.superuser.rc
    • Save this file and now open init.rc.
    • At the end of init.rc file, add these lines-
      PHP:
      #service for shelld
      service shelld /system/xbin/shelld
          class main
      
      #service for su
      service su_daemon /system/xbin/su --daemon
          class main
          oneshot
      
      service lbesec /system/xbin/lbesec
          class main
          oneshot
    • Save this file and then open seapp_contexts.
    • In that file, add at the end-
      PHP:
      user=theme seinfo=platform domain=platform_app type=platform_app_data_file
      user=backup seinfo=platform domain=platform_app type=platform_app_data_file
      user=updater seinfo=platform domain=platform_app type=platform_app_data_file
      user=theme_man domain=system_app type=system_data_file
    • Also modify these lines (if present) to look like this-
      PHP:
      user=_app domain=untrusted_app type=app_data_file
      user=_app seinfo=platform domain=platform_app type=app_data_file
      user=_app seinfo=shared domain=shared_app type=app_data_file
      user=_app seinfo=media domain=media_app type=app_data_file
      user=_app seinfo=release domain=release_app type=app_data_file
    • Save this file and if present, open init.qcom.rc.
    • And before this line (at the end)-
      PHP:
      on property:sys.boot_completed=1
    • Add these lines-
      PHP:
      service shelld /system/xbin/shelld
          class main
    • Save the file. Now it's time to repack your ramdisk.
    • First, move your original ramdisk.cpio from the extracted folder to /home. That is, if your extracted ramdisk is in
      PHP:
      /home/stryder/
      Move original ramdisk.cpio file to-
      PHP:
      /home/
    • After that, run this command in terminal-
      PHP:
      cpio -i -t -F ../ramdisk.cpio | cpio -o -H newc -O ../ramdisk_new.cpio
    • Now a new file ramdisk_new.cpio will be created. Take a look if it's of the same size as the original one just a few bytes difference.
    • Also open this ramdisk_new.cpio and make sure you have the newly added files in it. (Ex. otad in bin folder etc.)
    • Now move this ramdisk_new.cpio to previously extracted Android Image kitchen ramdisk/sbin/ directory.
    • Delete the original ramdisk.cpio from it and rename the ramdisk_new.cpio to ramdisk.cpio.
    • Now come back and directly run repackimg. The modified image_new will be generated. Rename it to boot and include this modified boot.img in your MIUI ROM zip. Now you can proceed to flash your MIUI ROM!
    Special Thanks- @Zenamp
    34
    Frequently Asked Questions

    The PatchROM technique (post #1 tutorial) works for Android 4.4 KitKat, meaning that you have to find a KitKat AOSP or CyanogenMod 11 ROM for your device as a base, STRYDER said that he doesn't recommend the OEM Stock ROM as a base due to vendor stuff that might cause more rejects (and I think if the stock ROM is not deodexed, it's worse).So preferably take aosp kitkat rom as base. Patchrom method won't work for Android 5.0 Lollipop and higher.

    If you want to port a MIUI Lollipop/Marshmallow ROM to a Lollipop/Marshmallow based device, you will have to do the "port from other device" technique (post #3), which is to find MIUI ROM for another device with the same Android version, chipset, screen resolution and follow the port method. Use this guide for porting to qualcomm and broadcom devices preferably. For mediatek devices, I suggest following porting guides from MIUI forums. Though this guide might work as well. :)

    Question:- Can I port MIUI to XXX device?
    Answer:- You'll never know if you don't try! :p

    Question:- Can you please port/help porting MIUI to XXX device?
    Answer:- Sorry, I won't port. It's not possible for me to accept port requests, that's why I wrote this guide so that you can port it yourself and test it out on the device you own! About helping, post your issues/logs here in this thread. Me or any other members will help you as they can. :)
    10
    Perhaps someone it will be useful.
    I used MIUI8 based on CM13 and portes used CM13 for my device.
    I add/replace/edited files like this:

    System
    • In System folder my CM13 i deleted folders: "app", "priv-app", "media"
      and add folders: "app", "priv-app", "media" from MIUI8

    • from MIUI8 "system/bin" add to my CM13 "system/bin"
      Code:
      fdpp
      install-recovery.sh
      mcd
      miuindbg_post
      miuizip
      namespaceInit
      ssServices
      zip_utils
    • from MIUI8 "system/etc" add to my CM13 "system/etc"
      Code:
      cust/cust_prop_white_keys_list
      device_features/htc_m8.xml
      miui_feature
      permissions/android.hardware.ethernet.xml
      permissions/com.google.android.maps.xml
      permissions/com.securespaces.android.feature.encryption.xml
      permissions/com.securespaces.android.feature.hidden_space.xml
      permissions/com.securespaces.android.feature.notification_badges.xml
      permissions/com.securespaces.android.platform.full.xml
      permissions/com.securespaces.android.platform.version.xml
      permissions/com.securespaces.android.sdk.xml
      permissions/platform-miui.xml
      WhetstonePermission
      fonts.xml
      init.miui.rc
      install_app_filter.xml
      mcd_default.conf
      mdb_pub.key
      mdbversion
      miui-spn-conf.xml
      preloaded-classes
      system_fonts.xml
    • from MIUI8 "system/font" add to my CM13 "system/font"
      Code:
      Miui-Bold.ttf
      Miui-Light.ttf
      Miui-Regular.ttf
      Miui-Thin.ttf
      MiuiEx-Bold.ttf
      MiuiEx-Light.ttf
      MiuiEx-Regular.ttf
    • from MIUI8 "system/framework" add to my CM13 "system/framework" (but you may have to use the entire contents of a folder)
      Code:
      activation.jar
      android-support-v13.jar
      android-support-v7-recyclerview.jar
      cloud-common.jar
      com.google.android.maps.jar
      eventbus.jar
      framework-ext-res/framework-ext-res.apk
      framework-res.apk
      framework.jar
      gson.jar
      libspacescompat.jar
      microlog4android.jar
      miui-update.jar
      miuipushsdkshared.jar
      miuistatssdkshared.jar
      org.cyanogenmod.platform-res.apk
      org.cyanogenmod.platform.jar
      patchrom-core.jar
      patchrom-server.jar
      picasso.jar
      protobuf.jar
      security-device-credential-sdk.jar
      services.jar
      telephony-common.jar
      volley.jar
      wifi-service.jar
      zxing.jar
    • from MIUI8 "system/lib" add to my CM13 "system/lib"
      Code:
      libACRCloudEngine.so
      libadvanced_crypto.so
      libadvanced_crypto_jni.so
      libairtunes.so
      libairtunes_jni.so
      libams-1.1.7-m-mfr.so
      libams-1.1.7-mfr.so
      libanw.10.so
      libanw.13.so
      libanw.14.so
      libanw.18.so
      libanw.21.so
      libapssdk.so
      libautotoucher.so
      libavast-utils.so
      libavast-vps-interface.so
      libavcodec.so
      libavformat.so
      libavresample.so
      libavutil.so
      libBankCardRecognizer.so
      libbigo265mobile_nmob.so
      libbigofacelib.so
      libbigofacewapper.so
      libCameraEffectJNI.so
      libcdc.so
      libconnectionbase.so
      libdatabase_sqlcipher-ss40103.so
      libdce-1.1.6-mfr.so
      libdce-1.1.9-mfr.so
      libDecRes_sdk.so
      libDexHelper.so
      libdidi_secure.so
      libdigit_ocr.so
      libDToken.so
      libduokantext.so
      libentryexpro.so
      libfamily_jni.so
      libfdpp.so
      libfdpp_jni.so
      libffmpeg-miplayer.so
      libffmpeg_xm.so
      libgnustl_yynmob.so
      libhttpserver.so
      libhwocr_cntools_shared.so
      libhw_instanttrans.so
      libidcardquality_v1.0.3.so
      libImageSearchAPI.so
      libjavastackimpl.so
      libJeejenAisound.so
      libjeejenmsc.so
      libjni_load_serinum.so
      libjni_resource_drm.so
      libkcmutil.so
      libkeygen_jni.so
      libmediandk_19.so
      libmiio.so
      libmilinkconnection.so
      libminivenus.so
      libmiomxinterface_lc_19.so
      libmiomxinterface_mt_19.so
      libmiomxinterface_nv_19.so
      libmiomxinterface_qc_19.so
      libMiuiBluetooth.so
      libmiuiclassproxy.so
      libmiuidiffpatcher.so
      libMiuiGalleryNSGIF.so
      libmiuiimageutilities.so
      libmiuinative.so
      libmiuindbg.so
      libmiuinet_jni.so
      libmiui_chromium_support.so
      libmiui_security.so
      libmorpho_memory_allocator.so
      libmorpho_panorama.so
      libmp3lame.so
      libmresearch.so
      libnamespaces.so
      libnap.so
      libNative.so
      libnexcralbody_mc_jb.so
      libnexeditorsdk.so
      libnexralbody_audio.so
      libnmob_audiosdk.so
      libnmob_commonlib.so
      libnmob_newaudio.so
      libnmob_newvideo.so
      libnmob_util.so
      libnmob_videosdk.so
      liboctvm.so
      liboctvm_drv.so
      liboctvm_runtime.so
      liboctvm_utils.so
      libpatcher_game_jni.so
      libpatcher_jni.so
      libPinguoImageSDK.so
      libplayer_jni.so
      libpowerkeeper_jni.so
      libQuadrangleRecognizer.so
      libsechook.so
      libsecurities_sdk.so
      libsecuritysdk-3.1.27.so
      libsecurity_device_credential_sdk.so
      libsgmain.so
      libsgmainso-5.1.2011.so
      libShare.so
      libshell.so
      libshellservice.so
      libshell_jni.so
      libShopSigned.so
      libsic_helper.so
      libsmsprotocol.so
      libspaces_jni.so
      libsqlcipher_android-ss40103.so
      libssutil.so
      libtbdecode.so
      libtcp.so
      libthemeutils_jni.so
      libtinyxml.so
      libTmsdk-2.0.8-mfr.so
      libTmsdk-2.0.9-mfr.so
      libunipaychsec.so
      libvip_channel.so
      libvip_channel_iface.so
      libwebp.so
      libweibosdkcore.so
      libweibosdkcore_sogou.so
      libwhetstone_jni.so
      libwhetstone_sdk.so
      libwrapnexpcmcalbody.so
      libxiaomimediaplayer.so
      libxiaomiplayerwrapper.so
      libxl_stat.so
      libxl_thunder_iface.so
      libxl_thunder_sdk.so
      libxmpass_sdk_patcher.so
      xmpass_libweibosdkcore.so

      from MIUI8 "system/lib64" add to my CM13 "system/lib64"
      Code:
      libACRCloudEngine.so
      libadvanced_crypto.so
      libadvanced_crypto_jni.so
      libairtunes.so
      libairtunes_jni.so
      libams-1.1.7-m-mfr.so
      libams-1.1.7-mfr.so
      libapssdk.so
      libautotoucher.so
      libavast-utils.so
      libavast-vps-interface.so
      libavcodec.so
      libavformat.so
      libavresample.so
      libavutil.so
      libBankCardRecognizer.so
      libbigo265mobile_nmob.so
      libbigofacelib.so
      libbigofacewapper.so
      libCameraEffectJNI.so
      libcdc.so
      libconnectionbase.so
      libdce-1.1.9-mfr.so
      libDexHelper.so
      libdidi_secure.so
      libdigit_ocr.so
      libduokantext.so
      libfdpp.so
      libfdpp_jni.so
      libffmpeg_xm.so
      libgnustl_yynmob.so
      libhttpserver.so
      libhwocr_cntools_shared.so
      libhw_instanttrans.so
      libidcardquality_v1.0.3.so
      libjavastackimpl.so
      libjni_load_serinum.so
      libjni_resource_drm.so
      libkeygen_jni.so
      libmiio.so
      libmilinkconnection.so
      libMiuiBluetooth.so
      libmiuiclassproxy.so
      libmiuidiffpatcher.so
      libMiuiGalleryNSGIF.so
      libmiuiimageutilities.so
      libmiuinative.so
      libmiuindbg.so
      libmiuinet_jni.so
      libmiui_chromium_support.so
      libmiui_security.so
      libmorpho_memory_allocator.so
      libmorpho_panorama.so
      libmp3lame.so
      libnamespaces.so
      libnap.so
      libnexcralbody_mc_jb.so
      libnexeditorsdk.so
      libnexralbody_audio.so
      libnmob_audiosdk.so
      libnmob_commonlib.so
      libnmob_newaudio.so
      libnmob_newvideo.so
      libnmob_util.so
      libnmob_videosdk.so
      liboctvm.so
      liboctvm_drv.so
      liboctvm_runtime.so
      liboctvm_utils.so
      libpatcher_game_jni.so
      libpatcher_jni.so
      libPinguoImageSDK.so
      libplayer_jni.so
      libpowerkeeper_jni.so
      libQuadrangleRecognizer.so
      libsechook.so
      libsecurity_device_credential_sdk.so
      libsgmain.so
      libsgmainso-5.1.2011.so
      libShare.so
      libshell.so
      libshellservice.so
      libshell_jni.so
      libsmsprotocol.so
      libssutil.so
      libtbdecode.so
      libtcp.so
      libthemeutils_jni.so
      libtinyxml.so
      libTmsdk-2.0.9-mfr.so
      libunipaychsec.so
      libvip_channel.so
      libvip_channel_iface.so
      libweibosdkcore.so
      libwhetstone_jni.so
      libwhetstone_sdk.so
      libwrapnexpcmcalbody.so
      libxl_stat.so
      libxl_thunder_iface.so
      libxl_thunder_sdk.so
      libxmpass_sdk_patcher.so
      xmpass_libweibosdkcore.so
    • from MIUI8 "system/xbin" add to my CM13 "system/xbin"
      Code:
      busybox
      miuioneshots
      mqsasd
      shelld
    • in system build.prop in my CM13

      red line - replace, green line - add in end
      Code:
      ro.config.notification_sound=[COLOR="Red"]pixiedust.ogg[/COLOR]
      ro.config.alarm_alert=[COLOR="red"]Alarm_Classic.ogg[/COLOR]
      ro.config.ringtone=[COLOR="red"]Ring_Synth_04.ogg[/COLOR]
      ...
      [COLOR="Green"]ro.miui.ui.version.code=5
      ro.miui.ui.version.name=V8
      ro.config.sms_received_sound=FadeIn.ogg
      ro.config.sms_delivered_sound=MessageComplete.ogg
      persist.sys.strictmode.disable=true
      ro.product.mod_device=Unknown[/COLOR]

      if need navigation bar also add in end this line
      Code:
      [COLOR="green"]qemu.hw.mainkeys=0[/COLOR]



    Boot.img

    (Green line - add, Red line - replace)

    boot.img-ramdisk:

    • default.prop:
      Code:
      #
      # ADDITIONAL_DEFAULT_PROPERTIES
      #
      ro.adb.secure=[COLOR="Red"]0[/COLOR]
      ro.secure=[COLOR="red"]0[/COLOR]
      security.perf_harden=1
      ro.allow.mock.location=[COLOR="red"]1[/COLOR]
      ro.debuggable=[COLOR="red"]0[/COLOR]
      ro.zygote=zygote32
      dalvik.vm.image-dex2oat-Xms=64m
      dalvik.vm.image-dex2oat-Xmx=64m
      dalvik.vm.dex2oat-Xms=64m
      dalvik.vm.dex2oat-Xmx=512m
      ro.dalvik.vm.native.bridge=0
      debug.atrace.tags.enableflags=0
      ro.enable_boot_charger_mode=1
      ro.usb.pid_suffix=195
      [COLOR="Green"]persist.service.adb.enable=0
      persist.sys.usb.control=disable[/COLOR]
      #
      # BOOTIMAGE_BUILD_PROPERTIES
      #
      ro.bootimage.build.date=Mon Oct 10 00:45:42 PDT 2016
      ro.bootimage.build.date.utc=1476085542
      ro.bootimage.build.fingerprint=Sony/cm_huashan/huashan:6.0.1/M4B30X/e4e845e232:userdebug/test-keys
      persist.sys.usb.config=[COLOR="red"]adb[/COLOR]
    • init.cm.rc
      Code:
      # CyanogenMod Extras
      [COLOR="Green"]#[/COLOR]import /init.superuser.rc
      ...
    • init.environ.rc
      Code:
      # set up the global environment
      on init
          export ANDROID_BOOTLOGO 1
          export ANDROID_ROOT /system
          export ANDROID_ASSETS /system/app
          export ANDROID_DATA /data
          export ANDROID_STORAGE /storage
          export EXTERNAL_STORAGE /sdcard
          export ASEC_MOUNTPOINT /mnt/asec
          export BOOTCLASSPATH /system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/apache-xml.jar:/system/framework/org.apache.http.legacy.boot.ja[COLOR="green"]r:/system/framework/tcmiface.jar:/system/framework/libstagefrighthw.jar:/system/framework/patchrom-core.jar:/system/app/miui/miui.apk:/system/app/miuisystem/miuisystem.apk[/COLOR]
          export SYSTEMSERVERCLASSPATH /system/framework/org.cyanogenmod.platform.jar:/system/framework/org.cyanogenmod.hardware.jar:/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar[COLOR="Green"]:/system/framework/patchrom-server.jar[/COLOR]
          export LD_PRELOAD libsigchain.so
    • init.rc
      Code:
      # Copyright (C) 2012 The Android Open Source Project
      #
      # IMPORTANT: Do not create world writable files or directories.
      # This is a common source of Android security bugs.
      #
      
      import /init.environ.rc
      import /init.usb.rc
      import /init.${ro.hardware}.rc
      import /init.usb.configfs.rc
      import /init.${ro.zygote}.rc
      import /init.trace.rc
      [COLOR="Green"]import /init.miui.rc[/COLOR]
      # Include CM's extra init file
      import /init.cm.rc
      ...
    • init.miui.rc & init.miui8.rc - This file will be added in ramdisk. Unpack ZIP-archive with these files: View attachment init.miui.rc.zip

    boot.img-cmdline:
    Code:
    [COLOR="Green"]androidboot.selinux=permissive[/COLOR] androidboot.hardware=qcom androidboot.baseband=msm user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 vmalloc=340M