Xiaomi Mi5 Cyanogenmod 13

mi5I got one of this very nice mobiles. Snapdragon 820, 3GB RAM, 32GB Storage and all of this with a tiny pricetag of around 350 Euro (Shopped from Honorbuy). The only thing i don’t like is the Miui ROM…. typical chinese features and a iOS like UI, hey i bought a Android!

So the “Level Zen” Developers 😉 from XDA came together and created the Device Tree for it – There is no kernel source released so far, so they have to use the prebuild Xiaomi kernel.

 

 

Disclamer: I only show you how to use that device tree to build a fully working ROM! If you want to donate, you directly should do it to the developers of the device tree! My programming skills are way to low to contribute code :/

If you trust me, you can download my daily, weekly or whatever builds (Depends on how often the device tree and / or Cyanogenmod gets updates) directly from > here < and install it via TWRP.

In case somebody wants to build Cyanogenmod 13 for it, keep reading! But before get a fast and large  (!) cloud instance or bare metal server! It takes ages to compile when you don’t have a powerful host! I can recommend Vultr for it. I won’t cover the Ubuntu installation here, you should already know that.

  1. Do a openssh only installation of Ubuntu 16.04
  2. Login with your created user and let’s begin!

First we have to be sure that our Ubuntu is up2date and has all needed packages installed:

sudo apt update; apt full-upgrade -y
sudo apt install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven bc -y
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt update; sudo apt install openjdk-7-jdk -y
sudo apt remove --purge openjdk-8-jre-headless -y

Now we can take care about the repository settings:

mkdir ~/bin ; wget http://commondatastorage.googleapis.com/git-repo-downloads/repo -O ~/bin/repo ; chmod a+x ~/bin/repo
echo "export PATH=~/bin:$PATH" >> ~/.bashrc
echo "USE_CCACHE=1" >> ~/.bashrc
source ~/.bashrc

Please keep in mind: You’ll need at least 100GB to do the build process, so please create this directory on a partition with enough space! (Here i create the directory in the users home):

mkdir ~/buildenv ; cd ~/buildenv

Now we prepare and sync the Cyanogenmod 13 repository (This take some time, depending on your connection speed):

repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
repo sync

After the repository is syncronized, we have to implement and sync the device tree:

mkdir ~/buildenv/.repo/local_manifests
wget https://raw.githubusercontent.com/Mi5Devs/android/master/roomservice.xml -O ~/buildenv/.repo/local_manifests/roomservice.xml
repo sync

At this point, you have everything to homebrew your Mi5 rom! Ready?

source build/envsetup.sh
brunch cm_gemini-userdebug

This will take several hours to complete! Get a very large coffee or do a forest walk with your girlfriend, friend, dog, cat or with whatever you usual walk in a forest!

On a 8 Core, 16GB RAM and SSD cloud instance it took:

#### make completed successfully (02:04:34 (hh:mm:ss)) ####

Then you’ll find the ROM zipped in the folder:

~/buildenv/out/target/product/gemini/

The name of the ZIP file looks like this: cm-13.0-20160719-UNOFFICIAL-gemini.zip

Edit (24.07.2016):

If you have problems with Fingerprint Sensor and be familiar with ADB / Fastboot:

adb reboot bootloader
fastboot flash dsp adspso.bin
fastboot flash bluetooth BTFM.bin 
fastboot flash cmnlib cmnlib.mbn
fastboot flash cmnlibbak cmnlib.mbn
fastboot flash cmnlib64 cmnlib64.mbn
fastboot flash cmnlib64bak cmnlib64.mbn
fastboot flash devcfg devcfg.mbn
fastboot flash aboot emmc_appsboot.mbn
fastboot flash abootbak emmc_appsboot.mbn
fastboot flash hyp hyp.mbn
fastboot flash hypbak hyp.mbn
fastboot flash keymaster keymaster.mbn
fastboot flash keymasterbak keymaster.mbn
fastboot flash pmic pmic.elf
fastboot flash pmicbak pmic.elf
fastboot flash rpm rpm.mbn
fastboot flash rpmbak rpm.mbn
fastboot flash tz tz.mbn
fastboot flash tzbak tz.mbn
fastboot flash xbl xbl.elf
fastboot reboot

If you encounter problems or have suggestions, please leave a nice comment!

  1. Could you please remove the open_gapps zips from https://store.shade.sh/mi5/ they are violating the no-mirror license because they are publicly linked from http://www.miui.com/thread-5010303-1-1.html

  2. Thx! 😛
    Very useful…
    What about cm14?

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.