diff mbox series

[09/13] net: wget: allow EFI boot

Message ID 1a6084e845a0612546a1e86d142208af945c8f77.1724846454.git.jerome.forissier@linaro.org
State Superseded
Headers show
Series Miscellaneous fixes | expand

Commit Message

Jerome Forissier Aug. 28, 2024, 12:10 p.m. UTC
wget followed by bootefi currently fails as follows:

 U-Boot> wget 200000 192.168.0.30:helloworld.efi
 Waiting for Ethernet connection... done.
 HTTP/1.0 200 OK
 Packets received 13, Transfer Successful
 Bytes transferred = 12720 (31b0 hex)
 U-Boot> bootefi 200000
 No UEFI binary known at 200000
 U-Boot>

Fix the problem by adding the missing efi_set_bootdev() call.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---
 net/wget.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ilias Apalodimas Aug. 29, 2024, 7:33 a.m. UTC | #1
On Wed, 28 Aug 2024 at 15:10, Jerome Forissier
<jerome.forissier@linaro.org> wrote:
>
> wget followed by bootefi currently fails as follows:
>
>  U-Boot> wget 200000 192.168.0.30:helloworld.efi
>  Waiting for Ethernet connection... done.
>  HTTP/1.0 200 OK
>  Packets received 13, Transfer Successful
>  Bytes transferred = 12720 (31b0 hex)
>  U-Boot> bootefi 200000
>  No UEFI binary known at 200000
>  U-Boot>
>
> Fix the problem by adding the missing efi_set_bootdev() call.
>
> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> ---
>  net/wget.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/net/wget.c b/net/wget.c
> index 0e4dc5159d..cf7681a4e7 100644
> --- a/net/wget.c
> +++ b/net/wget.c
> @@ -8,6 +8,7 @@
>  #include <command.h>
>  #include <display_options.h>
>  #include <env.h>
> +#include <efi_loader.h>
>  #include <image.h>
>  #include <lmb.h>
>  #include <mapmem.h>
> @@ -429,6 +430,9 @@ static void wget_handler(uchar *pkt, u16 dport,
>         case WGET_TRANSFERRED:
>                 printf("Packets received %d, Transfer Successful\n", packets);
>                 net_set_state(wget_loop_state);
> +               efi_set_bootdev("Net", "", image_url,
> +                               map_sysmem(image_load_addr, 0),
> +                               net_boot_file_size);
>                 break;
>         }
>  }
> --
> 2.40.1
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Simon Glass Aug. 29, 2024, 2:04 p.m. UTC | #2
On Thu, 29 Aug 2024 at 01:34, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> On Wed, 28 Aug 2024 at 15:10, Jerome Forissier
> <jerome.forissier@linaro.org> wrote:
> >
> > wget followed by bootefi currently fails as follows:
> >
> >  U-Boot> wget 200000 192.168.0.30:helloworld.efi
> >  Waiting for Ethernet connection... done.
> >  HTTP/1.0 200 OK
> >  Packets received 13, Transfer Successful
> >  Bytes transferred = 12720 (31b0 hex)
> >  U-Boot> bootefi 200000
> >  No UEFI binary known at 200000
> >  U-Boot>
> >
> > Fix the problem by adding the missing efi_set_bootdev() call.
> >
> > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> > ---
> >  net/wget.c | 4 ++++
> >  1 file changed, 4 insertions(+)

OMG the hack never dies. I hope I will someday create a series to tidy this up.

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



> >
> > diff --git a/net/wget.c b/net/wget.c
> > index 0e4dc5159d..cf7681a4e7 100644
> > --- a/net/wget.c
> > +++ b/net/wget.c
> > @@ -8,6 +8,7 @@
> >  #include <command.h>
> >  #include <display_options.h>
> >  #include <env.h>
> > +#include <efi_loader.h>
> >  #include <image.h>
> >  #include <lmb.h>
> >  #include <mapmem.h>
> > @@ -429,6 +430,9 @@ static void wget_handler(uchar *pkt, u16 dport,
> >         case WGET_TRANSFERRED:
> >                 printf("Packets received %d, Transfer Successful\n", packets);
> >                 net_set_state(wget_loop_state);
> > +               efi_set_bootdev("Net", "", image_url,
> > +                               map_sysmem(image_load_addr, 0),
> > +                               net_boot_file_size);
> >                 break;
> >         }
> >  }
> > --
> > 2.40.1
> >
>
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Simon Glass Aug. 30, 2024, 2:18 p.m. UTC | #3
Hi Jerome,

On Thu, 29 Aug 2024 at 08:04, Simon Glass <sjg@chromium.org> wrote:
>
> On Thu, 29 Aug 2024 at 01:34, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > On Wed, 28 Aug 2024 at 15:10, Jerome Forissier
> > <jerome.forissier@linaro.org> wrote:
> > >
> > > wget followed by bootefi currently fails as follows:
> > >
> > >  U-Boot> wget 200000 192.168.0.30:helloworld.efi
> > >  Waiting for Ethernet connection... done.
> > >  HTTP/1.0 200 OK
> > >  Packets received 13, Transfer Successful
> > >  Bytes transferred = 12720 (31b0 hex)
> > >  U-Boot> bootefi 200000
> > >  No UEFI binary known at 200000
> > >  U-Boot>
> > >
> > > Fix the problem by adding the missing efi_set_bootdev() call.
> > >
> > > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> > > ---
> > >  net/wget.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
>
> OMG the hack never dies. I hope I will someday create a series to tidy this up.

