Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iPXE source code - embedding.elf
2017-05-24, 16:04
Post: #1
iPXE source code - embedding.elf
Hello guys,

I have created my own test.ipxe file that I have embedded into the original undionly.kpxe file.

My code inside the test.ipxe is like:

:pc_boot

set initiator-iqn "iqn-details"
sanboot iscsi:"iscsi-details"
boot

My system is booting through an iSCSI disk.
I would like to add/ implement my own .elf executable file before booting through the iscsi OS.
Does anyone knows how I can do this?
For example, I have the file mytest.elf and I tried to following code with no success.

boot mytest.elf
set initiator-iqn "iqn-details"
sanboot iscsi:"iscsi-details"
boot

P.S. My TFTP default directory contains the mytest.elf file but I do not know If I need to import any option of that into my DHCP configuration.

Any thoughts?

Many thanks
Find all posts by this user
Quote this message in a reply
2017-05-25, 15:54
Post: #2
RE: iPXE source code - embedding.elf
(2017-05-24 16:04)Abrams Wrote:  I would like to add/ implement my own .elf executable file before booting through the iscsi OS.
Does anyone knows how I can do this?

Do you really have an ELFBoot executable? That's an incredibly obscure format that I haven't seen used for years.

What is the actual underlying problem that you are trying to solve?

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2017-05-25, 18:26
Post: #3
RE: iPXE source code - embedding.elf
(2017-05-25 15:54)mcb30 Wrote:  
(2017-05-24 16:04)Abrams Wrote:  I would like to add/ implement my own .elf executable file before booting through the iscsi OS.
Does anyone knows how I can do this?

Do you really have an ELFBoot executable? That's an incredibly obscure format that I haven't seen used for years.

What is the actual underlying problem that you are trying to solve?

Michael

Dear Michael,

Thanks for the accept, yes I have an executable file .elf that at the moment does a simple check of the memory address. I am trying to achieve something but it is a private project so I can not tell you more.
By the way I found the solution about the .elf file.
I need to boot through an apache server and call it through the Webserver
for example :
boot http://ipaddress-webserver/file.elf
and it works perfect.

Many thanks
Find all posts by this user
Quote this message in a reply
2017-05-25, 18:42
Post: #4
RE: iPXE source code - embedding.elf
(2017-05-25 18:26)Abrams Wrote:  Thanks for the accept, yes I have an executable file .elf that at the moment does a simple check of the memory address. I am trying to achieve something but it is a private project so I can not tell you more.
By the way I found the solution about the .elf file.
I need to boot through an apache server and call it through the Webserver
for example :
boot http://ipaddress-webserver/file.elf
and it works perfect.

OK. Please be aware that ELFBoot executables are not allowed to return to iPXE (and iPXE will deliberately hang if an ELFBoot executable attempts to return), so there is no way for you to call your external ELFBoot executable and then return to iPXE in order to perform the iSCSI boot.

You may want to investigate the option of using a different executable format, such as a PXE NBP or an iPXE script (both of which are able to return back to iPXE).

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2017-05-26, 13:25
Post: #5
RE: iPXE source code - embedding.elf
(2017-05-25 18:42)mcb30 Wrote:  
(2017-05-25 18:26)Abrams Wrote:  Thanks for the accept, yes I have an executable file .elf that at the moment does a simple check of the memory address. I am trying to achieve something but it is a private project so I can not tell you more.
By the way I found the solution about the .elf file.
I need to boot through an apache server and call it through the Webserver
for example :
boot http://ipaddress-webserver/file.elf
and it works perfect.

OK. Please be aware that ELFBoot executables are not allowed to return to iPXE (and iPXE will deliberately hang if an ELFBoot executable attempts to return), so there is no way for you to call your external ELFBoot executable and then return to iPXE in order to perform the iSCSI boot.

You may want to investigate the option of using a different executable format, such as a PXE NBP or an iPXE script (both of which are able to return back to iPXE).

Michael

Hi Michael,

Well, first I attach the iSCSI disk and then execute my ELF file and then I am booting through the iSCSI disk.

