[gPXE] SUSPECT: Re: Local menu system for gpxe

Shao Miller Shao.Miller at yrdsb.edu.on.ca
Wed Apr 14 15:36:04 EDT 2010


Good day Ben,

In regards to a means to configure gPXE's IP parameters before booting:

Embed the following gPXE script (~/myscript.gpxe):

#!gpxe
set ip 192.168.0.3
set netmask 255.255.255.0
set gateway 192.168.0.1
set dns 10.113.114.8
config
set 209:string pxelinux.cfg/default
set 210:string http://webserver/
chain ${210:string}pxelinux.0

Embed the script into your gPXE build like this:

~$ cd gpxe/src
~/gpxe/src$ make EMBEDDED_IMAGE=~/myscript.gpxe bin/gpxe.usb
...
~/gpxe/src$ dd if=bin/gpxe.usb of=/dev/sdb

where /dev/sdb would be a USB stick whose entire contents would be erased.

The above is a sample for how you can pre-populate a few IP parameters, 
then use gPXE's 'config' command to hack them just before trying to boot 
to a PXELINUX that will boot from some webserver.  I'll be you could 
adapt this to your needs.

Alternatively, there is a patch for gPXE that allows you to pass 
commands to gPXE from another boot-loader, such as Syslinux.  You might 
find this convenient, so you could have something like:

LABEL site_a
  KERNEL gpxe.lkrn
  APPEND set ip=192.168.0.3; set gateway 192.168.0.1
LABEL site_b
  KERNEL gpxe.lkrn
  APPEND set ip=192.168.1.3; set gateway 192.168.1.1

where you'd then only need a single gpxe.lkrn who could have the 
following embedded script:

#!gpxe
set netmask 255.255.255.0
set dns 10.113.114.8
config
set 209:string pxelinux.cfg/default
set 210:string http://webserver/
chain ${210:string}pxelinux.0

The patch is called something like the "gPXE lkrn initrd cmdline patch."

- Shao Miller


More information about the gPXE mailing list