Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
relative tftp path for embedded script, pxelinux.0 behaviour
2012-07-21, 22:10
Post: #1
relative tftp path for embedded script, pxelinux.0 behaviour
I boot undionly.kpxe from tftp. Trivial script were embedded:

Code:
#!ipxe
dhcp
chain default.ipxe

Works well if undionly.kpxe and default.ipxe stored in tftp root directory. I move undionly.kpxe to subdirectory and change dhcp 067 option, but it search default.ipxe in tftp root, not subdirectory near undionly.kpxe.

I need pxelinux.0 behaviour. pxelinux.0 search for config starting from tftp path where pxelinux.0 loaded from, not from tftp root directory.

Something like:
Quote:If this command is executed from within an iPXE script, then the URI will be interpreted as being relative to the URI of the script itself. For example, if the script http://boot.ipxe.org/demo/boot.php contains the line
chain pxelinux.0
then iPXE will download and boot http://boot.ipxe.org/demo/pxelinux.0.
For embedded scripts.
Find all posts by this user
Quote this message in a reply
2012-07-22, 19:03
Post: #2
RE: relative tftp path for embedded script, pxelinux.0 behaviour
If you look at my menu example at https://gist.github.com/2234639 line 123-136 (default.pxe) you can see how you can override the PXELinux root path and config file. Hopefully that should help you out.
Visit this user's website Find all posts by this user
Quote this message in a reply
2012-07-22, 21:54 (This post was last modified: 2012-07-22 21:56 by aka.)
Post: #3
RE: relative tftp path for embedded script, pxelinux.0 behaviour
No.

User untar my distributive somewhere under tftp root. undionly.kpxe and default.ipxe stored in this distributive. I didn't know where user untar it while I write default.ipxe. In your example, you know path. I don't know the path. Then user write path to undionly.kpxe into 067 dhcp option. For example, 067 dhcp is: diskless/wt5/5.1.16/undionly.kpxe

pxelinux.0 will automatically look at 067 and search config in diskless/wt5/5.1.16/, not in tftp root. So user can untar files from distributive anywhere he want, and pxelinux.0 will find config.

I need something like this (docs of my dream):

Quote:If this command is executed from within an embedded into undionly.kpxe iPXE script, then the URI will be interpreted as being relative to the URI of the undionly.kpxe downloaded from. For example, if the script embedded into undionly.kpxe downloaded from tftp as "any/path/in/tftp/undionly.kpxe" contains the line
chain default.ipxe
then iPXE will download and boot "any/path/in/tftp/default.ipxe" from the same tftp server.
Find all posts by this user
Quote this message in a reply
2012-07-24, 18:45
Post: #4
RE: relative tftp path for embedded script, pxelinux.0 behaviour
I'm not exactly sure what your problem is. Relative paths should work. If PXELinux is unable to resolve your root path properly you need to specify it explicitly. Unfortunately your English is not easy to understand, so I'm not sure if I answered your question or not.
Visit this user's website Find all posts by this user
Quote this message in a reply
2012-07-24, 19:33
Post: #5
RE: relative tftp path for embedded script, pxelinux.0 behaviour
(2012-07-24 18:45)robinsmidsrod Wrote:  Relative paths should work.
Relative paths work in downloaded scripts. Relative paths do not work in embedded script. I need relative paths in embedded script.

I put undionly.kpxe into $TFTPROOT/long/long/path/
I put script default.ipxe into the same directory.
I specify in 067 dhcp option "long/long/path/undionly.kpxe".
I embed script into undionly.kpxe:
Code:
#!ipxe
dhcp
chain default.ipxe

It does NOT work. It searches for default.ipxe in tftp root. Because relative paths do NOT work in embedded script.

Ok, I embed script with path:
Code:
#!ipxe
dhcp
chain long/long/path/default.ipxe

It works.

In $TFTPROOT/long/long/path/default.ipxe i write:

Code:
#!ipxe
chain default.ipxe

And it works without full path. Because relative paths work in downloaded scripts.

I need relative paths in embedded script.
Find all posts by this user
Quote this message in a reply
2012-07-25, 15:29
Post: #6
RE: relative tftp path for embedded script, pxelinux.0 behaviour
I suggest you report this potential bug on the mailing-list.
Visit this user's website Find all posts by this user
Quote this message in a reply
2014-01-01, 16:03
Post: #7
RE: relative tftp path for embedded script, pxelinux.0 behaviour
You can use Long Path Tool for such issues.
Find all posts by this user
Quote this message in a reply
2014-01-08, 08:27
Post: #8
RE: relative tftp path for embedded script, pxelinux.0 behaviour
I think I know what the actual problem is. The vendor PXE implementation is loading undionly.kpxe from somewhere on the TFTP server, but iPXE, when loaded like this, does not know where it was loaded from because the information is not available, or it is just not resolved. The filename should still be available in the cached dhcp response, but my guess is that the "current directory" is not set to this folder during initial load, as iPXE does when it chainloads a script.

I'm not sure if this is a feature or a bug. You should report it on the mailing-list regardless.
Visit this user's website Find all posts by this user
Quote this message in a reply
2014-01-09, 08:13
Post: #9
RE: relative tftp path for embedded script, pxelinux.0 behaviour
Thanks so muchSmile

Highlight Manufacturing Corp., Ltd.
Visit this user's website Find all posts by this user
Quote this message in a reply
2021-05-11, 09:47 (This post was last modified: 2021-05-11 09:48 by pojntfx.)
Post: #10
RE: relative tftp path for embedded script, pxelinux.0 behaviour
An old thread, but as I still stumbled upon this issue in 2021: It is possible to use i.e. the `root-path` (17) DHCP option to find the absolute path from which iPXE was loaded, even if it is from an embedded script; I've created a repo which shows this in action: https://github.com/pojntfx/ipxe-binaries

Code:
#!ipxe

dhcp
chain tftp://${root-path}:69/config.ipxe
Find all posts by this user
Quote this message in a reply
Post Reply 




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