1 # SPDX-License-Identifier: GPL-2.0 1 # SPDX-License-Identifier: GPL-2.0 2 # Makefile for nolibc tests 2 # Makefile for nolibc tests 3 # we're in ".../tools/testing/selftests/nolibc 3 # we're in ".../tools/testing/selftests/nolibc" 4 ifeq ($(srctree),) 4 ifeq ($(srctree),) 5 srctree := $(patsubst %/tools/testing/selftest 5 srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR))) 6 endif 6 endif 7 7 8 include $(srctree)/tools/scripts/utilities.mak 8 include $(srctree)/tools/scripts/utilities.mak 9 # We need this for the "__cc-option" macro. 9 # We need this for the "__cc-option" macro. 10 include $(srctree)/scripts/Makefile.compiler 10 include $(srctree)/scripts/Makefile.compiler 11 11 12 ifneq ($(O),) 12 ifneq ($(O),) 13 ifneq ($(call is-absolute,$(O)),y) 13 ifneq ($(call is-absolute,$(O)),y) 14 $(error Only absolute O= parameters are suppor 14 $(error Only absolute O= parameters are supported) 15 endif 15 endif 16 objtree := $(O) 16 objtree := $(O) 17 else 17 else 18 objtree ?= $(srctree) 18 objtree ?= $(srctree) 19 endif 19 endif 20 20 21 ifeq ($(ARCH),) 21 ifeq ($(ARCH),) 22 include $(srctree)/scripts/subarch.include 22 include $(srctree)/scripts/subarch.include 23 ARCH = $(SUBARCH) 23 ARCH = $(SUBARCH) 24 endif 24 endif 25 25 26 cc-option = $(call __cc-option, $(CC),$(CLANG_ 26 cc-option = $(call __cc-option, $(CC),$(CLANG_CROSS_FLAGS),$(1),$(2)) 27 27 28 # XARCH extends the kernel's ARCH with a few v 28 # XARCH extends the kernel's ARCH with a few variants of the same 29 # architecture that only differ by the configu 29 # architecture that only differ by the configuration, the toolchain 30 # and the Qemu program used. It is copied as-i 30 # and the Qemu program used. It is copied as-is into ARCH except for 31 # a few specific values which are mapped like 31 # a few specific values which are mapped like this: 32 # 32 # 33 # XARCH | ARCH | config 33 # XARCH | ARCH | config 34 # -------------|-----------|----------------- 34 # -------------|-----------|------------------------- 35 # ppc | powerpc | 32 bits 35 # ppc | powerpc | 32 bits 36 # ppc64 | powerpc | 64 bits big endi 36 # ppc64 | powerpc | 64 bits big endian 37 # ppc64le | powerpc | 64 bits little e 37 # ppc64le | powerpc | 64 bits little endian 38 # 38 # 39 # It is recommended to only use XARCH, though 39 # It is recommended to only use XARCH, though it does not harm if 40 # ARCH is already set. For simplicity, ARCH is 40 # ARCH is already set. For simplicity, ARCH is sufficient for all 41 # architectures where both are equal. 41 # architectures where both are equal. 42 42 43 # configure default variants for target kernel 43 # configure default variants for target kernel supported architectures 44 XARCH_powerpc = ppc 44 XARCH_powerpc = ppc 45 XARCH_mips = mips32le 45 XARCH_mips = mips32le 46 XARCH = $(or $(XARCH_$(ARCH)),$(ARC 46 XARCH = $(or $(XARCH_$(ARCH)),$(ARCH)) 47 47 48 # map from user input variants to their kernel 48 # map from user input variants to their kernel supported architectures 49 ARCH_ppc = powerpc 49 ARCH_ppc = powerpc 50 ARCH_ppc64 = powerpc 50 ARCH_ppc64 = powerpc 51 ARCH_ppc64le = powerpc 51 ARCH_ppc64le = powerpc 52 ARCH_mips32le = mips 52 ARCH_mips32le = mips 53 ARCH_mips32be = mips 53 ARCH_mips32be = mips 54 ARCH := $(or $(ARCH_$(XARCH)),$(XAR 54 ARCH := $(or $(ARCH_$(XARCH)),$(XARCH)) 55 55 56 # kernel image names by architecture 56 # kernel image names by architecture 57 IMAGE_i386 = arch/x86/boot/bzImage 57 IMAGE_i386 = arch/x86/boot/bzImage 58 IMAGE_x86_64 = arch/x86/boot/bzImage 58 IMAGE_x86_64 = arch/x86/boot/bzImage 59 IMAGE_x86 = arch/x86/boot/bzImage 59 IMAGE_x86 = arch/x86/boot/bzImage 60 IMAGE_arm64 = arch/arm64/boot/Image 60 IMAGE_arm64 = arch/arm64/boot/Image 61 IMAGE_arm = arch/arm/boot/zImage 61 IMAGE_arm = arch/arm/boot/zImage 62 IMAGE_mips32le = vmlinuz 62 IMAGE_mips32le = vmlinuz 63 IMAGE_mips32be = vmlinuz 63 IMAGE_mips32be = vmlinuz 64 IMAGE_ppc = vmlinux 64 IMAGE_ppc = vmlinux 65 IMAGE_ppc64 = vmlinux 65 IMAGE_ppc64 = vmlinux 66 IMAGE_ppc64le = arch/powerpc/boot/zImage 66 IMAGE_ppc64le = arch/powerpc/boot/zImage 67 IMAGE_riscv = arch/riscv/boot/Image 67 IMAGE_riscv = arch/riscv/boot/Image 68 IMAGE_s390 = arch/s390/boot/bzImage 68 IMAGE_s390 = arch/s390/boot/bzImage 69 IMAGE_loongarch = arch/loongarch/boot/vmlinuz 69 IMAGE_loongarch = arch/loongarch/boot/vmlinuz.efi 70 IMAGE = $(objtree)/$(IMAGE_$(XARCH) 70 IMAGE = $(objtree)/$(IMAGE_$(XARCH)) 71 IMAGE_NAME = $(notdir $(IMAGE)) 71 IMAGE_NAME = $(notdir $(IMAGE)) 72 72 73 # default kernel configurations that appear to 73 # default kernel configurations that appear to be usable 74 DEFCONFIG_i386 = defconfig 74 DEFCONFIG_i386 = defconfig 75 DEFCONFIG_x86_64 = defconfig 75 DEFCONFIG_x86_64 = defconfig 76 DEFCONFIG_x86 = defconfig 76 DEFCONFIG_x86 = defconfig 77 DEFCONFIG_arm64 = defconfig 77 DEFCONFIG_arm64 = defconfig 78 DEFCONFIG_arm = multi_v7_defconfig 78 DEFCONFIG_arm = multi_v7_defconfig 79 DEFCONFIG_mips32le = malta_defconfig 79 DEFCONFIG_mips32le = malta_defconfig 80 DEFCONFIG_mips32be = malta_defconfig 80 DEFCONFIG_mips32be = malta_defconfig 81 DEFCONFIG_ppc = pmac32_defconfig 81 DEFCONFIG_ppc = pmac32_defconfig 82 DEFCONFIG_ppc64 = powernv_be_defconfig 82 DEFCONFIG_ppc64 = powernv_be_defconfig 83 DEFCONFIG_ppc64le = powernv_defconfig 83 DEFCONFIG_ppc64le = powernv_defconfig 84 DEFCONFIG_riscv = defconfig 84 DEFCONFIG_riscv = defconfig 85 DEFCONFIG_s390 = defconfig 85 DEFCONFIG_s390 = defconfig 86 DEFCONFIG_loongarch = defconfig 86 DEFCONFIG_loongarch = defconfig 87 DEFCONFIG = $(DEFCONFIG_$(XARCH)) 87 DEFCONFIG = $(DEFCONFIG_$(XARCH)) 88 88 89 EXTRACONFIG_mips32be = -d CONFIG_CPU_LITTLE_EN 89 EXTRACONFIG_mips32be = -d CONFIG_CPU_LITTLE_ENDIAN -e CONFIG_CPU_BIG_ENDIAN 90 EXTRACONFIG = $(EXTRACONFIG_$(XARCH) 90 EXTRACONFIG = $(EXTRACONFIG_$(XARCH)) 91 91 92 # optional tests to run (default = all) 92 # optional tests to run (default = all) 93 TEST = 93 TEST = 94 94 95 # QEMU_ARCH: arch names used by qemu 95 # QEMU_ARCH: arch names used by qemu 96 QEMU_ARCH_i386 = i386 96 QEMU_ARCH_i386 = i386 97 QEMU_ARCH_x86_64 = x86_64 97 QEMU_ARCH_x86_64 = x86_64 98 QEMU_ARCH_x86 = x86_64 98 QEMU_ARCH_x86 = x86_64 99 QEMU_ARCH_arm64 = aarch64 99 QEMU_ARCH_arm64 = aarch64 100 QEMU_ARCH_arm = arm 100 QEMU_ARCH_arm = arm 101 QEMU_ARCH_mips32le = mipsel # works with ma 101 QEMU_ARCH_mips32le = mipsel # works with malta_defconfig 102 QEMU_ARCH_mips32be = mips 102 QEMU_ARCH_mips32be = mips 103 QEMU_ARCH_ppc = ppc 103 QEMU_ARCH_ppc = ppc 104 QEMU_ARCH_ppc64 = ppc64 104 QEMU_ARCH_ppc64 = ppc64 105 QEMU_ARCH_ppc64le = ppc64 105 QEMU_ARCH_ppc64le = ppc64 106 QEMU_ARCH_riscv = riscv64 106 QEMU_ARCH_riscv = riscv64 107 QEMU_ARCH_s390 = s390x 107 QEMU_ARCH_s390 = s390x 108 QEMU_ARCH_loongarch = loongarch64 108 QEMU_ARCH_loongarch = loongarch64 109 QEMU_ARCH = $(QEMU_ARCH_$(XARCH)) 109 QEMU_ARCH = $(QEMU_ARCH_$(XARCH)) 110 110 111 QEMU_ARCH_USER_ppc64le = ppc64le 111 QEMU_ARCH_USER_ppc64le = ppc64le 112 QEMU_ARCH_USER = $(or $(QEMU_ARCH_USER 112 QEMU_ARCH_USER = $(or $(QEMU_ARCH_USER_$(XARCH)),$(QEMU_ARCH_$(XARCH))) 113 113 114 QEMU_BIOS_DIR = /usr/share/edk2/ 114 QEMU_BIOS_DIR = /usr/share/edk2/ 115 QEMU_BIOS_loongarch = $(QEMU_BIOS_DIR)/loongar 115 QEMU_BIOS_loongarch = $(QEMU_BIOS_DIR)/loongarch64/OVMF_CODE.fd 116 116 117 ifneq ($(QEMU_BIOS_$(XARCH)),) 117 ifneq ($(QEMU_BIOS_$(XARCH)),) 118 QEMU_ARGS_BIOS = -bios $(QEMU_BIOS_$(XARCH)) 118 QEMU_ARGS_BIOS = -bios $(QEMU_BIOS_$(XARCH)) 119 endif 119 endif 120 120 121 # QEMU_ARGS : some arch-specific args to pass 121 # QEMU_ARGS : some arch-specific args to pass to qemu 122 QEMU_ARGS_i386 = -M pc -append "console= 122 QEMU_ARGS_i386 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" 123 QEMU_ARGS_x86_64 = -M pc -append "console= 123 QEMU_ARGS_x86_64 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" 124 QEMU_ARGS_x86 = -M pc -append "console= 124 QEMU_ARGS_x86 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" 125 QEMU_ARGS_arm64 = -M virt -cpu cortex-a53 125 QEMU_ARGS_arm64 = -M virt -cpu cortex-a53 -append "panic=-1 $(TEST:%=NOLIBC_TEST=%)" 126 QEMU_ARGS_arm = -M virt -append "panic= 126 QEMU_ARGS_arm = -M virt -append "panic=-1 $(TEST:%=NOLIBC_TEST=%)" 127 QEMU_ARGS_mips32le = -M malta -append "panic 127 QEMU_ARGS_mips32le = -M malta -append "panic=-1 $(TEST:%=NOLIBC_TEST=%)" 128 QEMU_ARGS_mips32be = -M malta -append "panic 128 QEMU_ARGS_mips32be = -M malta -append "panic=-1 $(TEST:%=NOLIBC_TEST=%)" 129 QEMU_ARGS_ppc = -M g3beige -append "con 129 QEMU_ARGS_ppc = -M g3beige -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" 130 QEMU_ARGS_ppc64 = -M powernv -append "con 130 QEMU_ARGS_ppc64 = -M powernv -append "console=hvc0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" 131 QEMU_ARGS_ppc64le = -M powernv -append "con 131 QEMU_ARGS_ppc64le = -M powernv -append "console=hvc0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" 132 QEMU_ARGS_riscv = -M virt -append "consol 132 QEMU_ARGS_riscv = -M virt -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" 133 QEMU_ARGS_s390 = -M s390-ccw-virtio -m 1 133 QEMU_ARGS_s390 = -M s390-ccw-virtio -m 1G -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" 134 QEMU_ARGS_loongarch = -M virt -append "consol 134 QEMU_ARGS_loongarch = -M virt -append "console=ttyS0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" 135 QEMU_ARGS = $(QEMU_ARGS_$(XARCH)) $ 135 QEMU_ARGS = $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(QEMU_ARGS_EXTRA) 136 136 137 # OUTPUT is only set when run from the main ma 137 # OUTPUT is only set when run from the main makefile, otherwise 138 # it defaults to this nolibc directory. 138 # it defaults to this nolibc directory. 139 OUTPUT ?= $(CURDIR)/ 139 OUTPUT ?= $(CURDIR)/ 140 140 141 ifeq ($(V),1) 141 ifeq ($(V),1) 142 Q= 142 Q= 143 else 143 else 144 Q=@ 144 Q=@ 145 endif 145 endif 146 146 147 CFLAGS_i386 = $(call cc-option,-m32) 147 CFLAGS_i386 = $(call cc-option,-m32) 148 CFLAGS_ppc = -m32 -mbig-endian -mno-vsx $(call 148 CFLAGS_ppc = -m32 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) 149 CFLAGS_ppc64 = -m64 -mbig-endian -mno-vsx $(ca 149 CFLAGS_ppc64 = -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) 150 CFLAGS_ppc64le = -m64 -mlittle-endian -mno-vsx 150 CFLAGS_ppc64le = -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=elfv2) 151 CFLAGS_s390 = -m64 151 CFLAGS_s390 = -m64 152 CFLAGS_mips32le = -EL -mabi=32 -fPIC 152 CFLAGS_mips32le = -EL -mabi=32 -fPIC 153 CFLAGS_mips32be = -EB -mabi=32 153 CFLAGS_mips32be = -EB -mabi=32 154 CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mst 154 CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all)) 155 CFLAGS ?= -Os -fno-ident -fno-asynchronous-un 155 CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra \ 156 $(call cc-option,-fno-stack-pr 156 $(call cc-option,-fno-stack-protector) \ 157 $(CFLAGS_$(XARCH)) $(CFLAGS_ST 157 $(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA) 158 LDFLAGS := 158 LDFLAGS := 159 159 160 LIBGCC := -lgcc 160 LIBGCC := -lgcc 161 161 162 ifneq ($(LLVM),) 162 ifneq ($(LLVM),) 163 # Not needed for clang 163 # Not needed for clang 164 LIBGCC := 164 LIBGCC := 165 endif 165 endif 166 166 167 # Modify CFLAGS based on LLVM= 167 # Modify CFLAGS based on LLVM= 168 include $(srctree)/tools/scripts/Makefile.incl 168 include $(srctree)/tools/scripts/Makefile.include 169 169 170 # GCC uses "s390", clang "systemz" 170 # GCC uses "s390", clang "systemz" 171 CLANG_CROSS_FLAGS := $(subst --target=s390-lin 171 CLANG_CROSS_FLAGS := $(subst --target=s390-linux,--target=systemz-linux,$(CLANG_CROSS_FLAGS)) 172 172 173 REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\] 173 REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \ 174 END{ printf("\n%3d test(s): %3 174 END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \ 175 if (f || !p) printf("failure\n 175 if (f || !p) printf("failure\n"); else if (s) printf("warning\n"); else printf("success\n");; \ 176 printf("\nSee all results in % 176 printf("\nSee all results in %s\n", ARGV[1]); }' 177 177 178 help: 178 help: 179 @echo "Supported targets under selftes 179 @echo "Supported targets under selftests/nolibc:" 180 @echo " all call the \" 180 @echo " all call the \"run\" target below" 181 @echo " help this help" 181 @echo " help this help" 182 @echo " sysroot create the 182 @echo " sysroot create the nolibc sysroot here (uses \$$ARCH)" 183 @echo " nolibc-test build the e 183 @echo " nolibc-test build the executable (uses \$$CC and \$$CROSS_COMPILE)" 184 @echo " libc-test build an ex 184 @echo " libc-test build an executable using the compiler's default libc instead" 185 @echo " run-user runs the ex 185 @echo " run-user runs the executable under QEMU (uses \$$XARCH, \$$TEST)" 186 @echo " initramfs.cpio prepare the 186 @echo " initramfs.cpio prepare the initramfs archive with nolibc-test" 187 @echo " initramfs prepare the 187 @echo " initramfs prepare the initramfs tree with nolibc-test" 188 @echo " defconfig create a fr 188 @echo " defconfig create a fresh new default config (uses \$$XARCH)" 189 @echo " kernel (re)build t 189 @echo " kernel (re)build the kernel (uses \$$XARCH)" 190 @echo " kernel-standalone (re)build t 190 @echo " kernel-standalone (re)build the kernel with the initramfs (uses \$$XARCH)" 191 @echo " run runs the ke 191 @echo " run runs the kernel in QEMU after building it (uses \$$XARCH, \$$TEST)" 192 @echo " rerun runs a prev 192 @echo " rerun runs a previously prebuilt kernel in QEMU (uses \$$XARCH, \$$TEST)" 193 @echo " clean clean the s 193 @echo " clean clean the sysroot, initramfs, build and output files" 194 @echo "" 194 @echo "" 195 @echo "The output file is \"run.out\". 195 @echo "The output file is \"run.out\". Test ranges may be passed using \$$TEST." 196 @echo "" 196 @echo "" 197 @echo "Currently using the following v 197 @echo "Currently using the following variables:" 198 @echo " ARCH = $(ARCH)" 198 @echo " ARCH = $(ARCH)" 199 @echo " XARCH = $(XARCH)" 199 @echo " XARCH = $(XARCH)" 200 @echo " CROSS_COMPILE = $(CROSS_COMPI 200 @echo " CROSS_COMPILE = $(CROSS_COMPILE)" 201 @echo " CC = $(CC)" 201 @echo " CC = $(CC)" 202 @echo " OUTPUT = $(OUTPUT)" 202 @echo " OUTPUT = $(OUTPUT)" 203 @echo " TEST = $(TEST)" 203 @echo " TEST = $(TEST)" 204 @echo " QEMU_ARCH = $(if $(QEMU_A 204 @echo " QEMU_ARCH = $(if $(QEMU_ARCH),$(QEMU_ARCH),UNKNOWN_ARCH) [determined from \$$XARCH]" 205 @echo " IMAGE_NAME = $(if $(IMAGE_ 205 @echo " IMAGE_NAME = $(if $(IMAGE_NAME),$(IMAGE_NAME),UNKNOWN_ARCH) [determined from \$$XARCH]" 206 @echo "" 206 @echo "" 207 207 208 all: run 208 all: run 209 209 210 sysroot: sysroot/$(ARCH)/include 210 sysroot: sysroot/$(ARCH)/include 211 211 212 sysroot/$(ARCH)/include: 212 sysroot/$(ARCH)/include: 213 $(Q)rm -rf sysroot/$(ARCH) sysroot/sys 213 $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot 214 $(QUIET_MKDIR)mkdir -p sysroot 214 $(QUIET_MKDIR)mkdir -p sysroot 215 $(Q)$(MAKE) -C $(srctree) outputmakefi 215 $(Q)$(MAKE) -C $(srctree) outputmakefile 216 $(Q)$(MAKE) -C $(srctree)/tools/includ 216 $(Q)$(MAKE) -C $(srctree)/tools/include/nolibc ARCH=$(ARCH) OUTPUT=$(CURDIR)/sysroot/ headers_standalone 217 $(Q)mv sysroot/sysroot sysroot/$(ARCH) 217 $(Q)mv sysroot/sysroot sysroot/$(ARCH) 218 218 219 ifneq ($(NOLIBC_SYSROOT),0) 219 ifneq ($(NOLIBC_SYSROOT),0) 220 nolibc-test: nolibc-test.c nolibc-test-linkage 220 nolibc-test: nolibc-test.c nolibc-test-linkage.c sysroot/$(ARCH)/include 221 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) 221 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ 222 -nostdlib -nostdinc -static -Isysroo 222 -nostdlib -nostdinc -static -Isysroot/$(ARCH)/include nolibc-test.c nolibc-test-linkage.c $(LIBGCC) 223 else 223 else 224 nolibc-test: nolibc-test.c nolibc-test-linkage 224 nolibc-test: nolibc-test.c nolibc-test-linkage.c 225 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) 225 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ 226 -nostdlib -static -include $(srctree 226 -nostdlib -static -include $(srctree)/tools/include/nolibc/nolibc.h nolibc-test.c nolibc-test-linkage.c $(LIBGCC) 227 endif 227 endif 228 228 229 libc-test: nolibc-test.c nolibc-test-linkage.c 229 libc-test: nolibc-test.c nolibc-test-linkage.c 230 $(QUIET_CC)$(HOSTCC) -o $@ nolibc-test 230 $(QUIET_CC)$(HOSTCC) -o $@ nolibc-test.c nolibc-test-linkage.c 231 231 232 # local libc-test 232 # local libc-test 233 run-libc-test: libc-test 233 run-libc-test: libc-test 234 $(Q)./libc-test > "$(CURDIR)/run.out" 234 $(Q)./libc-test > "$(CURDIR)/run.out" || : 235 $(Q)$(REPORT) $(CURDIR)/run.out 235 $(Q)$(REPORT) $(CURDIR)/run.out 236 236 237 # local nolibc-test 237 # local nolibc-test 238 run-nolibc-test: nolibc-test 238 run-nolibc-test: nolibc-test 239 $(Q)./nolibc-test > "$(CURDIR)/run.out 239 $(Q)./nolibc-test > "$(CURDIR)/run.out" || : 240 $(Q)$(REPORT) $(CURDIR)/run.out 240 $(Q)$(REPORT) $(CURDIR)/run.out 241 241 242 # qemu user-land test 242 # qemu user-land test 243 run-user: nolibc-test 243 run-user: nolibc-test 244 $(Q)qemu-$(QEMU_ARCH_USER) ./nolibc-te 244 $(Q)qemu-$(QEMU_ARCH_USER) ./nolibc-test > "$(CURDIR)/run.out" || : 245 $(Q)$(REPORT) $(CURDIR)/run.out 245 $(Q)$(REPORT) $(CURDIR)/run.out 246 246 247 initramfs.cpio: kernel nolibc-test 247 initramfs.cpio: kernel nolibc-test 248 $(QUIET_GEN)echo 'file /init nolibc-te 248 $(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(objtree)/usr/gen_init_cpio - > initramfs.cpio 249 249 250 initramfs: nolibc-test 250 initramfs: nolibc-test 251 $(QUIET_MKDIR)mkdir -p initramfs 251 $(QUIET_MKDIR)mkdir -p initramfs 252 $(call QUIET_INSTALL, initramfs/init) 252 $(call QUIET_INSTALL, initramfs/init) 253 $(Q)cp nolibc-test initramfs/init 253 $(Q)cp nolibc-test initramfs/init 254 254 255 defconfig: 255 defconfig: 256 $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) 256 $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare 257 $(Q)if [ -n "$(EXTRACONFIG)" ]; then \ 257 $(Q)if [ -n "$(EXTRACONFIG)" ]; then \ 258 $(srctree)/scripts/config --fi 258 $(srctree)/scripts/config --file $(objtree)/.config $(EXTRACONFIG); \ 259 $(MAKE) -C $(srctree) ARCH=$(A 259 $(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) olddefconfig < /dev/null; \ 260 fi 260 fi 261 261 262 kernel: 262 kernel: 263 $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) 263 $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) < /dev/null 264 264 265 kernel-standalone: initramfs 265 kernel-standalone: initramfs 266 $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) 266 $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs < /dev/null 267 267 268 # run the tests after building the kernel 268 # run the tests after building the kernel 269 run: kernel initramfs.cpio 269 run: kernel initramfs.cpio 270 $(Q)qemu-system-$(QEMU_ARCH) -display 270 $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" 271 $(Q)$(REPORT) $(CURDIR)/run.out 271 $(Q)$(REPORT) $(CURDIR)/run.out 272 272 273 # re-run the tests from an existing kernel 273 # re-run the tests from an existing kernel 274 rerun: 274 rerun: 275 $(Q)qemu-system-$(QEMU_ARCH) -display 275 $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" 276 $(Q)$(REPORT) $(CURDIR)/run.out 276 $(Q)$(REPORT) $(CURDIR)/run.out 277 277 278 # report with existing test log 278 # report with existing test log 279 report: 279 report: 280 $(Q)$(REPORT) $(CURDIR)/run.out 280 $(Q)$(REPORT) $(CURDIR)/run.out 281 281 282 clean: 282 clean: 283 $(call QUIET_CLEAN, sysroot) 283 $(call QUIET_CLEAN, sysroot) 284 $(Q)rm -rf sysroot 284 $(Q)rm -rf sysroot 285 $(call QUIET_CLEAN, nolibc-test) 285 $(call QUIET_CLEAN, nolibc-test) 286 $(Q)rm -f nolibc-test 286 $(Q)rm -f nolibc-test 287 $(call QUIET_CLEAN, libc-test) 287 $(call QUIET_CLEAN, libc-test) 288 $(Q)rm -f libc-test 288 $(Q)rm -f libc-test 289 $(call QUIET_CLEAN, initramfs.cpio) 289 $(call QUIET_CLEAN, initramfs.cpio) 290 $(Q)rm -rf initramfs.cpio 290 $(Q)rm -rf initramfs.cpio 291 $(call QUIET_CLEAN, initramfs) 291 $(call QUIET_CLEAN, initramfs) 292 $(Q)rm -rf initramfs 292 $(Q)rm -rf initramfs 293 $(call QUIET_CLEAN, run.out) 293 $(call QUIET_CLEAN, run.out) 294 $(Q)rm -rf run.out 294 $(Q)rm -rf run.out 295 295 296 .PHONY: sysroot/$(ARCH)/include 296 .PHONY: sysroot/$(ARCH)/include
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.