Netboot
WARNING: Netboot support is not yet merged into pmbootstrap & pmaports |
Netboot describes the means of booting a device when the rootfs is not on the device but accessed via network, in this implementation via USB networking.
Preparations
Make sure your kernel has the necessary kernel config options for netboot.
$ pmbootstrap kconfig check --netboot $kernel-package-name
If not you need to adjust your kernel config otherwise netboot won't work.
Usage
First prepare a rootfs for your device. It is advisable to use the --extra-space
argument to increase the size of your rootfs (in the example you will get 1000MB of extra space) as no image resize will happen at runtime.
$ pmbootstrap --extra-space 1000 install
Then prepare your boot.img and flash it to the device:
$ pmbootstrap initfs hook_add netboot
$ pmbootstrap flasher boot # or however you flash/boot the kernel
After booting the device a network interface should appear over USB networking.
Finally you need to start the netboot server on your computer with the following command:
$ pmbootstrap netboot serve
Make sure to open up tcp port 9999 on your computer's firewall so the phone can connect to your netboot service.
If you've never used netboot for the current device, then the image from the previous pmbootstrap install
will get copied to $pmbootstrap_work/images_netboot/
and will persist normal pmbootstrap zap
calls as you will probably have data in your rootfs.
Note: For android devices, you may need to run fastboot erase dtbo
before flashing/booting the kernel. If you are running an a/b slot device, make sure to add the correct suffix (dtbo_a or dtbo_b).
Replacing persisted rootfs
You can replace the persisted rootfs image with a fresh image from pmbootstrap install
:
$ pmbootstrap netboot serve --replace
Deleting all netboot images
You can delete all persisted rootfs images:
$ pmbootstrap zap --netboot
See also
- tuxphones: You can now live-boot postmarketOS on Android phones, great article describing what the feature is and how it was implemented