Skip to content

Commit d248cab

Browse files
wtarreaupaulmckrcu
authored andcommitted
selftests/nolibc: add a "kernel" target to build the kernel with the initramfs
The "kernel" target rebuilds the kernel with the current config for the selected arch, with an initramfs containing the nolibc-test utility. Since image names depend on the architecture, the currently supported ones are referenced and resolved based on the architecture. Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 1da02f5 commit d248cab

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tools/testing/selftests/nolibc/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ include $(srctree)/scripts/subarch.include
1212
ARCH = $(SUBARCH)
1313
endif
1414

15+
# kernel image names by architecture
16+
IMAGE_i386 = arch/x86/boot/bzImage
17+
IMAGE_x86 = arch/x86/boot/bzImage
18+
IMAGE_arm64 = arch/arm64/boot/Image
19+
IMAGE_arm = arch/arm/boot/zImage
20+
IMAGE_mips = vmlinuz
21+
IMAGE_riscv = arch/riscv/boot/Image
22+
IMAGE = $(IMAGE_$(ARCH))
23+
IMAGE_NAME = $(notdir $(IMAGE))
24+
1525
# OUTPUT is only set when run from the main makefile, otherwise
1626
# it defaults to this nolibc directory.
1727
OUTPUT ?= $(CURDIR)/
@@ -36,6 +46,9 @@ initramfs: nolibc-test
3646
$(call QUIET_INSTALL, initramfs/init)
3747
$(Q)cp nolibc-test initramfs/init
3848

49+
kernel: initramfs
50+
$(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs
51+
3952
clean:
4053
$(call QUIET_CLEAN, nolibc-test)
4154
$(Q)rm -f nolibc-test

0 commit comments

Comments
 (0)