Jump to content

Netboot: Difference between revisions

From postmarketOS Wiki
link to tuxphones netboot article
Usage: I added a note about making sure to erase dtbo for android devices on the correct slot.
Tags: mobile edit mobile web edit
Line 37: Line 37:


If you've never used netboot for the current device, then the image from the previous <code>pmbootstrap install</code> will get copied to <code>$pmbootstrap_work/images_netboot/</code> and will persist normal <code>pmbootstrap zap</code> calls as you will probably have data in your rootfs.
If you've never used netboot for the current device, then the image from the previous <code>pmbootstrap install</code> will get copied to <code>$pmbootstrap_work/images_netboot/</code> and will persist normal <code>pmbootstrap zap</code> calls as you will probably have data in your rootfs.
Note: For android devices, you may need to run <code>fastboot erase dtbo</code> 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 ===
=== Replacing persisted rootfs ===

Revision as of 23:34, 29 January 2022

Warning 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 flash_kernel # 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

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