Dockerized QEMU for testing stuff on Windows
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
docker-qemu/entrypoint.sh

34 lines
944 B

#!/bin/bash
set -x
set -e
PARENT=bond0.1
MACVTAP=macvtap$OFFSET
! ip link delete $MACVTAP
ip link add link $PARENT name $MACVTAP type macvtap mode bridge
ip link set dev $MACVTAP address ${MAC:?}
ip link set $MACVTAP up
# No udev in Docker
IFS=: read major minor < <(cat /sys/devices/virtual/net/$MACVTAP/tap*/dev)
DEV=/dev/tap$(cat /sys/class/net/$MACVTAP/ifindex)
rm -fv $DEV
mknod $DEV c $major $minor
# Launch QEMU instance
/usr/bin/qemu-system-x86_64 \
-machine pc-i440fx-4.2,accel=kvm \
-m 8192 \
-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x6 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=$MAC \
-device virtio-balloon-pci \
-drive if=none,id=hd,file=/data/image.bin,snapshot=on,format=raw \
-device scsi-hd,drive=hd \
-usb \
-device usb-ehci,id=ehci \
-device usb-tablet,bus=usb-bus.0 \
-rtc base=localtime,clock=vm \
-netdev tap,id=hostnet0,fd=9 9<>$DEV \
-nographic -vga qxl
# -vnc :$OFFSET