PostmarketOS on Xiaomi Mi 9T / Redmi K20 (davinci)
AdrianWARNING: PostmarketOS is BY NO MEANS a daily-driveable, bug-free or mature operating system. The mainline kernel for davinci is NOT FINISHED, has broken components and might crash. YOU WERE WARNED.
That said, PostmarketOS is an awesome opportunity to try what we have been working on for about 4 years now: A mainline Linux kernel for davinci. It's by no means done or perfect, but a lot of things are working already and I would consider "real" Linux distributions like PostmarketOS an exciting and probably very new experience for most people.
You can install PostmarketOS entirely on the system partition and leave your Android userdata untouched. You can always flash back your old ROM and enjoy your data without any loss. However, I'm not to blame if you do lose data.
Before installing, please familiarize yourself with PostmarketOS at https://postmarketos.org/.
You can find an overview of the current port status at https://wiki.postmarketos.org/wiki/Xiaomi_Mi_9T_/_Redmi_K20_(xiaomi-davinci) and https://wiki.postmarketos.org/wiki/Qualcomm_Snapdragon_730/730G/732G_(SM7150).
To install PostmarketOS, I provide prebuilt images. You can choose between KDE Plasma, Gnome Mobile and Phosh. If you don't know what to use, I recommend Phosh, because it has the most mobile-friendly UI. Plasma currently isn't provided because the packages for it are broken in PostmarketOS.
You can find the downloadable prebuilt PostmarketOS files at https://download.kenvyra.xyz/postmarketos/.
The installation procedure is fairly simple:
fastboot erase dtbo
fastboot flash boot boot-[variant].img
fastboot flash system/userdata rootfs-[variant].img
You need a boot image specific for each variant because a new rootfs is generated every time, with different partition UIDs. The kernels themselves are identical, just the cmdline differs a tiny bit.
Choose "system" for the rootfs partition if you want to try PostmarketOS without losing your Android data. Choose "userdata" instead if you want a lot of storage.
Then, run
fastboot reboot
And enjoy PostmarketOS! The default user to log in is called "user", the password is "147147". If you have connected your phone to the PC via USB, you can even use SSH to access it:
ssh user@172.16.42.1
will connect to your device.
Some notes:
These images come with systemd, I did not bother building OpenRC-based images.
For sensors to work fine, run
doas apk add mrtest && doas mrtest add 6126
Then reboot and you might need to run
doas systemctl restart iio-sensor-proxy
after boot.