diff options
author | Björn Töpel <bjorn@rivosinc.com> | 2023-01-09 12:42:51 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-01-18 17:12:59 -0800 |
commit | 9a3f21fe5cb9f5654ccad7ba712d868f7de66e39 (patch) | |
tree | c387cfc47922be88008781ac2467c253b86105d2 /tools | |
parent | d526643f155c431e8dfef643195f2d636d4e4bb5 (diff) | |
download | lwn-9a3f21fe5cb9f5654ccad7ba712d868f7de66e39.tar.gz lwn-9a3f21fe5cb9f5654ccad7ba712d868f7de66e39.zip |
selftests: vm: enable cross-compilation
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.
Link: https://lkml.kernel.org/r/20230109114251.3349638-1-bjorn@kernel.org
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/mm/Makefile | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 6a4b639b2b2b..0a44d77f8437 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -5,7 +5,11 @@ LOCAL_HDRS += $(selfdir)/mm/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, |