[syslinux] Syslinux-5.10-pre1 looks for ldlinux.c32 in TFTP instead of HTTP
Tobias Göbel
kubax1983 at gmail.com
Mon Mar 11 10:35:21 PDT 2013
Am 11.03.2013 18:20, schrieb Matt Fleming:
> On Fri, 2013-03-08 at 16:12 +0100, Tobias Göbel wrote:
>> Ok, waiting for it and ready for testing the patch when it's ready.
>>
>> I checked what you suggested, and 5.02-pre3 without the reverted commit
>> does not work (as suspected) and with the reverted patch it works.
>> So i think the bisect was right.
> Could you try this patch?
>
> ---
>
> From 00a6f13139ce5d967b1f9614068a549520d4cca3 Mon Sep 17 00:00:00 2001
> From: Matt Fleming <matt.fleming at intel.com>
> Date: Mon, 11 Mar 2013 13:57:56 +0000
> Subject: [PATCH] Partially revert "pxe: Pass absolute path to pxe_chdir()"
>
> This partially reverts commit b208ba467f678ed8e73f8d11fc0609634120cb83.
>
> It isn't correct to always pass URL_OLD_TFTP to chdir(), since the
> path prefix option may contain a full url, e.g. http://
>
> Specialise the one case where we need to build a ::-style TFTP path
> inside of get_prefix() to maintain backwards compatability, since from
> Syslinux 5.00 onwards we may move out of the root directory ("::")
> while searching for ldlinux.c32.
>
> Signed-off-by: Matt Fleming <matt.fleming at intel.com>
> ---
> core/fs/pxe/pxe.c | 43 +++++++++++++++++++++++++++----------------
> 1 file changed, 27 insertions(+), 16 deletions(-)
>
> diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
> index 9f18f28..3e90336 100644
> --- a/core/fs/pxe/pxe.c
> +++ b/core/fs/pxe/pxe.c
> @@ -384,19 +384,6 @@ static void __pxe_searchdir(const char *filename, int flags, struct file *file)
> }
>
>
> -static int __pxe_chdir(struct fs_info *fs, const char *src,
> - enum url_type url_type)
> -{
> - if (url_type == URL_SUFFIX)
> - strlcat(fs->cwd_name, src, sizeof fs->cwd_name);
> - else if (url_type == URL_OLD_TFTP)
> - snprintf(fs->cwd_name, sizeof fs->cwd_name, "::%s", src);
> - else
> - strlcpy(fs->cwd_name, src, sizeof fs->cwd_name);
> - return 0;
> -
> -}
> -
> /*
> * Store standard filename prefix
> */
> @@ -431,7 +418,25 @@ static void get_prefix(void)
> }
>
> printf("TFTP prefix: %s\n", path_prefix);
> - __pxe_chdir(this_fs, path_prefix, URL_OLD_TFTP);
> +
> + if (url_type(path_prefix) == URL_SUFFIX) {
> + /*
> + * Construct a ::-style TFTP path.
> + *
> + * We may have moved out of the root directory at the time
> + * this function is invoked, but to maintain compatibility
> + * with versions of Syslinux < 5.00, path_prefix must be
> + * relative to "::".
> + */
> + p = strdup(path_prefix);
> + if (!p)
> + return;
> +
> + snprintf(path_prefix, sizeof path_prefix, "::%s", p);
> + free(p);
> + }
> +
> + chdir(path_prefix);
> }
>
> /*
> @@ -450,7 +455,13 @@ static size_t pxe_realpath(struct fs_info *fs, char *dst, const char *src,
> static int pxe_chdir(struct fs_info *fs, const char *src)
> {
> /* The cwd for PXE is just a text prefix */
> - __pxe_chdir(fs, src, url_type(src));
> + enum url_type path_type = url_type(src);
> +
> + if (url_type == URL_SUFFIX)
> + strlcat(fs->cwd_name, src, sizeof fs->cwd_name);
> + else
> + strlcpy(fs->cwd_name, src, sizeof fs->cwd_name);
> + return 0;
>
> dprintf("cwd = \"%s\"\n", fs->cwd_name);
> return 0;
> @@ -471,7 +482,7 @@ static int pxe_open_config(struct com32_filedata *filedata)
> char *last;
> int tries = 8;
>
> - get_prefix();
> + chdir(path_prefix);
> if (DHCPMagic & 0x02) {
> /* We got a DHCP option, try it first */
> if (open_file(ConfigName, O_RDONLY, filedata) >= 0)
Thanks for the Patch.
I'll try it tomorrow, and report back.
More information about the Syslinux
mailing list