I'm sorry for that remark, not helpful to collaboration.

Regards,
Simon
Ilias Apalodimas Aug. 30, 2024, 2:27 p.m. UTC | #4
Hi Simon

On Fri, 30 Aug 2024 at 17:18, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Jerome,
>
> On Thu, 29 Aug 2024 at 08:04, Simon Glass <sjg@chromium.org> wrote:
> >
> > On Thu, 29 Aug 2024 at 01:34, Ilias Apalodimas
> > <ilias.apalodimas@linaro.org> wrote:
> > >
> > > On Wed, 28 Aug 2024 at 15:10, Jerome Forissier
> > > <jerome.forissier@linaro.org> wrote:
> > > >
> > > > wget followed by bootefi currently fails as follows:
> > > >
> > > >  U-Boot> wget 200000 192.168.0.30:helloworld.efi
> > > >  Waiting for Ethernet connection... done.
> > > >  HTTP/1.0 200 OK
> > > >  Packets received 13, Transfer Successful
> > > >  Bytes transferred = 12720 (31b0 hex)
> > > >  U-Boot> bootefi 200000
> > > >  No UEFI binary known at 200000
> > > >  U-Boot>
> > > >
> > > > Fix the problem by adding the missing efi_set_bootdev() call.
> > > >
> > > > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> > > > ---
> > > >  net/wget.c | 4 ++++
> > > >  1 file changed, 4 insertions(+)
> >
> > OMG the hack never dies. I hope I will someday create a series to tidy this up.
>
> I'm sorry for that remark, not helpful to collaboration.

If you've figured out what needs to be done to remove it, I can deal with it.
If not I'll put it on my backlog and have a look

Thanks
/Ilias
>
> Regards,
> Simon
Simon Glass Sept. 1, 2024, 8:09 p.m. UTC | #5
Hi Ilias,

On Fri, 30 Aug 2024 at 08:28, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Hi Simon
>
> On Fri, 30 Aug 2024 at 17:18, Simon Glass <sjg@chromium.org> wrote:
> >
> > Hi Jerome,
> >
> > On Thu, 29 Aug 2024 at 08:04, Simon Glass <sjg@chromium.org> wrote:
> > >
> > > On Thu, 29 Aug 2024 at 01:34, Ilias Apalodimas
> > > <ilias.apalodimas@linaro.org> wrote:
> > > >
> > > > On Wed, 28 Aug 2024 at 15:10, Jerome Forissier
> > > > <jerome.forissier@linaro.org> wrote:
> > > > >
> > > > > wget followed by bootefi currently fails as follows:
> > > > >
> > > > >  U-Boot> wget 200000 192.168.0.30:helloworld.efi
> > > > >  Waiting for Ethernet connection... done.
> > > > >  HTTP/1.0 200 OK
> > > > >  Packets received 13, Transfer Successful
> > > > >  Bytes transferred = 12720 (31b0 hex)
> > > > >  U-Boot> bootefi 200000
> > > > >  No UEFI binary known at 200000
> > > > >  U-Boot>
> > > > >
> > > > > Fix the problem by adding the missing efi_set_bootdev() call.
> > > > >
> > > > > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> > > > > ---
> > > > >  net/wget.c | 4 ++++
> > > > >  1 file changed, 4 insertions(+)
> > >
> > > OMG the hack never dies. I hope I will someday create a series to tidy this up.
> >
> > I'm sorry for that remark, not helpful to collaboration.
>
> If you've figured out what needs to be done to remove it, I can deal with it.
> If not I'll put it on my backlog and have a look

Mostly...my idea is to track loads within bootstd, adding a way for
bootmeths to record files they load, in struct bootflow. Then when
booting EFI, we just pass that info from distro_efi_boot() to
efi_binary_run().

