Booting postmarketOS from Internet.
Netboot works like “Live-USB” that users could try postmarketOS without flashing the OS. Of course, the bootloader must be unlcoked in the first place.
- Device: Xiaomi Redmi 5 Pro (whyred)
Run pmbootstrap
and choose xiaomi/whyred
. Then we have to modify kernel configs.
1. Check netboot compatbility of Linux kernel#
- Check if the kernel supports Netboot
pmbootstrap kconfig check --netboot linux-xiaomi-whyred
- If the kernel does not support Netboot, this message should pop up:
WARNING: linux-xiaomi-whyred/config-xiaomi-whyred.aarch64: CONFIG_BLK_DEV_NBD should be set.
ERROR: kconfig check failed!
- Edit kernel configs
pmbootstrap kconfig edit
- Enable
CONFIG_BLK_DEV_NBD
:
Symbol: BLK_DEV_NBD [=n]
Type : tristate
Prompt: Network block device support
Location:
-> Device Drivers
-> Block devices (BLK_DEV [=y])
-> Network block device support
- Compile Linux kernel
pmbootstrap build linux-xiaomi-whyred
2. Netbooting#
- Create rootfs
pmbootstrap --extra-space 3000 install --no-sparse
- Reboot the phone into fastboot mode. Connect it to PC. Then postmarketOS logo will show up and wait for rootfs
pmbootstrap initfs hook_add netboot
pmbootstrap flasher boot
- Open 9999 port of firewall on the PC. Then start Netboot server:
pmbootstrap netboot serve
- Now the phone should boot. We could ssh into it:
- Now we can try out postmarketOS on the phone. Everthything works like real installation. And postmarketOS will stop working if the phone is unplugged from PC.
The data of Netboot postmarketOS is located at ~/.local/var/pmbootstrap/images_netboot/
.
References