diff mbox series

bootstd: Fix relative path use in extlinux bootmeth

Message ID 20230609145858.3961926-1-jonas@kwiboo.se
State Accepted
Commit a7e4dffcd8c582bf4344548270d2fc7ac6c0f9ec
Delegated to: Tom Rini
Headers show
Series bootstd: Fix relative path use in extlinux bootmeth | expand

Commit Message

Jonas Karlman June 9, 2023, 2:59 p.m. UTC
Using relative path in a /boot/extlinux/extlinux.conf file fails to load
linux kernel.

Using a /boot/extlinux/extlinux.conf file:

  LABEL test
    LINUX ../linux/Image

Result in following error:

  Retrieving file: ../linux/Image
  Skipping test for failure retrieving kernel
  Boot failed (err=-14)

However, using sysboot cmd successfully load kernel using same file:

  sysboot mmc 1:1 any ${scriptaddr} /boot/extlinux/extlinux.conf

  Retrieving file: /boot/extlinux/../linux/Image

Fix relative path using bootmeth extlinux by supplying bootfile path
instead of subdir path in the call to pxe_setup_ctx, same as done in the
sysboot command.

Fixes: 31aefaf89a5b ("bootstd: Add an implementation of distro boot")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 boot/bootmeth_extlinux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass June 12, 2023, 9:17 p.m. UTC | #1
Hi Jonas,

On Fri, 9 Jun 2023 at 15:59, Jonas Karlman <jonas@kwiboo.se> wrote:
>
> Using relative path in a /boot/extlinux/extlinux.conf file fails to load
> linux kernel.
>
> Using a /boot/extlinux/extlinux.conf file:
>
>   LABEL test
>     LINUX ../linux/Image
>
> Result in following error:
>
>   Retrieving file: ../linux/Image
>   Skipping test for failure retrieving kernel
>   Boot failed (err=-14)
>
> However, using sysboot cmd successfully load kernel using same file:
>
>   sysboot mmc 1:1 any ${scriptaddr} /boot/extlinux/extlinux.conf
>
>   Retrieving file: /boot/extlinux/../linux/Image
>
> Fix relative path using bootmeth extlinux by supplying bootfile path
> instead of subdir path in the call to pxe_setup_ctx, same as done in the
> sysboot command.
>
> Fixes: 31aefaf89a5b ("bootstd: Add an implementation of distro boot")
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
> ---
>  boot/bootmeth_extlinux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Thank you for the fix.

I'd like to find a way to test some of this internal code, but so far
have not had any easy ideas.

>
> diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c
> index 24be0760229c..6b2b84003836 100644
> --- a/boot/bootmeth_extlinux.c
> +++ b/boot/bootmeth_extlinux.c
> @@ -150,7 +150,7 @@ static int extlinux_boot(struct udevice *dev, struct bootflow *bflow)
>         info.dev = dev;
>         info.bflow = bflow;
>         ret = pxe_setup_ctx(&ctx, &cmdtp, extlinux_getfile, &info, true,
> -                           bflow->subdir, false);
> +                           bflow->fname, false);
>         if (ret)
>                 return log_msg_ret("ctx", -EINVAL);
>
> --
> 2.40.1
>

Regards,
Simon
Tom Rini June 14, 2023, 7:51 p.m. UTC | #2
On Fri, Jun 09, 2023 at 02:59:01PM +0000, Jonas Karlman wrote:

> Using relative path in a /boot/extlinux/extlinux.conf file fails to load
> linux kernel.
> 
> Using a /boot/extlinux/extlinux.conf file:
> 
>   LABEL test
>     LINUX ../linux/Image
> 
> Result in following error:
> 
>   Retrieving file: ../linux/Image
>   Skipping test for failure retrieving kernel
>   Boot failed (err=-14)
> 
> However, using sysboot cmd successfully load kernel using same file:
> 
>   sysboot mmc 1:1 any ${scriptaddr} /boot/extlinux/extlinux.conf
> 
>   Retrieving file: /boot/extlinux/../linux/Image
> 
> Fix relative path using bootmeth extlinux by supplying bootfile path
> instead of subdir path in the call to pxe_setup_ctx, same as done in the
> sysboot command.
> 
> Fixes: 31aefaf89a5b ("bootstd: Add an implementation of distro boot")
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c
index 24be0760229c..6b2b84003836 100644
--- a/boot/bootmeth_extlinux.c
+++ b/boot/bootmeth_extlinux.c
@@ -150,7 +150,7 @@  static int extlinux_boot(struct udevice *dev, struct bootflow *bflow)
 	info.dev = dev;
 	info.bflow = bflow;
 	ret = pxe_setup_ctx(&ctx, &cmdtp, extlinux_getfile, &info, true,
-			    bflow->subdir, false);
+			    bflow->fname, false);
 	if (ret)
 		return log_msg_ret("ctx", -EINVAL);