@@ -131,18 +131,20 @@ REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++
131
131
132
132
help :
133
133
@echo " Supported targets under selftests/nolibc:"
134
- @echo " all call the \" run\" target below"
135
- @echo " help this help"
136
- @echo " sysroot create the nolibc sysroot here (uses \$ $ARCH )"
137
- @echo " nolibc-test build the executable (uses \$ $CC and \$ $CROSS_COMPILE )"
138
- @echo " libc-test build an executable using the compiler's default libc instead"
139
- @echo " run-user runs the executable under QEMU (uses \$ $XARCH , \$ $TEST )"
140
- @echo " initramfs prepare the initramfs with nolibc-test"
141
- @echo " defconfig create a fresh new default config (uses \$ $XARCH )"
142
- @echo " kernel (re)build the kernel with the initramfs (uses \$ $XARCH )"
143
- @echo " run runs the kernel in QEMU after building it (uses \$ $XARCH , \$ $TEST )"
144
- @echo " rerun runs a previously prebuilt kernel in QEMU (uses \$ $XARCH , \$ $TEST )"
145
- @echo " clean clean the sysroot, initramfs, build and output files"
134
+ @echo " all call the \" run\" target below"
135
+ @echo " help this help"
136
+ @echo " sysroot create the nolibc sysroot here (uses \$ $ARCH )"
137
+ @echo " nolibc-test build the executable (uses \$ $CC and \$ $CROSS_COMPILE )"
138
+ @echo " libc-test build an executable using the compiler's default libc instead"
139
+ @echo " run-user runs the executable under QEMU (uses \$ $XARCH , \$ $TEST )"
140
+ @echo " initramfs.cpio prepare the initramfs archive with nolibc-test"
141
+ @echo " initramfs prepare the initramfs tree with nolibc-test"
142
+ @echo " defconfig create a fresh new default config (uses \$ $XARCH )"
143
+ @echo " kernel (re)build the kernel (uses \$ $XARCH )"
144
+ @echo " kernel-standalone (re)build the kernel with the initramfs (uses \$ $XARCH )"
145
+ @echo " run runs the kernel in QEMU after building it (uses \$ $XARCH , \$ $TEST )"
146
+ @echo " rerun runs a previously prebuilt kernel in QEMU (uses \$ $XARCH , \$ $TEST )"
147
+ @echo " clean clean the sysroot, initramfs, build and output files"
146
148
@echo " "
147
149
@echo " The output file is \" run.out\" . Test ranges may be passed using \$ $TEST ."
148
150
@echo " "
@@ -195,6 +197,9 @@ run-user: nolibc-test
195
197
$(Q ) qemu-$(QEMU_ARCH ) ./nolibc-test > " $( CURDIR) /run.out" || :
196
198
$(Q )$(REPORT ) $(CURDIR ) /run.out
197
199
200
+ initramfs.cpio : kernel nolibc-test
201
+ $(QUIET_GEN ) echo ' file /init nolibc-test 755 0 0' | $(srctree ) /usr/gen_init_cpio - > initramfs.cpio
202
+
198
203
initramfs : nolibc-test
199
204
$(QUIET_MKDIR ) mkdir -p initramfs
200
205
$(call QUIET_INSTALL, initramfs/init)
@@ -203,17 +208,20 @@ initramfs: nolibc-test
203
208
defconfig :
204
209
$(Q )$(MAKE ) -C $(srctree ) ARCH=$(ARCH ) CC=$(CC ) CROSS_COMPILE=$(CROSS_COMPILE ) mrproper $(DEFCONFIG ) prepare
205
210
206
- kernel : initramfs
211
+ kernel :
212
+ $(Q )$(MAKE ) -C $(srctree ) ARCH=$(ARCH ) CC=$(CC ) CROSS_COMPILE=$(CROSS_COMPILE ) $(IMAGE_NAME )
213
+
214
+ kernel-standalone : initramfs
207
215
$(Q )$(MAKE ) -C $(srctree ) ARCH=$(ARCH ) CC=$(CC ) CROSS_COMPILE=$(CROSS_COMPILE ) $(IMAGE_NAME ) CONFIG_INITRAMFS_SOURCE=$(CURDIR ) /initramfs
208
216
209
217
# run the tests after building the kernel
210
- run : kernel
211
- $(Q ) qemu-system-$(QEMU_ARCH ) -display none -no-reboot -kernel " $( srctree) /$( IMAGE) " -serial stdio $(QEMU_ARGS ) > " $( CURDIR) /run.out"
218
+ run : kernel initramfs.cpio
219
+ $(Q ) qemu-system-$(QEMU_ARCH ) -display none -no-reboot -kernel " $( srctree) /$( IMAGE) " -initrd initramfs.cpio - serial stdio $(QEMU_ARGS ) > " $( CURDIR) /run.out"
212
220
$(Q )$(REPORT ) $(CURDIR ) /run.out
213
221
214
222
# re-run the tests from an existing kernel
215
223
rerun :
216
- $(Q ) qemu-system-$(QEMU_ARCH ) -display none -no-reboot -kernel " $( srctree) /$( IMAGE) " -serial stdio $(QEMU_ARGS ) > " $( CURDIR) /run.out"
224
+ $(Q ) qemu-system-$(QEMU_ARCH ) -display none -no-reboot -kernel " $( srctree) /$( IMAGE) " -initrd initramfs.cpio - serial stdio $(QEMU_ARGS ) > " $( CURDIR) /run.out"
217
225
$(Q )$(REPORT ) $(CURDIR ) /run.out
218
226
219
227
# report with existing test log
@@ -227,6 +235,8 @@ clean:
227
235
$(Q ) rm -f nolibc-test
228
236
$(call QUIET_CLEAN, libc-test)
229
237
$(Q ) rm -f libc-test
238
+ $(call QUIET_CLEAN, initramfs.cpio)
239
+ $(Q ) rm -rf initramfs.cpio
230
240
$(call QUIET_CLEAN, initramfs)
231
241
$(Q ) rm -rf initramfs
232
242
$(call QUIET_CLEAN, run.out)
0 commit comments