[gPXE] Pushing GPXE script to HTTP server
Lindgren Daniel
daniel.lindgren at tullverket.se
Tue Nov 2 03:43:55 EDT 2010
> > dhcp net0
> > initrd http://urania/initrd.gz
> > kernel http://urania/vmlinuz boot=casper toram netboot=nfs
> > nfsroot=150.243.x.x:/export/trubuntu -- boot
>
> We really like it as gPXE allowed us to do a network boot
> without touching the DHCP server which we don't have control
> of. We burned gPXE with the script to our eth card ROM via
> rom-o-matic. However, I think it is a good idea to store all
> the kernel parameters to a file stored on a webserver rather
> than hard-coding them in the ROM so I don't have to flash the
> ROM image again every time we change the parameters for the
> kernel. But I haven't found anything after digging the
> documentation for hours.
>
> Something like
>
> dhcp net0
> chainload http://urania/mygPXEconfig
You could use a simple CGI script to generate the config, if the web
server urania has PHP support you would burn this to ROM:
dhcp net0
chainload http://urania/genconf.php
The CGI script genconf.php on urania would look something like this
(nfsroot address has to be real, of course):
<?php
header ( "Content-type: text/plain" );
echo "dhcp net0\n";
echo "initrd http://urania/initrd.gz\n";
echo "kernel http://urania/vmlinuz boot=casper toram netboot=nfs
nfsroot=150.243.x.x:/export/trubuntu -- boot\n"
?>
If you need to change the kernel parameters you change it in
genconf.php, no need the burn ROM again.
You could of course make it more dynamic by using variables from the ROM
script, e g:
dhcp net0
chainload http://urania/genconf.php?IP=${net0/ip}
And extend the CGI script to use the IP variable:
<?php
header ( "Content-type: text/plain" );
$ipaddr = $_GET['IP'];
# ...
# ... use the supplied IP address to figure out the closest webserver
and nfsroot, set $closest_web and $closest_nfs
# ...
echo "dhcp net0\n";
echo "initrd http://$closest_web/initrd.gz\n";
echo "kernel http://$closest_web/vmlinuz boot=casper toram netboot=nfs
nfsroot=$closest_nfs:/export/trubuntu -- boot\n";
?>
See http://etherboot.org/wiki/commandline for more info.
Cheers,
Daniel
More information about the gPXE
mailing list