Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests: vm: Enable cross-compilation
@ 2023-01-09 11:42 Björn Töpel
  0 siblings, 0 replies; only message in thread
From: Björn Töpel @ 2023-01-09 11:42 UTC (permalink / raw)
  To: Andrew Morton, linux-mm
  Cc: Björn Töpel, Shuah Khan, linux-kselftest, linux-kernel

From: Björn Töpel <bjorn@rivosinc.com>

Selftests vm builds break when doing cross-compilation. The Makefile
MACHINE variable incorrectly picks upp the host machine architecture.

If the CROSS_COMPILE variable is set, dig out the target host
architecture from CROSS_COMPILE, instead of calling uname.

Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
 tools/testing/selftests/vm/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 89c14e41bd43..1cded308dddf 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -5,7 +5,11 @@ LOCAL_HDRS += $(selfdir)/vm/local_config.h $(top_srcdir)/mm/gup_test.h
 
 include local_config.mk
 
+ifeq ($(CROSS_COMPILE),)
 uname_M := $(shell uname -m 2>/dev/null || echo not)
+else
+uname_M := $(shell echo $(CROSS_COMPILE) | grep -o '^[a-z0-9]\+')
+endif
 MACHINE ?= $(shell echo $(uname_M) | sed -e 's/aarch64.*/arm64/' -e 's/ppc64.*/ppc64/')
 
 # Without this, failed build products remain, with up-to-date timestamps,

base-commit: 1fe4fd6f5cad346e598593af36caeadc4f5d4fa9
-- 
2.37.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-09 11:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-09 11:42 [PATCH] selftests: vm: Enable cross-compilation Björn Töpel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox