[ipxe-devel] Passing parameters from PXELinux to iPXE

Robert Socha socha at socha.it
Tue Aug 11 06:11:38 UTC 2020


Hi,


W dniu 08.08.2020 o 04:47, Christian Nilsson pisze:
> 
> And so what actually happen when you use that append?
 > Any error message or similar that is causing you issues?

Well. Almost nothing (variable is unset). But with this append when I 
load wimboot (from ipxe script) - wimboot have problem to start (don't 
remember exact error message but imgfree command solved this for wimboot).

>  From memory, any appended script will make the "autoboot" run that 
> script, instead of the default DHCP and before all that any embedded 
> script of course runs first? Have you checked the autoboot code? 

Yes I did. But autoboot iterate over all interfaces - and I need only to 
boot via specific one (with selected MAC address).

>And what is the "hack" that you have made?

This is only for "research" purpose.
I added code that "parse" APPEND data.

For example:

APPEND ipxe:set PXEMAC AA:BB:CC:DD:EE:FF

ipxe: prefix is removed and rest is executed via system() call.

My goal is to push somehow information for ipxe about MAC address (push 
from external source - ie. Foreman's template or via DHCP). I need to 
"boot" ipexe via correct interface (our servers have many interfaces, 
and only one is controlled by us, other are user controlled - so they 
could have user controlled DHCP servers).



My two current ideas:

Push this information via (isc) DHCP bootfile,
  for example for UEFI PXE Boot type:

option bootfile-name =
	concat("/",binary-to-ascii (16, 8, "/",
	substring (hardware, 1, 6)),"/ipxe.efi");

And this will load /AA/BB/CC/DD/EE/FF/ipxe.efi

This will require pre-generate ipxe.efi or generate them on the fly 
(with embed script with correct mac address).

Second idea is to use DHCP to pass special "mark" about correct "network".

For example:

in DHCP:

option ipxe.username "X-MGT-TAG-X";

And whit this sample script I'm able to locate correct net(n) interface:

#!ipxe
echo Platform: ${platform} ${manufacturer} ${product}
imgfree
echo Looking for management network on all interfaces...

set n:int8 0

:loop
echo Checking interface net${n}
ifclose ||
ifopen net${n} || goto missing
dhcp net${n} ||
inc n || goto missing
iseq ${username} X-MGT-TAG-X || goto loop

echo Management interface found: ${netX/ifname} ${netX/mac}
goto done

:missing
echo Management interface not found!

:done
shell


I miss-use "ipxe.username" in this example.

Best regards
-- 
Robert Socha



More information about the ipxe-devel mailing list