mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
pxe: fix handling of absolute paths
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>
This commit is contained in:
@@ -25,6 +25,8 @@ const char *pxe_default_paths[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool is_pxe;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Like getenv, but prints an error if envvar isn't defined in the
|
* 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
|
* 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;
|
char *bootfile, *last_slash;
|
||||||
size_t path_len = 0;
|
size_t path_len = 0;
|
||||||
|
|
||||||
if (file_path[0] == '/')
|
/* Only syslinux allows absolute paths */
|
||||||
|
if (file_path[0] == '/' && !is_pxe)
|
||||||
goto ret;
|
goto ret;
|
||||||
|
|
||||||
bootfile = from_env("bootfile");
|
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)
|
if (argc < 2)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
|
is_pxe = true;
|
||||||
|
|
||||||
/* drop initial "pxe" arg */
|
/* drop initial "pxe" arg */
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
@@ -1504,6 +1509,8 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||||||
char *filename;
|
char *filename;
|
||||||
int prompt = 0;
|
int prompt = 0;
|
||||||
|
|
||||||
|
is_pxe = false;
|
||||||
|
|
||||||
if (strstr(argv[1], "-p")) {
|
if (strstr(argv[1], "-p")) {
|
||||||
prompt = 1;
|
prompt = 1;
|
||||||
argc--;
|
argc--;
|
||||||
|
Reference in New Issue
Block a user