• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

LR.Team/wzsx150's TWRP, and status on PHH GSIs

Search This thread

AndyYan

Recognized Contributor
Jan 30, 2012
4,366
3,695
Beijing
So now that the K20 Pro subforum is open, I'd like to make a post here to quickly sum up what we have right now before any device-specific AOSP development has started.

LR.Team/wzsx150's TWRP
Original thread: http://www.miui.com/thread-24561276-1-1.html
Mirrored here: https://drive.google.com/open?id=1miIo5BZqgEHh0t5PyjwFkFryosLuFOXk
Usage: unlock BL, flash recovery image to recovery and misc.bin to misc via fastboot

Status on GSIs
PHH wiki page: https://github.com/phhusson/treble_experimentations/wiki/Xiaomi-Redmi-K20-Pro
TL;DR: the biggest issue is the pop-up camera, but that has been partially resolved by PHH (manual controls); other bugs are either generic to GSIs or not deal-breakers. I myself have been using my own LOS GSI for a week by now and I'd say it's good for daily driver, and certainly good enough as an intermediate stop before actual ROMs happen. Once the overlay I submitted is merged, all GSIs built afterwards should be on equal footing. I'll also keep eyes on the issues page in case PHH needs anything for another fix.

And finally, here's a script I made for users who want to use unencrypted storage - format /data and flash this. This one was actually made for Mix 2, but also works here, while Zackptg's universal script doesn't seem to work.
 

melmarPH

Senior Member
Feb 2, 2016
325
96
Caloocan City
So now that the K20 Pro subforum is open, I'd like to make a post here to quickly sum up what we have right now before any device-specific AOSP development has started.

LR.Team/wzsx150's TWRP
Original thread: http://www.miui.com/thread-24561276-1-1.html
Mirrored here: https://drive.google.com/open?id=1miIo5BZqgEHh0t5PyjwFkFryosLuFOXk
Usage: unlock BL, flash recovery image to recovery and misc.bin to misc via fastboot

Status on GSIs
PHH wiki page: https://github.com/phhusson/treble_experimentations/wiki/Xiaomi-Redmi-K20-Pro
TL;DR: the biggest issue is the pop-up camera, but that has been partially resolved by PHH (manual controls); other bugs are either generic to GSIs or not deal-breakers. I myself have been using my own LOS GSI for a week by now and I'd say it's good for daily driver, and certainly good enough as an intermediate stop before actual ROMs happen. Once the overlay I submitted is merged, all GSIs built afterwards should be on equal footing. I'll also keep eyes on the issues page in case PHH needs anything for another fix.

And finally, here's a script I made for users who want to use unencrypted storage - format /data and flash this. This one was actually made for Mix 2, but also works here, while Zackptg's universal script doesn't seem to work.

OMG! Thank you so much in advance! ???

---------- Post added at 06:47 PM ---------- Previous post was at 06:08 PM ----------

I'd love to see a more detailed "noob friendly" guide on how I can get this twrp working on my K20 Pro. Hope one will be available in YouTube soon.
 

Robbo.5000

Senior Member
Dec 8, 2016
1,081
716
Redmi K20 Pro
Thanks for your work with PHH on getting a usable GSI image. Do you have a PD charger? I was wondering if you still get 27W charging via PD?
I'll be ordering this in the next day or 2, now the prices have come down to a sensible level on AliExpress. Hopefully by the time it arrives and I get to unlock the bootloader a few more issues will have been resolved thanks to the now released kernel sources.
 

AndyYan

Recognized Contributor
Jan 30, 2012
4,366
3,695
Beijing
Thanks for your work with PHH on getting a usable GSI image. Do you have a PD charger? I was wondering if you still get 27W charging via PD?

I didn't buy the optional 27W charger; stock 18W charger charges the phone at 9V 1.85A (~17W) as measured by a physical USB meter (I don't trust any software readings).

Please correct me if im wrong..

1. Unlock bootloader
2. Fastboot flash recovery twrp.img
3. Fastboot flash misc misc.bin

Is that correct?

Looks good to me.
 
  • Like
Reactions: Robbo.5000

Krullendhaar

Senior Member
Oct 30, 2014
76
40
Yeah it's my new primary device. I don't plan to do any building/"development" here though, this device should be popular enough to attract more capable devs on its own - that is, after it's released internationally.

Hi Andy, quick question.

Do you think the non-pro version of the phone will receive the same level of custom ROM support as the pro version? If I am not mistaking, the only difference that affects developers is the SD730 instead of the SD855. The reason I am asking is because I dislike MIUI, but (currently) only the Xiaomi Mi 9T is available where I live. I do not mind buying the non-pro version, but I do want much custom ROM support. Do you suggest waiting for the Xiaomi Mi 9T Pro or importing the Redmi K20 Pro over buying the Xiaomi Mi 9T (w.r.t. custom ROM support)?
 

AndyYan

Recognized Contributor
Jan 30, 2012
4,366
3,695
Beijing
Hi Andy, quick question.

