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