iPXE discussion forum
Load menu.ipxe onto iPXE usb image? - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: Load menu.ipxe onto iPXE usb image? (/showthread.php?tid=6872)



Load menu.ipxe onto iPXE usb image? - stefanlasiewski - 2013-04-10 23:40

I built ipxe.usb and I copied the image to the USB drive at /dev/sdb . When the servers boot from USB, I can see iPXE.

Code:
stefanl@sl6:~/src/ipxe/src $ make
stefanl@sl6:~/src/ipxe/src $ sudo su -c "cat bin/ipxe.usb > /dev/sdb"

I would like to make use of iPXE scripts like `menu.ipxe` and `bootstrap.ipxe`, which are mentioned elsewhere in this forum.

-= Stefan


RE: Load menu.ipxe onto iPXE usb image? - MultimediaMan - 2013-04-11 21:34

The nice thing about the USB/Disk Based iPXE is that you can embed a large *.ipxe script into it. Unfortunately, you can't embed anything past that and expect to use it usefully.

So, you can build an embedded menu, but the any names/ addresses referenced in the embedded menu would have to be present on the network it was booted up on. You can make use of many iPXE/DHCP Option variables to make the menu useful as long as the directory structure/naming convention was followed.

Take for instance two sites: A correctly configured DNS Server, a DHCP server, and a webserver are at each location. The Webserver at site "a" is 192.168.0.12 and is named http://www.webserver.site-a.myplace.com, and the Webserver at site "b" is 192.168.59.12 and is named http://www.webserver.site-b.myplace.com.

"Really Bad" Embedded Code Example 1:

Code:
#!ipxe
set path http://192.168.0.12
chain ${path}/bootme.ipxe

"Bad" Embedded Code Example 2:

Code:
#!ipxe
set path http://www.webserver-a.site-a.myplace.com
chain ${path}/bootme.ipxe

"Good" Embedded Code Example:

Code:
#!ipxe
set path ${17}
chain ${path}/bootme.ipxe

The variable in both cases is ${path}, but in the "bad" examples it is hardcoded to a specific IP Address or a fixed name.

In the good example path is aliased to DHCP Option 17 (root-path); and is whatever the DHCP server says it is. Thus if you are at site "a" and have a correctly configured webserver and DHCP server, your embedded script will work as long as the Root-Path (DHCP option 17) is set, and the DHCP server has the file in the same relative location.

"Good" Example Explanation and Detail:

At site "a" the root path is http://www.webserver.site-a.myplace.com and the webserver has bootme.ipxe in the root directory.

At site "b" the root path is http://www.webserver.site-b.myplace.com and the webserver has bootme.ipxe in the root directory.

Your "Good" embedded script would work at either location. Whereas the "bad" script would only work on a network with a webserver at 192.168.0.12

A "Better" Example to think about:

At site "a" and "b" the root path is http://www.webserver and the DNS suffix (DHCP Option 15) is then used in the embedded script like this:

Code:
#!ipxe
set path ${17}
chain ${path}.${15}/bootme.ipxe

To create an embedded script in USB/Disk based image is easy: create the script, and embed it using the following syntax:

Code:
make /bin/ipxe.usb EMBED=menu.ipxe

You can only embed one script into iPXE.

Does this help?

M^3


RE: Load menu.ipxe onto iPXE usb image? - stefanlasiewski - 2013-04-12 01:12

(2013-04-11 21:34)MultimediaMan Wrote:  So, you can build an embedded menu, but the any names/ addresses referenced in the embedded menu would have to be present on the network it was booted up on. You can make use of many iPXE/DHCP Option variables to make the menu useful as long as the directory structure/naming convention was followed.

Ah, this would be for the occasions when a DHCP server is not available. My hope is to use a menu.ipxe to be served of of the network-boot servers, and use that same menu.ipxe on a thumbdrive for the occasion when the DHCP server is not available. This would simplify things-- one script, one procedure.

(2013-04-11 21:34)MultimediaMan Wrote:  Does this help?

Absolutely. Thank you.


RE: Load menu.ipxe onto iPXE usb image? - MultimediaMan - 2013-04-12 01:22

OK, now it's more clear: you want more of a "Boot disk" version of iPXE... but not having a DHCP Server is somewhat problematic for creating scripts and naming variables, but there are workarounds.

Consider: ipxe.usb is essentially ipxe.lkrn for USB/Disk. So any drivers embedded into iPXE... which means that net0 might not be "net0" if there are multiple NICs in the system.

a) Creating a menu to dump all of the Interfaces/NICs/MACs might be beneficial.

b) Create a submenu to select and set an IP address to an interface might also be a good idea.

Basically, you could make iPXE Menu version of Redhat's 'system-config-network' TUI - and that would be very cool indeed. Because config is kinda clunky.


RE: Load menu.ipxe onto iPXE usb image? - robinsmidsrod - 2013-04-12 15:50

Stefan: You might like this embedded script that is designed to let you interactively choose which network adapter to boot via DHCP. https://gist.github.com/robinsmidsrod/3871687

Use the same method mentioned above to embed it into the iPXE binary you would like to use.