Skip to contentSkip to conversation

kselftest/riscv: Improve building under native riscv64 environment

PATCH New Hui Wang 1 participant 1 message Jul 14

Subsystems (2)
lore
Share & tools
lore

Hui Wang

author
#0 lore raw

PATCH 1/1 kselftest/riscv: Improve building under native riscv64 environment

When we build the kselftest natively, we usually don't pass an ARCH= parameter. In this case if I build kselftest/riscv under a riscv64 environment, the testcase will not be built at all because 'uname -m' returns riscv64 instead of riscv.

make -C tools/testing/selftests TARGETS=riscv
make: Entering directory 'linux/tools/testing/selftests' make[1]: Entering directory 'linux/tools/testing/selftests/riscv' make[1]: Leaving directory 'linux/tools/testing/selftests/riscv'
make: Leaving directory 'linux/tools/testing/selftests'

This issue can be fixed by getting ARCH from scripts/subarch.include, whose SUBARCH normalizes 'riscv64' to 'riscv'. This also aligns with how other selftests (e.g. arm64, x86) already resolve ARCH.

---
 tools/testing/selftests/riscv/Makefile | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/testing/selftests/riscv/Makefile +5 -4
index 5671b4405a12..43eddb919705 100644
@@ -1,8 +1,12 @@
 # SPDX-License-Identifier: GPL-2.0
 # Originally tools/testing/arm64/Makefile
 
+# A proper top_srcdir is needed by KSFT(lib.mk)
+top_srcdir = $(realpath ../../../../)
+
 # When ARCH not overridden for crosscompiling, lookup machine
-ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+include $(top_srcdir)/scripts/subarch.include
+ARCH ?= $(SUBARCH)
 
 ifneq (,$(filter $(ARCH),riscv))
 RISCV_SUBTARGETS ?= abi hwprobe mm sigreturn vector cfi
@@ -12,9 +16,6 @@ endif
 
 CFLAGS := -Wall -O2 -g
 
-# A proper top_srcdir is needed by KSFT(lib.mk)
-top_srcdir = $(realpath ../../../../)
-
 # Additional include paths needed by kselftest.h and local headers
 CFLAGS += -I$(top_srcdir)/tools/testing/selftests/
 
Signature · 7 lines
2.43.0


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv