From 30cccc21ff50af7e6bf8156d89fa5af16c9e8567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Molinero=20Fern=C3=A1ndez?= Date: Sat, 20 Nov 2021 14:15:49 +0100 Subject: [PATCH] Added floppy disk support and updated deprecated options --- Dockerfile.m4 | 11 ++++++----- scripts/service/qemu/run | 26 +++++++++++++++++--------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Dockerfile.m4 b/Dockerfile.m4 index ef58857..0334f29 100644 --- a/Dockerfile.m4 +++ b/Dockerfile.m4 @@ -68,11 +68,12 @@ RUN mkisofs -no-emul-boot -iso-level 4 -eltorito-boot loader/isoboot.bin -o /tmp && qemu-img create -f qcow2 /tmp/reactos.qcow2 128G \ && timeout 900 qemu-system-x86_64 \ -machine pc -smp 2 -m 512M -accel tcg \ - -serial stdio -device VGA -display none \ + -device VGA -display none -serial stdio \ -device e1000,netdev=n0 -netdev user,id=n0,restrict=on \ - -drive file=/tmp/reactos.qcow2,index=0,media=disk,format=qcow2 \ - -drive file=/tmp/reactos.iso,index=2,media=cdrom,format=raw \ - -boot order=cd,menu=off -usb -device usb-tablet + -device ide-hd,bus=ide.0,drive=c0 -blockdev driver=qcow2,node-name=c0,file.driver=file,file.filename=/tmp/reactos.qcow2 \ + -device ide-cd,bus=ide.1,drive=d0 -blockdev driver=raw,node-name=d0,file.driver=file,file.filename=/tmp/reactos.iso,read-only=on \ + -boot order=cd,menu=off \ + -usb -device usb-tablet ################################################## ## "base" stage @@ -115,7 +116,7 @@ COPY --from=build --chown=root:root /tmp/novnc/ /opt/novnc/ COPY --from=build --chown=root:root /tmp/websockify/ /opt/novnc/utils/websockify/ # Copy ReactOS disk -COPY --from=build --chown=root:root /tmp/reactos.qcow2 /var/lib/qemu/image/reactos.qcow2 +COPY --from=build --chown=root:root /tmp/reactos.qcow2 /var/lib/qemu/disk/reactos.qcow2 # Copy Samba config COPY --chown=root:root ./config/samba/ /etc/samba/ diff --git a/scripts/service/qemu/run b/scripts/service/qemu/run index 8cd28f5..c9d258a 100755 --- a/scripts/service/qemu/run +++ b/scripts/service/qemu/run @@ -4,10 +4,11 @@ set -eu set -- set -- "$@" -machine pc -smp "${VM_CPU:?}" -m "${VM_RAM:?}" -set -- "$@" -serial stdio -monitor unix:/run/qemu-monitor,server,nowait -device VGA -display vnc=:0 +set -- "$@" -device VGA -display vnc=:0 -serial stdio -monitor unix:/run/qemu-monitor,server,nowait set -- "$@" -device e1000,netdev=n0 -netdev user,id=n0,"${VM_NET_GUESTFWD_OPTIONS?}","${VM_NET_HOSTFWD_OPTIONS?}","${VM_NET_EXTRA_OPTIONS?}" -set -- "$@" -drive file=/var/lib/qemu/image/reactos.qcow2,index=0,media=disk,format=qcow2 -set -- "$@" -usb -device usb-tablet -k "${VM_KEYBOARD:?}" +set -- "$@" -device ide-hd,bus=ide.0,drive=c0 -blockdev driver=qcow2,node-name=c0,file.driver=file,file.filename=/var/lib/qemu/disk/reactos.qcow2 +set -- "$@" -usb -device usb-tablet +set -- "$@" -k "${VM_KEYBOARD:?}" if [ "${VM_KVM:?}" = true ] && [ -c /dev/kvm ]; then set -- "$@" -accel kvm -cpu host @@ -15,14 +16,21 @@ else set -- "$@" -accel tcg fi -iso_i=2 -for iso in /var/lib/qemu/iso/*; do - [ -f "${iso:?}" ] || continue - set -- "$@" -drive file="${iso:?}",index="${iso_i:?}",media=cdrom,format=raw - iso_i="$((iso_i + 1))" +cd_i=0 +for cd in /var/lib/qemu/cd/*; do + [ -f "${cd:?}" ] || continue + set -- "$@" -device ide-cd,bus=ide.1,drive=d"${cd_i:?}" -blockdev driver=raw,node-name=d"${cd_i:?}",file.driver=file,file.filename="${cd:?}",read-only=on + cd_i="$((cd_i + 1))" done -if [ "${iso_i:?}" -gt 2 ]; then +floppy_i=0 +for floppy in /var/lib/qemu/floppy/*; do + [ -f "${floppy:?}" ] || continue + set -- "$@" -device floppy,bus=floppy-bus.0,drive=a"${floppy_i:?}" -blockdev driver=raw,node-name=a"${floppy_i:?}",file.driver=file,file.filename="${floppy:?}",read-only=on + floppy_i="$((floppy_i + 1))" +done + +if [ "${cd_i:?}" -gt 0 ]; then set -- "$@" -boot order=dc,menu=on,splash-time=5000 fi