* [U-Boot] [PATCH] pxe: fix handling of absolute paths
@ 2013-10-18 18:04 Rob Herring
2013-10-22 10:34 ` Ian Campbell
2013-11-04 21:31 ` [U-Boot] " Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Rob Herring @ 2013-10-18 18:04 UTC (permalink / raw)
To: u-boot
From: Rob Herring <rob.herring@calxeda.com>
pxelinux and syslinux differ in their handling of absolute paths in menu
files. A pxelinux path is aways prepended with the bootfile path while
syslinux allows for absolute paths. u-boot was always treating a leading
/ as an absolute path breaking some pxelinux setups. Fix this by adding
a flag to distinguish pxelinux vs. syslinux behavior.
Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
common/cmd_pxe.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 79d3a06..db6b156 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -25,6 +25,8 @@ const char *pxe_default_paths[] = {
NULL
};
+static bool is_pxe;
+
/*
* Like getenv, but prints an error if envvar isn't defined in the
* environment. It always returns what getenv does, so it can be used in
@@ -84,7 +86,8 @@ static int get_bootfile_path(const char *file_path, char *bootfile_path,
char *bootfile, *last_slash;
size_t path_len = 0;
- if (file_path[0] == '/')
+ /* Only syslinux allows absolute paths */
+ if (file_path[0] == '/' && !is_pxe)
goto ret;
bootfile = from_env("bootfile");
@@ -1472,6 +1475,8 @@ int do_pxe(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc < 2)
return CMD_RET_USAGE;
+ is_pxe = true;
+
/* drop initial "pxe" arg */
argc--;
argv++;
@@ -1504,6 +1509,8 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char *filename;
int prompt = 0;
+ is_pxe = false;
+
if (strstr(argv[1], "-p")) {
prompt = 1;
argc--;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [PATCH] pxe: fix handling of absolute paths
2013-10-18 18:04 [U-Boot] [PATCH] pxe: fix handling of absolute paths Rob Herring
@ 2013-10-22 10:34 ` Ian Campbell
2013-11-04 21:31 ` [U-Boot] " Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2013-10-22 10:34 UTC (permalink / raw)
To: u-boot
On Fri, 2013-10-18 at 13:04 -0500, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
>
> pxelinux and syslinux differ in their handling of absolute paths in menu
> files. A pxelinux path is aways prepended with the bootfile path while
> syslinux allows for absolute paths. u-boot was always treating a leading
> / as an absolute path breaking some pxelinux setups. Fix this by adding
> a flag to distinguish pxelinux vs. syslinux behavior.
>
> Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
You could also have Tested- or Acked-by from me if desired.
I also took a gander at the syslinux code and found that
core/fs/pxe/pxe.c:get_prefix() sets the initial cwd to the prefix. The
lookups are done relative to this unless the path is a URL (roughly
means it contains "::", see code/comments around the use of
PXE_RELATIVE)). In particular a leading "/" isn't specially treated as
far as I can see...
Ian.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] pxe: fix handling of absolute paths
2013-10-18 18:04 [U-Boot] [PATCH] pxe: fix handling of absolute paths Rob Herring
2013-10-22 10:34 ` Ian Campbell
@ 2013-11-04 21:31 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2013-11-04 21:31 UTC (permalink / raw)
To: u-boot
On Fri, Oct 18, 2013 at 01:04:42PM -0500, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
>
> pxelinux and syslinux differ in their handling of absolute paths in menu
> files. A pxelinux path is aways prepended with the bootfile path while
> syslinux allows for absolute paths. u-boot was always treating a leading
> / as an absolute path breaking some pxelinux setups. Fix this by adding
> a flag to distinguish pxelinux vs. syslinux behavior.
>
> Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131104/231cea54/attachment.pgp>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-04 21:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-18 18:04 [U-Boot] [PATCH] pxe: fix handling of absolute paths Rob Herring
2013-10-22 10:34 ` Ian Campbell
2013-11-04 21:31 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox