[gPXE] Pushing GPXE script to HTTP server

David Geary dgeary2 at une.edu.au
Wed Nov 3 02:02:02 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/11/10 16:57, htruong at tnhh.net wrote:
> Hi all,
> 
> I'm working on converting workstations in our lab to diskless. So far
> I've got good luck with loading our customized live casper image for
> Ubuntu with something like this:
> 
>> 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
> 
> which can magically achieve the same effect.
> 
> I wonder if that's possible and if that's possible, where can I find the
> directions for it.

It certainly is possible, and relatively easy. See:
http://etherboot.org/wiki/appnotes/autobootchainurl

Anything that can be done on the command line can also be scripted in
the same way as an embedded script. It can be stored on a web server in
a file that could be either static or dynamically generated.

Note that gPXE aborts the script and drops to the command line if a
scripted command fails.

For a command line reference see:
http://etherboot.org/wiki/commandline

I'm actually doing a similar thing at the moment for my uni. My
configuration, absent any identifying information, follows. I hope it helps:

Embedded gPXE script:

#!gpxe
dhcp any
set url http://webserver/bootfolder
chain ${url}/menu.gpxe

menu.gpxe on webserver:

#!gpxe
chain vesamenu.c32 menu.cfg

Note that I have included vesamenu.c32 from the Syslinux project to
provide a menu system.

menu.cfg on webserver:

prompt 0
default vesamenu.c32
timeout 50
menu title Boot Menu
label Operating System
kernel os.gpxe
label Boot Next Device
kernel exit.gpxe
label Reboot
kernel reboot.c32
label Reload Menu
kernel menu.gpxe

Note that I have included reboot.c32 from the Syslinux project to
provide a quick method to reboot.

os.gpxe on webserver:

#!gpxe
imgfree
kernel os/vmlinuz
initrd os/initrd.img
boot

Note that kernel command line parameters go after the kernel image but
still on the same line.
Note also imgfree is needed to unload vesamenu.c32 that drives the menu
so that the kernel may be loaded.

exit.gpxe on webserver:

#!gpxe
exit

Note that the 'exit' command fails the boot and BIOSes respond to this
differently.

Note also that all of the gPXE scripts, comboot programs, and menu.cfg
reside in webserver/bootfolder/ but the operating system kernels and
initrds reside in operating system specific folders because they
normally have the same names.

Note also that this is a static configuration.

Note also that the gpxe scripts on the webserver are stored in plain
text files.

Hope this helps.

- -- 
David Joshua Geary
UNE Linux User Group: linux at une.edu.au <http://lugune.dyndns.org>
I don't care what software you use so long as
  we only exchange files in open data formats
Open-Document <http://en.wikipedia.org/wiki/Open_Document>
Ogg <http://en.wikipedia.org/wiki/Ogg>
PDF <http://en.wikipedia.org/wiki/Pdf>

- -----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.9 (GNU/Linux)

mQGiBEl4bFQRBADDxqFXQ0Rv69sZ5xxK2WYXASHVe68Qf0LT0ag0/kEb4t3WWi9K
R5FKOhHrp1Fnt+S+NF4157l3bTJ1aFMEc2WM97qS37u0OXr+9XzMyWQyH3NLKHgm
QitKPasVM2UJaateFfr2XijQIfKQURkE03rKsEADm75qPeb5yhYKGuGQ9wCg5LFJ
5c67ZiJ/zPcS9pgKbUDMG4sD/A5URvxutCgbVIHr34nZu5OnF3BkCbdilMHATVCn
y2Y6w2bkjozSL4ieWTOqRSfiZaEBxgYXKMKVZWpGSiz9nB8Tn0Ddf8poK//nRAeo
qV+JG1vnkfoxQR0HXCbzyxxNtRELWZVUGgWLrUEBB6XaDC5SQzhCoeT5LTT9jOQg
uA/eBACJ0yQFdTgcnT3G5ZmMYzYU3t9WFsBEB4uLFdZn/WLRr2LU0e2ZS5fAz5y0
eCcxNiw8Yn35qKiu6ulY3LcHkBwEL+wJVCrd05MWKxYx7hpW6jMP/SqoTvAhr3a5
GlSMQ+K+YmcGrKktVF47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PGP PUBLIC KEY BLOCK-----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzQ+tkACgkQzeY++hWFs4zh3ACgyc6VSIN/jJ4c0WwRbTPSz79a
MuQAn0Qz5mxx0iQ0GxqnsGjeKXJ8LsGn
=zW2f
-----END PGP SIGNATURE-----


More information about the gPXE mailing list