Skip to content

Commit

Permalink
selftests/nolibc: add a "kernel" target to build the kernel with the …
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
wtarreau authored and paulmckrcu committed Aug 31, 2022
1 parent 1da02f5 commit d248cab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tools/testing/selftests/nolibc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ include $(srctree)/scripts/subarch.include
ARCH = $(SUBARCH)
endif

# kernel image names by architecture
IMAGE_i386 = arch/x86/boot/bzImage
IMAGE_x86 = arch/x86/boot/bzImage
IMAGE_arm64 = arch/arm64/boot/Image
IMAGE_arm = arch/arm/boot/zImage
IMAGE_mips = vmlinuz
IMAGE_riscv = arch/riscv/boot/Image
IMAGE = $(IMAGE_$(ARCH))
IMAGE_NAME = $(notdir $(IMAGE))

# OUTPUT is only set when run from the main makefile, otherwise
# it defaults to this nolibc directory.
OUTPUT ?= $(CURDIR)/
Expand All @@ -36,6 +46,9 @@ initramfs: nolibc-test
$(call QUIET_INSTALL, initramfs/init)
$(Q)cp nolibc-test initramfs/init

kernel: initramfs
$(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs

clean:
$(call QUIET_CLEAN, nolibc-test)
$(Q)rm -f nolibc-test
Expand Down

0 comments on commit d248cab

Please sign in to comment.