Boot scripts

You can use any of the commands found in the gPXE command line reference as instructions in a script file to boot your OS.

For example, contains the following gPXE commands:

  kernel root=100   

or using the 'chain' command, this would be equivalent to:

  chain root=100   

or this will boot from iSCSI:


Embedded images

gPXE normally fetches images over the network using TFTP, HTTP, iSCSI, or other network protocols. It is also possible to embed an image file inside gPXE and make it available without fetching over the network.

By embedding gPXE scripts, you can customize gPXE's behavior before its first network access. For example, static network configuration can be done by embedding a gPXE script.

Images are embedded when building gPXE with make:

$ make EMBEDDED_IMAGE=../contrib/scripts/static.gpxe

This builds a gPXE image which executes the static.gpxe script on startup. The static.gpxe sample script works with QEMU's user network stack:

ifopen net0
set net0/ip
set net0/netmask
set net0/gateway
set net0/dns

Multiple images can be embedded:

$ make EMBEDDED_IMAGE=../contrib/scripts/gpxelinux.gpxe,/usr/lib/syslinux/pxelinux.0

This builds a gPXE image which executes the gpxelinux.gpxe script on startup. The gpxelinux.gpxe script performs DHCP before loading the embedded pxelinux.0 image and executing it:

dhcp net0
imgload img1

See the patched autoboot invocation for cases when the right interface to boot need to be found automatically.

see Stefanha's Summer of Code 2008 Week 8 journal

QR Code
QR Code scripting (generated for current page)