Inspired by this post on ipxe.org, the following script downloads and extracts the current Debian Bullseye netboot installer kernel and initrd, and prepares them for usage as a rudimentary disk image writing utility. It is intended to be used for KVM virtio guests on Proxmox VE, to install Mikrotik RouterOS via network boot.
Appropriate iPXE commands to use the resulting kernel and initrd would be something like the following:
dhcp
kernel tftp://${next-server}/disk-write/kernel
initrd tftp://${next-server}/disk-write/initrd
imgfetch http://${next-server}/chr-7.6.img /sda.img
boot kernel quiet
The iPXE imgfetch
command fetches the raw disk image file from an appropriate http (or other) server on the net booting network, and
presents it as /sda.img
within the initrd after boot. The embedded /init
script within the initrd looks for this file and will use
dd
to write it to /dev/sda
, as long as the first 16MB of the disk consists of binary zeros.