Skip to main content

Dual booting Mobian Linux and Android on Xiaomi Poco F1

Categories   Smartphone Linux Phone
Tags   PostmarketOS Linux Android
Table of Contents

🇹🇼 中文版

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
#

  1. Install Fastboot tool on your PC.

  2. 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
#

  1. Install ADB tools on your PC.

  2. Download GNU parted from Renegade Project.

  3. Connect the phone to your pc.

  4. 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
  1. 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
  1. 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
#

  1. Download LineageOS builds from the official website

  2. Click AdvancedADB Sideload in TWRP. Flash Android ROM. Dont’t forget to preserve boot.img from Lineage OS ROM archive.

adb sideload lineageos.zip
  1. Download Mobian weekly builds

  2. Boot into fastboot mode. Flash the boot.img:

fastboot -S 100M flash boot mobian-boot.img
  1. 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.

Related

Remote Desktop for Linux phones running postmarketOS using Wayland Protocol
Categories   Smartphone Linux Phone
Tags   Linux PostmarketOS
Netboot: Booting postmarketOS from the Internet
Categories   Smartphone Linux Phone
Tags   PostmarketOS
[Root] Running docker container on Redmi Note 5 Pro
Categories   Smartphone Root and Custom Rom
Tags   Termux Android Linux Docker

Leave a comment

Choose the comment system you like. Giscus for codes, Disqus for anonymous comments.

Please login to your Github account to leave a comment. You can post codes here for discussion. For images, please upload to Imgur and copy links. Your comments would be visible to everyone on Github Discussions.

This comment system is provided by Disqus, you may see forcing Disqus ADs on this page. Sometimes your comment may need to be reviewed, resulting in delayed display. Thank you for your understanding.