Regards,
Simon
Tom Rini Sept. 2, 2024, 3:41 p.m. UTC | #6
On Sun, Sep 01, 2024 at 02:09:40PM -0600, Simon Glass wrote:
> Hi Ilias,
> 
> On Fri, 30 Aug 2024 at 08:28, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > Hi Simon
> >
> > On Fri, 30 Aug 2024 at 17:18, Simon Glass <sjg@chromium.org> wrote:
> > >
> > > Hi Jerome,
> > >
> > > On Thu, 29 Aug 2024 at 08:04, Simon Glass <sjg@chromium.org> wrote:
> > > >
> > > > On Thu, 29 Aug 2024 at 01:34, Ilias Apalodimas
> > > > <ilias.apalodimas@linaro.org> wrote:
> > > > >
> > > > > On Wed, 28 Aug 2024 at 15:10, Jerome Forissier
> > > > > <jerome.forissier@linaro.org> wrote:
> > > > > >
> > > > > > wget followed by bootefi currently fails as follows:
> > > > > >
> > > > > >  U-Boot> wget 200000 192.168.0.30:helloworld.efi
> > > > > >  Waiting for Ethernet connection... done.
> > > > > >  HTTP/1.0 200 OK
> > > > > >  Packets received 13, Transfer Successful
> > > > > >  Bytes transferred = 12720 (31b0 hex)
> > > > > >  U-Boot> bootefi 200000
> > > > > >  No UEFI binary known at 200000
> > > > > >  U-Boot>
> > > > > >
> > > > > > Fix the problem by adding the missing efi_set_bootdev() call.
> > > > > >
> > > > > > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> > > > > > ---
> > > > > >  net/wget.c | 4 ++++
> > > > > >  1 file changed, 4 insertions(+)
> > > >
> > > > OMG the hack never dies. I hope I will someday create a series to tidy this up.
> > >
> > > I'm sorry for that remark, not helpful to collaboration.
> >
> > If you've figured out what needs to be done to remove it, I can deal with it.
> > If not I'll put it on my backlog and have a look
> 
> Mostly...my idea is to track loads within bootstd, adding a way for
> bootmeths to record files they load, in struct bootflow. Then when
> booting EFI, we just pass that info from distro_efi_boot() to
> efi_binary_run().

I worry about conflating "loaded something" with "need to boot thing
thing". Maybe it's not a problem in the end, but there is not a 1:1
between "loaded something" and "will boot this thing".
Simon Glass Sept. 10, 2024, 6:41 p.m. UTC | #7
Hi Tom,

On Mon, 2 Sept 2024 at 09:41, Tom Rini <trini@konsulko.com> wrote:
>
> On Sun, Sep 01, 2024 at 02:09:40PM -0600, Simon Glass wrote:
> > Hi Ilias,
> >
> > On Fri, 30 Aug 2024 at 08:28, Ilias Apalodimas
> > <ilias.apalodimas@linaro.org> wrote:
> > >
> > > Hi Simon
> > >
> > > On Fri, 30 Aug 2024 at 17:18, Simon Glass <sjg@chromium.org> wrote:
> > > >
> > > > Hi Jerome,
> > > >
> > > > On Thu, 29 Aug 2024 at 08:04, Simon Glass <sjg@chromium.org> wrote:
> > > > >
> > > > > On Thu, 29 Aug 2024 at 01:34, Ilias Apalodimas
> > > > > <ilias.apalodimas@linaro.org> wrote:
> > > > > >
> > > > > > On Wed, 28 Aug 2024 at 15:10, Jerome Forissier
> > > > > > <jerome.forissier@linaro.org> wrote:
> > > > > > >
> > > > > > > wget followed by bootefi currently fails as follows:
> > > > > > >
> > > > > > >  U-Boot> wget 200000 192.168.0.30:helloworld.efi
> > > > > > >  Waiting for Ethernet connection... done.
> > > > > > >  HTTP/1.0 200 OK
> > > > > > >  Packets received 13, Transfer Successful
> > > > > > >  Bytes transferred = 12720 (31b0 hex)
> > > > > > >  U-Boot> bootefi 200000
> > > > > > >  No UEFI binary known at 200000
> > > > > > >  U-Boot>
> > > > > > >
> > > > > > > Fix the problem by adding the missing efi_set_bootdev() call.
> > > > > > >
> > > > > > > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> > > > > > > ---
> > > > > > >  net/wget.c | 4 ++++
> > > > > > >  1 file changed, 4 insertions(+)
> > > > >
> > > > > OMG the hack never dies. I hope I will someday create a series to tidy this up.
> > > >
> > > > I'm sorry for that remark, not helpful to collaboration.
> > >
> > > If you've figured out what needs to be done to remove it, I can deal with it.
> > > If not I'll put it on my backlog and have a look
> >
> > Mostly...my idea is to track loads within bootstd, adding a way for
> > bootmeths to record files they load, in struct bootflow. Then when
> > booting EFI, we just pass that info from distro_efi_boot() to
> > efi_binary_run().
>
> I worry about conflating "loaded something" with "need to boot thing
> thing". Maybe it's not a problem in the end, but there is not a 1:1
> between "loaded something" and "will boot this thing".

Yes, exactly. Bootstd tries to search for things and build a table of
what is there. Only when something is booted does it go ahead and set
it up to boot. In fact, some bootmeths delay kernel loading until
needed.

Regards,
Simon
diff mbox series

Patch

diff --git a/net/wget.c b/net/wget.c
index 0e4dc5159d..cf7681a4e7 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -8,6 +8,7 @@ 
 #include <command.h>
 #include <display_options.h>
 #include <env.h>
+#include <efi_loader.h>
 #include <image.h>
 #include <lmb.h>
 #include <mapmem.h>
@@ -429,6 +430,9 @@  static void wget_handler(uchar *pkt, u16 dport,
 	case WGET_TRANSFERRED:
 		printf("Packets received %d, Transfer Successful\n", packets);
 		net_set_state(wget_loop_state);
+		efi_set_bootdev("Net", "", image_url,
+				map_sysmem(image_load_addr, 0),
+				net_boot_file_size);
 		break;
 	}
 }