All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@seco.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/1] sandbox: allow cross-compiling sandbox
Date: Wed, 10 Feb 2021 13:20:23 -0500	[thread overview]
Message-ID: <713aa32d-38be-e11f-f366-90e8d685827d@seco.com> (raw)
In-Reply-To: <20210210175425.264251-1-xypron.glpk@gmx.de>



On 2/10/21 12:54 PM, Heinrich Schuchardt wrote:
 > UEFI test files like helloworld.efi require an architecture specific
 > PE-COFF header.
 >
 > Currently this does not work for cross compiling. If $CROSS_COMPILE 
is set,
 > use the first part of the architecture triplet from the variable to
 > choose the PE-COFF header.
 >
 > Now we can cross-compile the sandbox, e.g.
 >
 >      make sandbox_defconfig NO_SDL=1
 >      CROSS_COMPILE=/opt/bin/aarch64-linux-gnu- NO_SDL=1 
MK_ARCH=aarch64 make
 >
 > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
 > ---
 > v2:
 > 	use $CROSS_COMPILE instead of an extra environment variable
 > ---
 >   Makefile | 10 +++++++---
 >   1 file changed, 7 insertions(+), 3 deletions(-)
 >
 > diff --git a/Makefile b/Makefile
 > index ebbedb1fb1..6c256a23b6 100644
 > --- a/Makefile
 > +++ b/Makefile
 > @@ -17,9 +17,13 @@ NAME =
 >   # o Look for make include files relative to root of kernel src
 >   MAKEFLAGS += -rR --include-dir=$(CURDIR)
 >
 > -# Determine host architecture
 > +# Determine target architecture for the sandbox
 >   include include/host_arch.h
 > -MK_ARCH="${shell uname -m}"
 > +ifeq ("", "$(CROSS_COMPILE)")
 > +  MK_ARCH="${shell uname -m}"
 > +else
 > +  MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 
's/^\s*\([^\/]*\/\)*\([^-]*\)-\S*/\2/p'}"
 > +endif

Won't this break cross-compiling? E.g. if on my x86_64 machine I run
"CROSS_COMPILE=arm-linux-gnueabihf- make" my HOST_ARCH will be
HOST_ARCH_ARM, even though it should be HOST_ARCH_X86_64.

I think you need a separate variable for a "canadian cross." gcc uses
"build," "host," and "target," but as-is U-Boot's HOST_ARCH is gcc's
"build" arch.

--Sean

 >   unexport HOST_ARCH
 >   ifeq ("x86_64", $(MK_ARCH))
 >     export HOST_ARCH=$(HOST_ARCH_X86_64)
 > @@ -27,7 +31,7 @@ else ifneq (,$(findstring $(MK_ARCH), "i386" "i486" 
"i586" "i686"))
 >     export HOST_ARCH=$(HOST_ARCH_X86)
 >   else ifneq (,$(findstring $(MK_ARCH), "aarch64" "armv8l"))
 >     export HOST_ARCH=$(HOST_ARCH_AARCH64)
 > -else ifeq ("armv7l", $(MK_ARCH))
 > +else ifneq (,$(findstring $(MK_ARCH), "arm" "armv7" "armv7l"))
 >     export HOST_ARCH=$(HOST_ARCH_ARM)
 >   else ifeq ("riscv32", $(MK_ARCH))
 >     export HOST_ARCH=$(HOST_ARCH_RISCV32)
 > --
 > 2.30.0
 >

  reply	other threads:[~2021-02-10 18:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 17:54 [PATCH v2 1/1] sandbox: allow cross-compiling sandbox Heinrich Schuchardt
2021-02-10 18:20 ` Sean Anderson [this message]
2021-02-10 18:30   ` Sean Anderson
2021-02-10 21:34 ` Simon Glass
2021-03-15  7:25   ` Simon Glass
2021-03-16  5:58   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=713aa32d-38be-e11f-f366-90e8d685827d@seco.com \
    --to=sean.anderson@seco.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.