I'm trying to emulate Raspberry Pi via QEMU and the following works for me:
qemu-system-arm \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-boot c \
-cpu arm1176 \
-drive "file=2019-04-08-raspbian-stretch-lite.img,if=scsi,cache=none,discard=ignore,format=raw" \
-kernel ./kernel-qemu-4.4.34-jessie \
-m 256M \
-machine type=versatilepb,accel=tcg \
-name packer-qemu \
-no-reboot \
-vnc 127.0.0.1:4 \
-net nic \
-net user,id=user.0,hostfwd=tcp::5555-:22
and I'm able to both VNC in via 5904
and SSH in via 5555
(after starting SSHd via VNC). In other words network seems to be set up correctly.
As I discovered -net
option has been deprecated in favour of -device
& -netdev
, so I'd like to translate the above two last flags into "new QEMU".
It appears that the new -device
flag forces me to pick a driver, which isn't the case with -net
. I like explicitness, but how do I know what is the default/implicit driver?
Port forwarding in the following example doesn't seem to work anymore (I can't SSH in; connection times out):
qemu-system-arm \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-boot c \
-cpu arm1176 \
-drive "file=2019-04-08-raspbian-stretch-lite.img,if=scsi,cache=none,discard=ignore,format=raw" \
-kernel ./kernel-qemu-4.4.34-jessie \
-m 256M \
-machine type=versatilepb,accel=tcg \
-name packer-qemu \
-no-reboot \
-vnc 127.0.0.1:4 \
-device e1000,netdev=user.0 \
-netdev user,id=user.0,hostfwd=tcp::5555-:22
Am I just using wrong driver?
QEMU 3.1.0
(installed from Homebrew)
(Host) MacOS 10.14.4
-nic user,id=user.0,hostfwd=tcp::5555-:22
(which seems to be a new flag too) but I'm still very confused about differences between all these flags and I'm still curious whether they are replaceable with each other.info network
in the qemu monitor (for your machine (versatilepb) it's probably smc91c111.