aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-02-10 18:54:25 +0100
committerSimon Glass <sjg@chromium.org>2021-03-22 19:23:26 +1300
commitf7691a6d736bec7915c227ac14076f9993a27367 (patch)
treea6217929ca189fe678428d5c98f9aefcf3fa152b /Makefile
parent0fb560d9a71e9bd3c36944dda9b6122df63f49a3 (diff)
downloadu-boot-f7691a6d736bec7915c227ac14076f9993a27367.zip
u-boot-f7691a6d736bec7915c227ac14076f9993a27367.tar.gz
u-boot-f7691a6d736bec7915c227ac14076f9993a27367.tar.bz2
sandbox: allow cross-compiling sandbox
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> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index b72d8d2..a790be6 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
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)