For example:

set initiator-iqn "IQN of the initiator"
sanhook iscsi:"IQN of the target"
boot http://<ip.address of the Webserver>/test.elf
sanboot iscsi:"IQN of the target"

Using this code, actually I can execute my .elf file and then booting through the iSCSI disk. But first you need to attach the disk.
This code works for me.

Many thanks!
Find all posts by this user
Quote this message in a reply
2017-05-26, 13:43
Post: #6
RE: iPXE source code - embedding.elf
(2017-05-26 13:25)Abrams Wrote:  set initiator-iqn "IQN of the initiator"
sanhook iscsi:"IQN of the target"
boot http://<ip.address of the Webserver>/test.elf
sanboot iscsi:"IQN of the target"

Using this code, actually I can execute my .elf file and then booting through the iSCSI disk. But first you need to attach the disk.

No you can't. Take a look at https://git.ipxe.org/ipxe.git/blob/HEAD:...boot.c#l65. You can see that iPXE will refuse to continue after invoking an ELFBoot executable. If your "test.elf" file is successfully returning to iPXE and continuing to the "sanboot", then it is not an ELFBoot executable.

The file extension ".elf" doesn't actually mean anything to iPXE; it will detect the image type based on the contents of the image rather than the filename. You can use "imgstat" to see what type of executable you really have.

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2017-06-02, 13:14
Post: #7
RE: iPXE source code - embedding.elf
(2017-05-26 13:43)mcb30 Wrote:  
(2017-05-26 13:25)Abrams Wrote:  set initiator-iqn "IQN of the initiator"
sanhook iscsi:"IQN of the target"
boot http://<ip.address of the Webserver>/test.elf
sanboot iscsi:"IQN of the target"

Using this code, actually I can execute my .elf file and then booting through the iSCSI disk. But first you need to attach the disk.

No you can't. Take a look at https://git.ipxe.org/ipxe.git/blob/HEAD:...boot.c#l65. You can see that iPXE will refuse to continue after invoking an ELFBoot executable. If your "test.elf" file is successfully returning to iPXE and continuing to the "sanboot", then it is not an ELFBoot executable.

The file extension ".elf" doesn't actually mean anything to iPXE; it will detect the image type based on the contents of the image rather than the filename. You can use "imgstat" to see what type of executable you really have.

Michael

Hi Michael,

Can I ask you something if you know to help me please,

Is there any way to write the command:

boot test.elf #where test.elf lets say that it is an executable file that is located in the same TFTP directory with the undionly.kpxe file which pointed by the DHCP in the network with the filename "undionly.kpxe" option? I mean, how the system can be informed and look at the TFTP directory to execute this test.elf file ?
Do I need to add an option into my DHCP server?
Is there any directory by default that an iPXE looks inside for the file?

Many thanks!
Find all posts by this user
Quote this message in a reply
2017-06-02, 13:56
Post: #8
RE: iPXE source code - embedding.elf
(2017-06-02 13:14)Abrams Wrote:  Is there any directory by default that an iPXE looks inside for the file?

Yes; it will look by default in the folder pointed to by the DHCP next-server and filename. This will be the same directory from which you loaded undionly.kpxe.

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2017-06-02, 14:01
Post: #9
RE: iPXE source code - embedding.elf
(2017-06-02 13:56)mcb30 Wrote:  
(2017-06-02 13:14)Abrams Wrote:  Is there any directory by default that an iPXE looks inside for the file?

Yes; it will look by default in the folder pointed to by the DHCP next-server and filename. This will be the same directory from which you loaded undionly.kpxe.

Michael

Right, so, If I have in the same directory with the undionly.kpxe file, another file that I want to use with the "boot" command should be find it and execute right?
Because, I have the file into the same directory and the iPXE through the boot process says that cannot find the file.

Do you have any idea what I am doing wrong? Any suggestions?
I am writing "boot test.elf" and nothing is happening but If I use the "boot http://10.0.0.2/test.elf" where this is my Web server it works. This means that with the first format cannot find and download the executed file.
How I can fix this ?

Many thanks again!
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)