Do you think the non-pro version of the phone will receive the same level of custom ROM support as the pro version? If I am not mistaking, the only difference that affects developers is the SD730 instead of the SD855. The reason I am asking is because I dislike MIUI, but (currently) only the Xiaomi Mi 9T is available where I live. I do not mind buying the non-pro version, but I do want much custom ROM support. Do you suggest waiting for the Xiaomi Mi 9T Pro or importing the Redmi K20 Pro over buying the Xiaomi Mi 9T (w.r.t. custom ROM support)?

Past "parallel" sub-flagships like Mi 8 SE / Mi 9 SE aren't even close to their flagship counterparts in terms of support, plus SD730 is a chip only used by 2 devices so far. Wouldn't count on it.
Still, given the two's similarity, it should be a cakewalk to get GSI running on it with the same bugs, and if something gets fixed on one, the other should benefit as well.
 

kumoilain

Senior Member
Dec 6, 2017
50
21
Shanghai
May I ask what is the purpose of tha misc.bin?

idk either, but all releases for all devices from wzsx150 include this step, so I figure can't go wrong with just copying his steps.

Configures in misc partition decides the bootloader to boot from system or recovery.

In wzsx150's flash.bat (recovery-twrp一键刷入工具.bat) , he writes 'fastboot.exe reboot' command in the end. So if we don't change settings in misc partition, the bootloader will control your phone to boot to MIUI system and recover the TWRP to xiaomi official recovery.

Other way, we can use 'fastboot boot twrp.img' command in the end, instead of flashing that misc.bin. Maybe we can use 'fastboot reboot recovery' command (I have not tested).

In summary, that misc.bin prevent phone from booting into MIUI.

If there are any mistakes, please point out.

---------- Post added at 08:00 AM ---------- Previous post was at 07:59 AM ----------

AndyYan's GSI works well with few bugs.

The only 2 unsatisfactory things I have discovered are:

This GSI LineageOS don't support to unlock phone via fingerprint when screen is off, I have to press the power button first:eek:.

And this GSI only have PWM driver when screen is 31% brightness below, while the MIUI supports all brightness DC ( however, xiaomi claimed that K20Pro have HARDWARE DC screen driver:confused: ). I have tried 3rd party apk for simulate DC driver, it works, but completely ruines the optical fingerprint at low brightness due to the screen is so dim that can't lit up the finger for fingerprint camera.

Fortunately, Magisk, Edxposed, GravityBox[P] and other xposed modules work, so I will never return to MIUI.
 
Last edited:

AndyYan

Recognized Contributor
Jan 30, 2012
4,366
3,695
Beijing
Configures in misc partition decides the bootloader to boot from system or recovery.

In wzsx150's flash.bat (recovery-twrp一键刷入工具.bat) , he writes 'fastboot.exe reboot' command in the end. So if we don't change settings in misc partition, the bootloader will control your phone to boot to MIUI system and recover the TWRP to xiaomi official recovery.

Other way, we can use 'fastboot boot twrp.img' command in the end, instead of flashing that misc.bin. Maybe we can use 'fastboot reboot recovery' command (I have not tested).

In summary, that misc.bin prevent phone from booting into MIUI.

So that's why... Thanks for the explanation!
I always hold down the key combo right after flashing though, so it wouldn't boot into MIUI anyway, but good to know I don't need to do that anymore at least for this device.
 

xuananh94

Member
Jan 21, 2016
26
6
Hanoi
Configures in misc partition decides the bootloader to boot from system or recovery.

In wzsx150's flash.bat (recovery-twrp一键刷入工具.bat) , he writes 'fastboot.exe reboot' command in the end. So if we don't change settings in misc partition, the bootloader will control your phone to boot to MIUI system and recover the TWRP to xiaomi official recovery.

Other way, we can use 'fastboot boot twrp.img' command in the end, instead of flashing that misc.bin. Maybe we can use 'fastboot reboot recovery' command (I have not tested).

In summary, that misc.bin prevent phone from booting into MIUI.

If there are any mistakes, please point out.

---------- Post added at 08:00 AM ---------- Previous post was at 07:59 AM ----------

AndyYan's GSI works well with few bugs.

The only 2 unsatisfactory things I have discovered are:

This GSI LineageOS don't support to unlock phone via fingerprint when screen is off, I have to press the power button first:eek:.

And this GSI only have PWM driver when screen is 31% brightness below, while the MIUI supports all brightness DC ( however, xiaomi claimed that K20Pro have HARDWARE DC screen driver:confused: ). I have tried 3rd party apk for simulate DC driver, it works, but completely ruines the optical fingerprint at low brightness due to the screen is so dim that can't lit up the finger for fingerprint camera.

Fortunately, Magisk, Edxposed, GravityBox[P] and other xposed modules work, so I will never return to MIUI.

Thank you for your clarification. So for now, there is no way to not flashing misc.bin? Because i do not want to touch this partition whatsoever.
 

kumoilain

Senior Member
Dec 6, 2017
50
21
Shanghai
Thank you for your clarification. So for now, there is no way to not flashing misc.bin? Because i do not want to touch this partition whatsoever.

Other way, we can use 'fastboot boot twrp.img' command in the end, instead of flashing that misc.bin. Maybe we can use 'fastboot reboot recovery' command (I have not tested).

You can use the first commad above after "fastboot flash recovery twrp.img". It should work.
I think it's ok to overwrite misc partition because configures in misc is always changed (eg. reboot to system from twrp/ reboot to twrp from system:confused:)
 

xuananh94

Member
Jan 21, 2016
26
6
Hanoi
You can use the first commad above after "fastboot flash recovery twrp.img". It should work.
I think it's ok to overwrite misc partition because configures in misc is always changed (eg. reboot to system from twrp/ reboot to twrp from system:confused:)

So let me clear what I need to do, please tell me if i am wrong:
- extract the .7z file
- take the .img file (64mb) and flash it via adb normally.
- boot to recovery and install whatever i like
 

Top Liked Posts

  • There are no posts matching your filters.
  • 36
    So now that the K20 Pro subforum is open, I'd like to make a post here to quickly sum up what we have right now before any device-specific AOSP development has started.

    LR.Team/wzsx150's TWRP
    Original thread: http://www.miui.com/thread-24561276-1-1.html
    Mirrored here: https://drive.google.com/open?id=1miIo5BZqgEHh0t5PyjwFkFryosLuFOXk
    Usage: unlock BL, flash recovery image to recovery and misc.bin to misc via fastboot

    Status on GSIs
    PHH wiki page: https://github.com/phhusson/treble_experimentations/wiki/Xiaomi-Redmi-K20-Pro
    TL;DR: the biggest issue is the pop-up camera, but that has been partially resolved by PHH (manual controls); other bugs are either generic to GSIs or not deal-breakers. I myself have been using my own LOS GSI for a week by now and I'd say it's good for daily driver, and certainly good enough as an intermediate stop before actual ROMs happen. Once the overlay I submitted is merged, all GSIs built afterwards should be on equal footing. I'll also keep eyes on the issues page in case PHH needs anything for another fix.

    And finally, here's a script I made for users who want to use unencrypted storage - format /data and flash this. This one was actually made for Mix 2, but also works here, while Zackptg's universal script doesn't seem to work.
    8
    Latest news is that @TingyiChen (Isaac Chen) has finished bringing up the device, and a MoKee build based on his work should be around the corner. Given that he's also the official LOS maintainer of quite a bunch of Xiaomi devices, it's likely that the device would join LOS's lineup some time later, and I bet it'd work better than the GSI and the workarounds I hastily coded.
    Of course, obligatory warning here: if you want to use his device trees (or anyone's, really) to build other ROMs and want to release it to the public, ask for permission! Sure it's open-source, but apart from the kernel, not obligatory so. I don't want to see more devs leave just because the community doesn't show respect.
    7
    And we're done - I wrote a dirty way to grab camera status from HAL, and that worked nicely. Well, not 100% - if you switch to / out of front cam rapidly, the status detection won't be able to keep up, but at least there won't be double popup/takeback issues. I've dumped it here for PHH and whoever interested to review.
    As said, I see this as a VERY dirty solution, so don't expect this to be merged/included anywhere else, though I'll likely include it in the next update of LOS (should be due this weekend). For now I'll take a break and see what PHH thinks about it.
    6
    Progress is good - all camera-capable apps I have on my phone can trigger cam popup/takeback now. There still is a rare case of double popup/takeback though, which my current solution - using a persist prop as camera status indicator - can't take into account. Gonna look into how to get that status from the motor HAL itself.
    Also, camera still pops up on boot, which admittedly isn't ideal, but that's a lesser, one-off problem we'll get to later.
    5
    May I ask what is the purpose of tha misc.bin?

    idk either, but all releases for all devices from wzsx150 include this step, so I figure can't go wrong with just copying his steps.

    Configures in misc partition decides the bootloader to boot from system or recovery.

    In wzsx150's flash.bat (recovery-twrp一键刷入工具.bat) , he writes 'fastboot.exe reboot' command in the end. So if we don't change settings in misc partition, the bootloader will control your phone to boot to MIUI system and recover the TWRP to xiaomi official recovery.

    Other way, we can use 'fastboot boot twrp.img' command in the end, instead of flashing that misc.bin. Maybe we can use 'fastboot reboot recovery' command (I have not tested).

    In summary, that misc.bin prevent phone from booting into MIUI.

    If there are any mistakes, please point out.

    ---------- Post added at 08:00 AM ---------- Previous post was at 07:59 AM ----------

    AndyYan's GSI works well with few bugs.

    The only 2 unsatisfactory things I have discovered are:

    This GSI LineageOS don't support to unlock phone via fingerprint when screen is off, I have to press the power button first:eek:.

    And this GSI only have PWM driver when screen is 31% brightness below, while the MIUI supports all brightness DC ( however, xiaomi claimed that K20Pro have HARDWARE DC screen driver:confused: ). I have tried 3rd party apk for simulate DC driver, it works, but completely ruines the optical fingerprint at low brightness due to the screen is so dim that can't lit up the finger for fingerprint camera.

    Fortunately, Magisk, Edxposed, GravityBox[P] and other xposed modules work, so I will never return to MIUI.