Merge branch 'master' of git://git.denx.de/u-boot-arm
[kernel/u-boot.git] / common / cmd_pxe.c
index 79d3a06..c27ec35 100644 (file)
@@ -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
@@ -57,7 +59,7 @@ static int format_mac_pxe(char *outbuf, size_t outbuf_len)
        uchar ethaddr[6];
 
        if (outbuf_len < 21) {
-               printf("outbuf is too small (%d < 21)\n", outbuf_len);
+               printf("outbuf is too small (%zd < 21)\n", outbuf_len);
 
                return -EINVAL;
        }
@@ -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");
@@ -100,7 +103,7 @@ static int get_bootfile_path(const char *file_path, char *bootfile_path,
        path_len = (last_slash - bootfile) + 1;
 
        if (bootfile_path_size < path_len) {
-               printf("bootfile_path too small. (%d < %d)\n",
+               printf("bootfile_path too small. (%zd < %zd)\n",
                                bootfile_path_size, path_len);
 
                return -1;
@@ -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--;