iPXE discussion forum

Full Version: Is it posible to use variable arguments (parameters) when run ipxe and then pars it i
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

Is it posible to use variable arguments (parameters) when run ipxe and then pars it in script?
I need load some iso images, but write script for each is not good idea.
It will be better to run its in one script by specifying the path to the file as an argument.
I don't really understand your use-case
What iPXE binary are you using and how do you start it?
Those builds of iPXE that supports arguments from commandline (only ipxe.lkrn) would parse it as a script
I run ipxe from syslinux.

Now i must to have one config file in syslinux and 3 config files in ipxe.

default:
Code:
LABEL
menu label Image1
kernel /ipxe/ipxe.lkrn
initrd /ipxe/image1.ipxe

LABEL
menu label Image2
kernel /ipxe/ipxe.lkrn
initrd /ipxe/image1.ipxe

LABEL
menu label Image3
kernel /ipxe/ipxe.lkrn
initrd /ipxe/image1.ipxe

image1.ipxe:
Code:
#!ipxe
dhcp
sanboot --no-describe http://10.80.1.44/Image1.iso
image2.ipxe:
Code:
#!ipxe
dhcp
sanboot --no-describe http://10.80.1.44/Image2.iso
image3.ipxe:
Code:
#!ipxe
dhcp
sanboot --no-describe http://10.80.1.44/Image3.iso


I desire to have one config file in syslinux and one config file in ipxe.


default:
Code:
LABEL
menu label Image1
kernel /ipxe/ipxe.lkrn  http://10.80.1.44/Image1.iso
initrd /ipxe/loadimage.ipxe

LABEL
menu label Image2
kernel /ipxe/ipxe.lkrn http://10.80.1.44/Image2.iso
initrd /ipxe/loadimage.ipxe

LABEL
menu label Image3
kernel /ipxe/ipxe.lkrn http://10.80.1.44/Image2.iso
initrd /ipxe/loadimage.ipxe

loadimage.ipxe:
Code:
#!ipxe
dhcp
sanboot --no-describe %Arg1%
(2018-04-16 06:36)fatallerror Wrote: [ -> ]I run ipxe from syslinux.

Now i must to have one config file in syslinux and 3 config files in ipxe.

iPXE has script files, not config files (this might seem like a small difference, or the same thing, but it changes the concept of thinking quite a lot)

You haven't considered moving to iPXE based menues instead?


(2018-04-16 06:36)fatallerror Wrote: [ -> ]I desire to have one config file in syslinux and one config file in ipxe.

Code:
LABEL
menu label Image1
kernel /ipxe/ipxe.lkrn  http://10.80.1.44/Image1.iso
initrd /ipxe/loadimage.ipxe

loadimage.ipxe:
[code]#!ipxe
dhcp
sanboot --no-describe %Arg1%

It is possible to send in arguments over the cmdline, but that replaces the script, but in your case you can just do:
Code:
LABEL
menu label Image1
kernel /ipxe/ipxe.lkrn dhcp && sanboot --no-describe  http://10.80.1.44/Image1.iso

The alternative would be to have kernel /ipxe/ipxe.lkrn dhcp && set imagename=image1.iso && chain http://10.80.1.44/loadimage.ipxe

where loadimage.ipxe would have:
sanboot --no-describe ${imagename}

But as I mentioned, moving to iPXE based menues is probably the best actual solution for this. (this allows you to only use iPXE and skip PXELINUX completely)
Great. Thanks!
Reference URL's