diff mbox series

[v8,03/23] net: wget: allow EFI boot

Message ID b02ec5e623fd4c80201c92630780ed7e4f557191.1723050310.git.jerome.forissier@linaro.org
State Superseded
Headers show
Series Introduce the lwIP network stack | expand

Commit Message

Jerome Forissier Aug. 7, 2024, 5:11 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. 9, 2024, 10:53 a.m. UTC | #1
On Wed, 7 Aug 2024 at 20:12, 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 0e4dc5159d0..cf7681a4e79 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);

Don't you need an unmap_sysmem() once this completes?

Thanks
/Ilias
>                 break;
>         }
>  }
> --
> 2.40.1
>
Jerome Forissier Aug. 9, 2024, 12:38 p.m. UTC | #2
On 8/9/24 12:53, Ilias Apalodimas wrote:
> On Wed, 7 Aug 2024 at 20:12, 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 0e4dc5159d0..cf7681a4e79 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);
> 
> Don't you need an unmap_sysmem() once this completes?

I wondered the same thing but where should the unmap call happen?
This pattern exists in boot/bootmeth_efi.c, cmd/load.c, fs/fs.c and net/tftp.c.
In this series I have blindly copied it into net/wget.c and net/lwip/wget.c and
net/lwip/tftp.c as well. It seems it does somthing in the sandbox only so do we
really care?

Thanks,
diff mbox series

Patch

diff --git a/net/wget.c b/net/wget.c
index 0e4dc5159d0..cf7681a4e79 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;
 	}
 }