@@ -335,6 +335,9 @@ QEMU_KERNEL_IMAGE ?= $(KERNEL_IMAGE)
335
335
ECHR ?= 1
336
336
ROOT ?= /dev/vda
337
337
RW ?= rw
338
+ KASLR ?= 0
339
+
340
+ QEMU_KERNEL_CMDLINE := selinux=0
338
341
339
342
QEMU_ARGS := \
340
343
-m $(MEM ) \
@@ -351,11 +354,11 @@ ifneq ($(INITRD),)
351
354
ifeq ($(INITRD),1)
352
355
INITRD := $(CPIO_FILE )
353
356
endif
354
- QEMU_EXTRA_KERNEL_CMDLINE += rdinit=$(RDINIT )
357
+ QEMU_KERNEL_CMDLINE += rdinit=$(RDINIT )
355
358
QEMU_ARGS += -initrd $(INITRD )
356
359
else
357
360
QEMU_ARGS += -drive file=$(ROOTFS ) ,if=virtio,format=$(ROOTFS_FORMAT )
358
- QEMU_EXTRA_KERNEL_CMDLINE += root=$(ROOT ) $(RW )
361
+ QEMU_KERNEL_CMDLINE += root=$(ROOT ) $(RW )
359
362
endif
360
363
361
364
ifeq ($(GDB ) ,1)
@@ -364,9 +367,9 @@ endif
364
367
365
368
ifeq ($(ARCH ) ,x86_64)
366
369
QEMU_BIN := qemu-system-x86_64
367
- QEMU_ARGS += \
368
- -cpu kvm64,+smep,+smap \
369
- -append "console=ttyS0 selinux=0 kpti no5lvl $( QEMU_EXTRA_KERNEL_CMDLINE ) "
370
+ QEMU_KERNEL_CMDLINE += console=ttyS0 kpti no5lvl
371
+
372
+ QEMU_ARGS += -cpu kvm64,+smep,+smap
370
373
371
374
# We can't use KVM with GitHub Actions CI
372
375
ifneq ($(CI),true)
@@ -375,13 +378,20 @@ ifeq ($(ARCH),x86_64)
375
378
376
379
else
377
380
QEMU_BIN := qemu-system-aarch64
381
+ QEMU_KERNEL_CMDLINE += console=ttyAMA0
382
+
378
383
QEMU_ARGS += \
379
384
-M virt \
380
385
-cpu cortex-a53 \
381
- -semihosting-config enable=on,target=native \
382
- -append "console=ttyAMA0 selinux=0 $(QEMU_EXTRA_KERNEL_CMDLINE ) "
386
+ -semihosting-config enable=on,target=native
383
387
endif
384
388
389
+ ifeq ($(KASLR ) ,0)
390
+ QEMU_KERNEL_CMDLINE += nokaslr
391
+ endif
392
+
393
+ QEMU_ARGS += -append "$(QEMU_KERNEL_CMDLINE ) $(QEMU_EXTRA_KERNEL_CMDLINE ) "
394
+
385
395
RUN_DEPS := $(QEMU_KERNEL_IMAGE )
386
396
387
397
.PHONY : run
0 commit comments