[PATCH 1/1] sandbox: allow cross-compiling sandbox

Simon Glass sjg at chromium.org
Tue Feb 9 05:29:43 CET 2021


Hi Heinrich,

On Mon, 8 Feb 2021 at 15:06, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> UEFI test files like helloworld.efi require an architecture specific
> PE-COFF header.

architecture-specific

>
> For non-sandbox the PE-COFF header is chosen by the target architecture.
> For the sandbox we use the host architecture. This is not helpful for cross
> compiling. Allow specifying the target architecture of the sandbox via
> environment variable MK_ARCH, e.g.

What exactly is the target arch? Is the the one that sandbox is
running on, or something else?

>
>     make sandbox_defconfig NO_SDL=1
>     CROSS_COMPILE=aarch64-linux-gnu- NO_SDL=1 MK_ARCH=aarch64 make
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  Makefile             |  2 +-
>  doc/arch/sandbox.rst | 14 ++++++++++++++
>  2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 23dd11f723..286e5148ae 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -19,7 +19,7 @@ MAKEFLAGS += -rR --include-dir=$(CURDIR)
>
>  # Determine host architecture
>  include include/host_arch.h
> -MK_ARCH="${shell uname -m}"
> +MK_ARCH?="${shell uname -m}"
>  unexport HOST_ARCH
>  ifeq ("x86_64", $(MK_ARCH))
>    export HOST_ARCH=$(HOST_ARCH_X86_64)
> diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst
> index 60ee1e0741..0dd9edc8cb 100644
> --- a/doc/arch/sandbox.rst
> +++ b/doc/arch/sandbox.rst
> @@ -33,6 +33,20 @@ integers can only be built on 64-bit hosts.
>
>  Note that standalone/API support is not available at present.
>
> +Cross compiling
> +---------------
> +
> +When cross compiling the U-Boot sandbox with CONFIG_EFI_LOADER=y the target
> +architecture must be specified using the MK_ARCH environment variable using one
> +of the values aarch64, armv7l, i386, riscv32, riscv64, x86_64, e.g.

OK, but what is the target architecture? I'm just not sure from your
comments what this actually means.

Does MK mean make?

> +
> +.. code-block:: bash
> +
> +    NO_SDL=1 make sandbox_defconfig
> +    CROSS_COMPILE=aarch64-linux-gnu- MK_ARCH=aarch64 NO_SDL=1 make
> +
> +NO_SDL=1 was chosen in the example to remove the dependency on the SDL library.
> +The graphical console will not be available.
>
>  Prerequisites
>  -------------
> --
> 2.30.0
>

Regards,
Simon


More information about the U-Boot mailing list