Xiaomi Mi 9T / Redmi K20 (xiaomi-davinci)

From postmarketOS Wiki
Xiaomi Mi 9T /
Redmi K20
Xiaomi Mi 9T / Redmi K20
Xiaomi Mi 9T / Redmi K20
Manufacturer Xiaomi
Name Mi 9T /
Redmi K20
Codename xiaomi-davinci
Model
  • Mi 9T: M1903F10G
  • Redmi K20: M1903F10A
  • Redmi K20 Chinese Carrier Version: M1903F10C
Released 2019
Type handset
Hardware
Chipset Qualcomm Snapdragon 730 (SM7150-AA)
CPU Octa-core (2x 2.2 GHz Kryo 470 Gold & 6x 1.8 GHz Kryo 470 Silver)
GPU Adreno 618
Display 1080 x 2340 AMOLED
Storage 64/128/256 GB
Memory 6 GB
Architecture aarch64
Software
Original software Android (MIUI)
Original version 9 (MIUI 10) (Linux kernel 4.14.83)
Extended version 11 (MIUI 12) (Linux kernel 4.14.180)
FOSS bootloader no
postmarketOS
Category testing
Pre-built images no
Mainline yes
postmarketOS kernel Mainline 6.7.4
Unixbench Whet/Dhry score 5923.2
Features
Flashing
Works
USB Networking
Works
Internal storage
Works
Battery
Partial
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Works
Audio
Partial
Camera
Partial
Camera Flash
Works
Connectivity
WiFi
Works
Bluetooth
Works
GPS
NFC
Partial
Modem
Calls
Works
SMS
Works
Mobile data
Works
Miscellaneous
FDE
Works
USB OTG
Works
Sensors
Accelerometer
Works
Magnetometer
Works
Ambient Light
Works
Proximity
Works
Haptics
Works
This device is based on the Snapdragon 730.
See the SoC page for common tips, guides and troubleshooting steps

Maintainer(s)

Users owning this device


How to enter flash mode

  • Bootloader: Power on the device with both Power and Volume Down buttons.
  • Recovery: Power on the device with both Power and Volume Up buttons.
  • Fastbootd: Reboot into bootloader mode first and then run fastboot reboot fastboot from a computer.

Installation

  1. Make sure pmbootstrap is installed and your bootloader is unlocked
  2. Run through pmbootstrap init and select xiaomi as the vendor and davinci as the device.
  3. Generate the rootfs
    • For netbooting pmOS without flashing the phone, run pmbootstrap --extra-space 1000 install --no-sparse and pmbootstrap initfs hook_add netboot
    • If you want to flash pmOS to the phone, run pmbootstrap install
  4. Backup and erase the dtbo partition
    To boot Linux, you'll have to erase the dtbo partition. It is recommended to back it up first if you want to boot Android again
    1. Run dd if=/dev/block/by-name/dtbo of=/sdcard/dtbo.img from a rooted shell on your phone and pull it with adb pull /sdcard/dtbo.img to your computer.
    2. Boot into bootloader mode
    3. Erase the dtbo partition with fastboot erase dtbo
    To restore the partition flash it with fastboot flash dtbo dtbo.img
  5. Flash the rootfs
    • If you decided to go with netbooting, start the server with pmbootstrap netboot serve
    • If you want to install pmOS to the phones internal storage, run pmbootstrap flasher flash_rootfs --partition userdata (you can use --partition system if you want to keep the Android userdata and are fine with ~6GB of storage)
  6. Boot the kernel
    • To boot temporarily, without flashing run pmbootstrap flasher boot
    • To flash the kernel to the boot partition, run pmbootstrap flasher flash_kernel and reboot with fastboot reboot

After successfully following this guide, your phone should boot postmarketOS! If you have problems installing, feel free to ask in #sm7150-mainline:matrix.org

Quirks

This should provide a rough overview explaining some unexpected things in the feature support table in the infobox.

NFC

This device shares the reset GPIO between NFC and the amplifier (for speaker audio). There is no such mechanism in the mainline kernel yet, so only one of them can work at a time. Due to that, NFC is currently disabled, but works fine and can be enabled in the kernel if preferred over speaker audio.

Battery

It charges, but very slowly since the hardware charger is not supported yet and especially the fuel gauge implementation is very basic and inaccurate.

Audio

Speaker audio works, microphone and earpiece are not working due to missing WCD implementation in the kernel.

Camera

The tele and ultrawide sensors are supported by our kernel fork and probing fine, but the camss is not implemented yet, making it impossible to take pictures.

GPS

Not tested yet, should work with the Qualcomm PDS patch for GPSD.

FOSS Bootloader

Unless the signing keys leak or we crack them, ABL will always remain the first stage bootloader. I wrote a basic EDK2-MSM port a while ago, but the "reboot to Android" flag never persisted in memory, making it rather unusable. We are working on U-Boot for SM7150 instead.

Mainline

The SM7150 mainline kernel used by this device is being developed here. Please note that this wiki page is being updated to reflect progress and document feature support as we work on it, which means that sometimes, features marked as supported here will only work on the latest kernel fork, which might not be packaged in upstream pmaports quite yet.

Nightlies

The sm7150-mainline team provides weekly prebuilt nightly postmarketOS builds with bleeding edge kernel versions which can be found here. We hope to encourage testing and trying out postmarketOS by providing a beginner-friendly way to install while the devices reside in the testing category.