[PATCH v5 3/5] selftests/nolibc: allow customize kernel specific ARCH variable
From: Zhangjin Wu
Date: Mon Jun 19 2023 - 08:27:55 EST
Some architectures (e.g. riscv, mips) share the same ARCH variable (the
one supported by top-level kernel Makefile) between 32bit and 64bit
architecture variants and even more, some of them have little endian and
big endian variants.
Let's add KARCH to allow architectures customize their own kernel
specific ARCH variable, so, ARCH=$(KARCH) is required by all of the
top-level kernel Makefile targets.
Suggested-by: Willy Tarreau <w@xxxxxx>
Link: https://lore.kernel.org/lkml/ZIAywHvr6UB1J4of@xxxxxx/
Signed-off-by: Zhangjin Wu <falcon@xxxxxxxxxxx>
---
tools/testing/selftests/nolibc/Makefile | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 000621f21adc..ebecb8cfd947 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -14,6 +14,9 @@ include $(srctree)/scripts/subarch.include
ARCH = $(SUBARCH)
endif
+# kernel supported ARCH names by architecture
+KARCH = $(or $(KARCH_$(ARCH)),$(ARCH))
+
# kernel image names by architecture
IMAGE_i386 = arch/x86/boot/bzImage
IMAGE_x86_64 = arch/x86/boot/bzImage
@@ -143,10 +146,10 @@ initramfs: nolibc-test
$(Q)cp nolibc-test initramfs/init
defconfig:
- $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare
+ $(Q)$(MAKE) -C $(srctree) ARCH=$(KARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare
kernel: initramfs
- $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs
+ $(Q)$(MAKE) -C $(srctree) ARCH=$(KARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs
# run the tests after building the kernel
run: kernel
--
2.25.1