Creating boot images for Mi 5C

Search This thread

usedbytes

Member
Mar 17, 2017
6
6
Hi, this might be more suitable in the ROMS/development section, but I don't have a post count high enough to post there.

I've been hacking around on the Mi 5C since I got it last week. I thought I'd share what I've learnt.

With regards to the device itself - it's very nice. Metal construction, vivid screen, great build quality. I'm very pleased with it - though even after changing the language there's a lot of Chinese stuff in the stock ROM which I can't read. Obviously no play store/GMS either. I haven't spent any time trying to sideload those because I'm flashing it pretty regularly at the moment.

Bootloader Unlocking
The process for unlocking the bootloader is the same as for other Xiaomi phones, put in a request on en.miui.com/unlock, then wait for a code and use their unlocking tool to unlock.
I had success with version 1.1.1111.11231 of the Mi Unlock Tool, which you can find in the MIUI forums.

Boot Images
I initially had some trouble getting the (unlocked) bootloader to accept any boot images which I created. It would tell me "image verify failed".
After fiddling around with creating different images and comparing them to the stock one in the Xiaomi ROM, I discovered that the bootloader is expecting the images to have a sha256 checksum rather than sha1.
I don't know what the motivation for that was - but if you swap sha1 for sha256, it works fine.

I've got a patched version of mkbootimg on Github at usedbytes/mkbootimg (branch sha256) which lets you specify sha256 on the command line. I've submitted a pull request to get it back into osm0sis' repo, which is where Google sent me to get the mkbootimg source code.

With that mkbootimg, you can create boot images for the mi5c with the following parameters (taken from the stock ROM):
Code:
mkbootimg \
    --kernel $KERNEL_IMAGE \
    --ramdisk $RAMDISK \
    --cmdline "console=ttyS0,115200 earlyprintk=uart8250-32bit,0xF900B000 androidboot.hardware=song no_console_suspend debug user_debug=31 loglevel=9" \
    --base 0x0 \
    --pagesize 4096 \
    --kernel_offset 0x0a080000 \
    --ramdisk_offset 0x0c400000 \
    --dt $DEVICETREE \
    --tags_offset 0xc200000 \
    --os_version 0.0.0 \
    --os_patch_level 0 \
    --second_offset 0x00f00000 \
    --hash sha256 \
    --id \
    -o $OUTFILE

Root
I have managed to root it by manually installing SuperSU into my init ramdisk. That was quite an involved process which I won't go in to.
If anyone is really interested I can write it up - but it would be better to find a better way, such as porting TWRP.

TWRP/Custom ROM
Xiaomi haven't released any source for the Mi 5C, and I'm not sure if we can expect them to.
I do intend to try and port TWRP to it, but having never done anything like that before I don't know if I'll succeed.
My eventual goal is to get AOSP onto it, but again having not tried building a custom ROM before, it will be a challenge.

Hopefully the information here can help someone who knows what they are doing start some development on this device!
 

IXI Nyx IXI

Member
Aug 15, 2011
12
0
Hi, very nice work dude !
I have some questions though.
Is there a way to enable some network band ? Because you surely have noticed that this phone doesn't work very well in 3G outside China.
Plus do you think you can create a custom global MIUI ROM ?
 

usedbytes

Member
Mar 17, 2017
6
6
Hi, very nice work dude !
I have some questions though.
Is there a way to enable some network band ? Because you surely have noticed that this phone doesn't work very well in 3G outside China.
Plus do you think you can create a custom global MIUI ROM ?

Well there's a thread on the MiUi forums about unlocking FDD LTE: en.miui.com/thread-538090-1-1.html
but there's another thread by the same guy saying it's not possible: en.miui.com/thread-526343-1-1.html

To be honest, I haven't actually put a SIM card in mine - I've been spending all my time hacking around on it. I will put a SIM in and see what happens.
 

alloveras

New member
Mar 31, 2017
2
0
Hey,
I am trying to unlock the Mi5C and I already have the unlock code but when I use the Mi Flash Unlock Tool v1.1.1111.11231 it says that it couldn't verify the device.

