public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] pxe: fix handling of absolute paths
Date: Fri, 18 Oct 2013 13:04:42 -0500	[thread overview]
Message-ID: <1382119482-26224-1-git-send-email-robherring2@gmail.com> (raw)

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

             reply	other threads:[~2013-10-18 18:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 18:04 Rob Herring [this message]
2013-10-22 10:34 ` [U-Boot] [PATCH] pxe: fix handling of absolute paths Ian Campbell
2013-11-04 21:31 ` [U-Boot] " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382119482-26224-1-git-send-email-robherring2@gmail.com \
    --to=robherring2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox