[ipxe-devel] Passing parameters from PXELinux to iPXE

Robert Socha socha at socha.it
Fri Aug 7 20:44:50 UTC 2020


W dniu 07.08.2020 o 22:20, Geert Stappers pisze:
> On Fri, Aug 07, 2020 at 09:43:11PM +0200, Robert Socha wrote:
>> Hi,
>>
>> This is more user-level question. But for last few days I'm unable to post
>> question via forum.ipxe.org.
>>
>> I wonder if this supported option (passing parameters from PXELinux to iPXE)
>>
>>
>> I have PXELinux boot:
>>
>> LABEL startipxe
>>    KERNEL ipxe.lkrn
>>    APPEND set MYVAR some-data
>>
>> And from chain loaded ipxe with embed script:
>>
>> #!ipxe
>> echo MYVAR: ${MYVAR}
>> ... other stuff
>>
> 
> Why?
> 

Thanks for asking. My use case is:

I bootstrap hosts via PXELinux (I'm unable to change this -  this 
internal DHCP's related issue).

PXELinux templates are auto-generated via foreman (I know than I can try 
to replace (l)pxelinux.0 by ipxe binary - but this will require a lot of 
testing of other stuff).

So host is booted via PXElinux, and I chain load IPXE via:

DEFAULT boot
LABEL boot
   KERNEL ipxe-foreman.lkrn
   APPEND ipxe:set PXEMAC MAC_FROM_TEMPLATE

Where  ipxe: part is my patch which parse img memory and pass this to 
system() function.

Why I need that?

I need this MAC address in my ipxe script to connect via same NIC 
(servers have more than one nic, and only one NIC is controlled by 
us/operator - other are user controlled and have user's DHCP servers too).

I know that I can use undionly.kpxe - but this much slower than native 
drivers :)

So i solved this by a little "hacking" in source code.

And I only wonder if this "args passing" is any how supported in 
upstream iPXE?


I trying to convince other co-workers to switch to native iPXE, but this 
will take some time. But after that the above will be for sure "my 
imaginary problem" :)

Best regards
-- 
Robert Socha




More information about the ipxe-devel mailing list