Dual Booting/WiP
🚧 | This page is a work-in-progress. Some information contained within may be inaccurate or incomplete. |
To dual boot PMOS you need a boot method and a way to store data. After selecting both and following the guide, you will have a working device with dual boot.
How To Boot PMOS on android phones
Booting with a computer
This is the simplest option, but you will need a computer to boot PMOS. If used with SD card to store data, then nothing is going to be modified on the phone.
Firstly, you will need pmbootstrap
After entering fastboot mode on your phone.
Then running pmbootstrap flasher boot
will start PMOS.
Recovery partition
If PMOS kernel is written to the recovery partition, then it will boot PMOS when you enter recovery mode.
You can get the image of the kernel by running pmbootstrap export
A/B slots
On phones that have A/B slots, you can write PMOS kernel to slot B, and leave slot A unchanged.
Switching slots can be done with a computer by running fastboot --set-active=[a/b]
while phone is in fastboot mode.
Using Switch My Slot on android, you can switch the slot you are using, and it will boot PMOS.
On PMOS you can use qbootctl to switch back to android.
U-boot
U-Boot_porting#Supported_Devices
todo
lk2nd/lk1st
todo
Where to store data
Stowaway
Read everything before doing anything. This only works on edge.
The end result is going to be that can use a partition as root without modifying it. This is useful for android devices where modifying partition table is a crime.
Creating a tar
Firstly, we will need a tar of the root file system. this can be done by
running pmbootstrap init && pmbootstrap install
and configuring your installation as you wish.
Now we need to force PMOS kernel to use a partition where we will put our root file system.
Run pmbootstrap chroot -r
and then vi /etc/deviceinfo
. And you need to add this line deviceinfo_kernel_cmdline_append="pmos_root=[path to partition]"
replace [path to partition] with partition that you will use. In most cases, you will want to use /dev/disk/by-partlabel/userdata because it is the data partition on android.
To apply changes run pmbootstrap install
Finally, it is time to create the tar. cd into ~/.local/var/pmbootstrap/chroot_[device]_rootfs/ and run sudo tar -cf pmos.tar *
. Now you have a file named pmos.tar. You will need to transfer it to your phone. You can use adb push pmos.tar /sdcard
for that.
unpacking tar on your phone
If you are on Android, you will need root or use TWRP, run mkdir /data/.stowaways/pmos
and mv /sdcard/pmos.tar /data/.stowaways/pmos
. This will make a directory and move our tar into it. To unpack it we need to run tar -xf pmos.tar
. Now we can remove pmos.tar to save some space.
This is all you need to boot with this method.
fixing apk
But if you look closely, then you will realize that apk isn't working. To fix it, you will need to run sudo apk fix $(apk info) --allow-untrusted
and reboot.
SD card
You can flash the file system to a SD card. Then PMOS will be able to use it
Extra information
- Some UEFI Implementation for android phone like (efidroid,Renegade Project) can be used together with postmarketOS (see Guides for Dual boot PMOS with other UEFI based OS via Renegade Project (with included guides for booting PMOS via Renegade Project) on OnePlus 6/6t but some part of it can be reused on some other device as well.)
- On UEFI / BIOS based device, grub can be used for dual booting (see Dual boot with Windows on arch wiki)