Do you have any clue on how to solve this issue? My MIUI version is 8.1.13.0 China Stable.

Thank you so much!

Albert
 

usedbytes

Member
Mar 17, 2017
6
6
Hey,
I am trying to unlock the Mi5C and I already have the unlock code but when I use the Mi Flash Unlock Tool v1.1.1111.11231 it says that it couldn't verify the device.

Do you have any clue on how to solve this issue? My MIUI version is 8.1.13.0 China Stable.

Thank you so much!

Albert

I had this problem as well actually. Firstly you need to make sure that you're logged in to your Mi account on the phone.
The thing that made it work for me though was finding the device in device-manager (I don't remember what it was called - some random USB device) and removing the driver for it.
There were instructions on the MiUI forums about it - if you search for the error message you should be able to find it
 

alloveras

New member
Mar 31, 2017
2
0
I had this problem as well actually. Firstly you need to make sure that you're logged in to your Mi account on the phone.
The thing that made it work for me though was finding the device in device-manager (I don't remember what it was called - some random USB device) and removing the driver for it.
There were instructions on the MiUI forums about it - if you search for the error message you should be able to find it

Hey there!
Thank you all for all of your detailed and quick answers!! I finally managed to unlock and flash my Xiaomi 5C!!! The problem was related with the USB drivers on my Windows 10 (x64) machine. I uninstalled them all, rebooted the system, re-installed again and the unlocking app worked like a charm!

Thank you guys again!

Greetings from Spain,

Albert
 

swinder0161

Member
Feb 27, 2013
16
8
Hello,

I have managed to build TWRP touch recovery for MI 5C.
It can be found at https://ufile.io/cd6d3

We can simply boot into recovery from fastboot or flash it(recommend to test on your device first without flashing)
fastboot boot twrp.mi5c.3.1.0.img
And we will be able to mount any partition and get root adb access.

The recovery image is available on server for 30 days, so it will be good if someone can mirror it on a more reliable location.

I hope it helps.
 

IronJacob

Senior Member
Jul 18, 2012
255
37
VItulazio
Hello,

I have managed to build TWRP touch recovery for MI 5C.
It can be found at https://ufile.io/cd6d3

We can simply boot into recovery from fastboot or flash it(recommend to test on your device first without flashing)

And we will be able to mount any partition and get root adb access.

The recovery image is available on server for 30 days, so it will be good if someone can mirror it on a more reliable location.

I hope it helps.

Could you tell me how you managed to root xiaomi mi5c via adb please?
 

Achiko1980

Member
Jul 9, 2016
37
9
Hello,

I have managed to build TWRP touch recovery for MI 5C.
It can be found at https://ufile.io/cd6d3

We can simply boot into recovery from fastboot or flash it(recommend to test on your device first without flashing)

And we will be able to mount any partition and get root adb access.

The recovery image is available on server for 30 days, so it will be good if someone can mirror it on a more reliable location.

I hope it helps.
Please show the link in this file was deleted
 

ferry_setya

Member
Jul 22, 2017
6
0
Hello All, i try to root this device but if i root with TWRP my phone reboot always stuck in fast boot mode what happen? Please help me..
 

Attachments

  • Screenshot_2017-08-04-22-29-15-638_com.android.settings.png
    Screenshot_2017-08-04-22-29-15-638_com.android.settings.png
    130.7 KB · Views: 128

bataratami

Member
Nov 15, 2009
23
5
Hello All, i try to root this device but if i root with TWRP my phone reboot always stuck in fast boot mode what happen? Please help me..

Same happen to me too when i flash supersu to get rooted, these were what i did :
1. Flash "Magisk-v9.zip" (must this version, latest version will lead u to bootloop n not recommend to update via magisk manager app)
2. Flash "phh-superuser-magisk-r266-2.zip"
3. After done with twrp, reboot to system then install "me.phh.superuser_1033.apk"
 

ferry_setya

Member
Jul 22, 2017
6
0
Same happen to me too when i flash supersu to get rooted, these were what i did :
1. Flash "Magisk-v9.zip" (must this version, latest version will lead u to bootloop n not recommend to update via magisk manager app)
2. Flash "phh-superuser-magisk-r266-2.zip"
3. After done with twrp, reboot to system then install "me.phh.superuser_1033.apk"

thank you for your support sir :good: but can you upload the correct version sir? I am afraid if searching on google i got wrong version for mi5c me .. and againts i really thank you sir..
 

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    Hi, this might be more suitable in the ROMS/development section, but I don't have a post count high enough to post there.

    I've been hacking around on the Mi 5C since I got it last week. I thought I'd share what I've learnt.

    With regards to the device itself - it's very nice. Metal construction, vivid screen, great build quality. I'm very pleased with it - though even after changing the language there's a lot of Chinese stuff in the stock ROM which I can't read. Obviously no play store/GMS either. I haven't spent any time trying to sideload those because I'm flashing it pretty regularly at the moment.

    Bootloader Unlocking
    The process for unlocking the bootloader is the same as for other Xiaomi phones, put in a request on en.miui.com/unlock, then wait for a code and use their unlocking tool to unlock.
    I had success with version 1.1.1111.11231 of the Mi Unlock Tool, which you can find in the MIUI forums.

    Boot Images
    I initially had some trouble getting the (unlocked) bootloader to accept any boot images which I created. It would tell me "image verify failed".
    After fiddling around with creating different images and comparing them to the stock one in the Xiaomi ROM, I discovered that the bootloader is expecting the images to have a sha256 checksum rather than sha1.
    I don't know what the motivation for that was - but if you swap sha1 for sha256, it works fine.

    I've got a patched version of mkbootimg on Github at usedbytes/mkbootimg (branch sha256) which lets you specify sha256 on the command line. I've submitted a pull request to get it back into osm0sis' repo, which is where Google sent me to get the mkbootimg source code.

    With that mkbootimg, you can create boot images for the mi5c with the following parameters (taken from the stock ROM):
    Code:
    mkbootimg \
        --kernel $KERNEL_IMAGE \
        --ramdisk $RAMDISK \
        --cmdline "console=ttyS0,115200 earlyprintk=uart8250-32bit,0xF900B000 androidboot.hardware=song no_console_suspend debug user_debug=31 loglevel=9" \
        --base 0x0 \
        --pagesize 4096 \
        --kernel_offset 0x0a080000 \
        --ramdisk_offset 0x0c400000 \
        --dt $DEVICETREE \
        --tags_offset 0xc200000 \
        --os_version 0.0.0 \
        --os_patch_level 0 \
        --second_offset 0x00f00000 \
        --hash sha256 \
        --id \
        -o $OUTFILE

    Root
    I have managed to root it by manually installing SuperSU into my init ramdisk. That was quite an involved process which I won't go in to.
    If anyone is really interested I can write it up - but it would be better to find a better way, such as porting TWRP.

    TWRP/Custom ROM
    Xiaomi haven't released any source for the Mi 5C, and I'm not sure if we can expect them to.
    I do intend to try and port TWRP to it, but having never done anything like that before I don't know if I'll succeed.
    My eventual goal is to get AOSP onto it, but again having not tried building a custom ROM before, it will be a challenge.

    Hopefully the information here can help someone who knows what they are doing start some development on this device!
    3
    Hello,

    I have managed to build TWRP touch recovery for MI 5C.
    It can be found at https://ufile.io/cd6d3

    We can simply boot into recovery from fastboot or flash it(recommend to test on your device first without flashing)
    fastboot boot twrp.mi5c.3.1.0.img
    And we will be able to mount any partition and get root adb access.

    The recovery image is available on server for 30 days, so it will be good if someone can mirror it on a more reliable location.

    I hope it helps.
    3
    thank you for your support sir :good: but can you upload the correct version sir? I am afraid if searching on google i got wrong version for mi5c me .. and againts i really thank you sir..
    Here u go....

    *All credit goes to creators
    1
    Hi!
    Big thanks to usedbyte for expanded description to create modified boot for Mi5C.
    I make a custom fastboot rom for this device with all translations and patches at Multirom.me Team
    https://yadi.sk/d/V3Btc_NB3GFbZx
    1
    Any news on a future lineage build? :)