/lib/debian-installer/start-udev
 
 # The virtio_{net,blk} drivers suit the virt platform used by vm.sh
+modprobe virtio_blk
 modprobe virtio_net
 ip l
-modprobe virtio_blk
+
+if grep -q -w testrun /proc/cmdline ; then
+    ROOT=/dev/vda1
+    TYPE=ext4
+    if mount -t $TYPE $ROOT /mnt ; then
+       exec /sbin/switch_root /mnt /sbin/init
+    fi
+    echo "Emergency console" >&2
+    exec /bin/sh < /dev/console > /dev/console 2>&1
+fi
 
 # Set up the pool media
 modprobe loop
 
 #!/bin/bash
 
-ARCH=${1:=arm64}
+ARCH=${1-arm64}
 
 IMG=disk-$ARCH.raw
+INITRD="-initrd $ARCH/initrd.gz"
 if [ -f $IMG ] ; then
     read -p "(r)un or (i)nstall: " CMD
     case "$CMD" in
        r|run)
-           APPEND="root=/dev/vda1"
+           APPEND=" testrun"
            ;;
        i|install)
-           INITRD="-initrd $ARCH/initrd.gz"
            ;;
        *)
            echo "** Aborted. Need an r or an i..." >&2
     esac
 else
     dd if=/dev/zero of=$IMG bs=1G count=0 seek=4
-    INITRD="-initrd $ARCH/initrd.gz"
 fi
 
 case "$ARCH" in
     # boot setup
     -kernel $ARCH/vmlinuz
     $INITRD
-    -append "console=ttyAMA0 root=/dev/vda1 roottype=ext4"
+    -append "console=ttyAMA0 root=/dev/vda1 roottype=ext4$APPEND"
     -serial stdio
     # qemu monitor interface
-    -chardev socket,id=QEMU,server=on,wait=off,path=QEMU
+    -chardev socket,id=QEMU-$ARCH,server=on,wait=off,path=QEMU
     -mon chardev=QEMU-$ARCH,mode=readline
     # graphics setup
     -nographic