I've found running a kernel under qemu with my normal rootfs to be quite
useful to quickly try out things. See the qemu-test script in the RAUC project
for an example: https://github.com/rauc/rauc/blob/master/qemu-test



I would agree.   
I find "virtme" tool to be super simple and effective.
It reuses your running system install, mounted with 9P,
no need to futz with a 2nd system image.
I barely had to tinker with all the qemu options and args...

heres my every-day usage (w my own boring shell funcs wrapping)
function krun () {
    echo vm    $KRUN_SHOW $KRUN_STDS $KDBG_OPTS $QM_OPTS $*
    virtme-run $KRUN_SHOW $KRUN_STDS $KDBG_OPTS $QM_OPTS $*
    # -qmp tcp:localhost:4444,server,nowait
}
[jimc@frodo local-i915m]$ krun
vm --show-command --show-boot-console --kdir . --mods=auto --kopt nokaslr --kopt dynamic_debug.verbose=3 --kopt module.dyndbg=+pmf --qemu-opts -machine dump-guest-core=on -m 2G
./.virtme_mods/lib/modules/0.0.0
/usr/bin/qemu-system-x86_64 -fsdev local,id=virtfs1,path=/,security_model=none,readonly,multidevs=remap -device virtio-9p-pci,fsdev=virtfs1,mount_tag=/dev/root -fsdev local,id=virtfs5,path=/usr/local/lib/python3.9/site-packages/virtme-0.1.1-py3.9.egg/virtme/guest,security_model=none,readonly,multidevs=remap -device virtio-9p-pci,fsdev=virtfs5,mount_tag=virtme.guesttools -machine accel=kvm:tcg -watchdog i6300esb -cpu host -parallel none -net none -echr 1 -serial none -chardev stdio,id=console,signal=off,mux=on -serial chardev:console -mon chardev=console -vga none -display none -kernel ./arch/x86/boot/bzImage -append 'virtme_link_mods=/home/jimc/projects/lx/wk-next/builds/local-i915m/.virtme_mods/lib/modules/0.0.0 earlyprintk=serial,ttyS0,115200 console=ttyS0 psmouse.proto=exps "virtme_stty_con=rows 24 cols 141 iutf8" TERM=xterm-256color rootfstype=9p rootflags=version=9p2000.L,trans=virtio,access=any raid=noautodetect ro nokaslr dynamic_debug.verbose=3 module.dyndbg=+pmf init=/bin/sh -- -c "mount -t tmpfs run /run;mkdir -p /run/virtme/guesttools;/bin/mount -n -t 9p -o ro,version=9p2000.L,trans=virtio,access=any virtme.guesttools /run/virtme/guesttools;exec /run/virtme/guesttools/virtme-init"' -machine dump-guest-core=on -m 2G
Wrong EFI loader signature.
early console in extract_kernel
input_data: 0x00000000047a340d
input_len: 0x00000000009f7f00
output: 0x0000000001000000
output_len: 0x0000000004139814
kernel_total_size: 0x0000000003630000
needed_size: 0x0000000004200000
trampoline_32bit: 0x000000000009d000


KASLR disabled: 'nokaslr' on cmdline.

......