Linux mobile distro, such as postmarketOS, has more devices supported and more freedom. Instead of dual booting Windows and Android, why not dual boot Linux mobile distros and Android? This could be done on more Android devices.
There are many ways for dual booting Linux mobile distros and Android. For Xiaomi Pocohpne F1 here we have a stupid method: partition the internal storage and install Android and Mobain (Linux mobile distro) on it. Every time we want to boot to another OS, we just flash boot.img via TWRP.
This idea comes from “dual booting Windows 11 ARM and Android”. Renegade Project makes booting Windows 11 ARM possible on Snapdragon 845 phones. And we must partition the internal storage in order to boot Windows.
Now we could use the tools provided by Renegade Project to dual boot Mobian and Android. Or even more? Multi-booting Ubuntu touch + postmarketOS + Mobian + Arch Linux ARM + Windows + Andorid ! Just make sure you have eonugh spaces left on device.
1. Install TWRP#
Install Fastboot tool on your PC.
Boot into fastboot mode. Connect the phone to your PC. Download TWRP for beryllium and flash it:
fastboot flash recovery twrp-3.6.2_9-0-beryllium.img
2. Partitioning the internal storage#
Install ADB tools on your PC.
Download GNU parted from Renegade Project.
Connect the phone to your pc.
Boot into TWRP. Send parted to the phone and correct permissions:
adb push parted /sdcard
adb shell
cp /sdcard/parted /sbin/
chmod 755 /sbin/parted
- Start partitioning the internal storage:
umount /data
umount /sdcard
parted /dev/block/sda
# Print partition layout
print
# Resize userdata (where Android is installed) to 64GB
resizepart 21 64GB
# Create a parition for Mobian
mkpart mobian ext4 64GB 123GB
quit
exit
- Reboot to TWRP again. Create file systems for Android and Mobian:
adb shell
mke2fs -t ext4 /dev/block/by-name/userdata
mkfs.ext4 /dev/block/by-name/mobian
exit
Now we could start installing Android and Mobian.
3. Install OS to the phone#
Download LineageOS builds from the official website
Click
Advanced
→ADB Sideload
in TWRP. Flash Android ROM. Dont’t forget to preserveboot.img
from Lineage OS ROM archive.
adb sideload lineageos.zip
Download Mobian weekly builds
Boot into fastboot mode. Flash the boot.img:
fastboot -S 100M flash boot mobian-boot.img
- Flash the rootfs to
mobian
partition. Also remember to preserve boot.img from Mobian archive.
fastboot -S 100M flash mobian mobian-rootfs.img
fastboot erase dtbo
4. Steps for dual-booting#
Boot into TWRP. Save boot.img of Mobian
and boot.img of Android
to Android’s internal storage (/sdcard1) because TWRP could only mount Android partitions.
Note there are some decryption issues on Android 12+ TWRP, so you could also save boot.img to external sdcard, or flash it via fastboot.
When we want to boot into Android, click Install
in TWRP and click Install images
, flash Android’s boot.img to boot partition in TWRP and reboot. The steps are the same for Mobian.
Finally, you will need to backup boot.img again after upgrading Android or Mobian systems.
5. Final words#
Why is this stupid? Because Renegade project developers are developing a boot menu for dual booting Android and Windows 11. Sadly it may not work for Linux mobile distros.
What’s more, I would like to replace Android with Ubuntu touch because most things (including camera) work on it, also Waydroid is available on UT. It could be used as a daily driver. However, Mobian and postmarketOS is much like “the real mobile Linux” in compred to locked-down UT.