diff mbox series

[1/1] efi_loader: provide valid PXE architecture on sandbox

Message ID 20241109103141.33983-1-heinrich.schuchardt@canonical.com
State Needs Review / ACK
Delegated to: Heinrich Schuchardt
Headers show
Series [1/1] efi_loader: provide valid PXE architecture on sandbox | expand

Commit Message

Heinrich Schuchardt Nov. 9, 2024, 10:31 a.m. UTC
Before this patch the sandbox uses 0xffffffea as PXE architecture.

    => efidebug defaults
    Default boot path: EFI\BOOT\BOOTSBOX.EFI
    PXE arch: 0xffffffea

With this patch it uses the PXE architecture that matches the host.
This allows us to use bootmeth EFI on the sandbox to load an EFI binary.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/efi_loader/efi_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ilias Apalodimas Nov. 9, 2024, 3:06 p.m. UTC | #1
On Sat, 9 Nov 2024 at 12:31, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Before this patch the sandbox uses 0xffffffea as PXE architecture.
>
>     => efidebug defaults
>     Default boot path: EFI\BOOT\BOOTSBOX.EFI
>     PXE arch: 0xffffffea
>
> With this patch it uses the PXE architecture that matches the host.
> This allows us to use bootmeth EFI on the sandbox to load an EFI binary.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/efi_loader/efi_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
> index bf96f61d3d0..14049378930 100644
> --- a/lib/efi_loader/efi_helper.c
> +++ b/lib/efi_loader/efi_helper.c
> @@ -75,7 +75,7 @@ const char *efi_get_basename(void)
>
>  int efi_get_pxe_arch(void)
>  {
> -       if (efi_use_host_arch())
> +       if (IS_ENABLED(CONFIG_SANDBOX))
>                 return HOST_PXE_ARCH;
>
>         /* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */
> --
> 2.45.2
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Simon Glass Nov. 9, 2024, 5:33 p.m. UTC | #2
Hi Heinrich,

On Sat, 9 Nov 2024 at 03:31, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Before this patch the sandbox uses 0xffffffea as PXE architecture.
>
>     => efidebug defaults
>     Default boot path: EFI\BOOT\BOOTSBOX.EFI
>     PXE arch: 0xffffffea
>
> With this patch it uses the PXE architecture that matches the host.
> This allows us to use bootmeth EFI on the sandbox to load an EFI binary.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/efi_loader/efi_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

The way things are, this isn't a valid thing to do. It is returning an
error to indicate that. The error should be checked. If you use -N
then it will do what you want, though.

But what architectures does this work for, with your setup? I haven't
been able to get x86_64 to work. I could perhaps try arm64?

Should we document this use of sandbox for your use case, once it is working?

>
> diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
> index bf96f61d3d0..14049378930 100644
> --- a/lib/efi_loader/efi_helper.c
> +++ b/lib/efi_loader/efi_helper.c
> @@ -75,7 +75,7 @@ const char *efi_get_basename(void)
>
>  int efi_get_pxe_arch(void)
>  {
> -       if (efi_use_host_arch())
> +       if (IS_ENABLED(CONFIG_SANDBOX))
>                 return HOST_PXE_ARCH;
>
>         /* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */
> --
> 2.45.2
>

Regards,
Simon
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index bf96f61d3d0..14049378930 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -75,7 +75,7 @@  const char *efi_get_basename(void)
 
 int efi_get_pxe_arch(void)
 {
-	if (efi_use_host_arch())
+	if (IS_ENABLED(CONFIG_SANDBOX))
 		return HOST_PXE_ARCH;
 
 	/* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */