How PXE boot works in Slax

written by Tomas M. 6 years ago

If Slax is started with the boot option "Act as PXE server", it executes /sbin/pxe script during startup (in between runlevel 3 and runlevel 4). The pxe script has several goals. First of all, it takes the current initramfs directory tree from currently running Slax (from /mnt/live), adds to it all currently available network drivers from /lib/modules/ from the currently running Slax system, and packs everything into a new initramfs image, which is much bigger than the original one (since it contains all the drivers). It is stored in /var/state/dnsmasq/root/initramfs.img). This image is packed by gzip rather than xz because gzip has much better compression speed, and we don't care about compression ratio here, the size actually doesn't matter so much.

When the new initramfs image is created, Slax data files are symlinked to /var/state/dnsmasq/root/* so the files can be downloaded by the client machines later.

Finally, several services are started in background, such as DHCP, TFTP and HTTP. This ensures that the client machines get IP address assigned properly and are instructed to download vmlinuz and initramfs.img over TFTP from the server. Later, the client machines will download Slax data files over HTTP (which is much faster than TFTP in general) and Slax is started on the clients.

Update

If you have your own existing PXE server and just would like to boot Slax on your client machines by using it, you can actually do that too, but it is a bit tricky. First of all, you'll have to boot Slax acting as PXE server, and locate files in /var/state/dnsmasq/root/. You'll see initrfs.img image there and a link to vmlinuz. These two files must be served by your own PXE server over TFTP. Next, you'll have to setup a webserver on the same machine where your PXE server is running, on port 7529 (this number appears if you type SLAX on your mobile phone). Your webserver must provide PXEFILELIST file as you can find it in /var/state/dnsmasq/root/ as well as the data files listed in the PXEFILELIST.

Tomas M.

(c) 2019, Tomas M; rss