How to run yocto qemux86-64 image with HVF acceleration and SSH access on MacOS

qemu-system-x86_64 \
-kernel bzImage–5.15.96+git0+509f4b9d68_001e2930e6-r0-qemux86-64-20230327112333.bin \
-enable-kvm \
-machine q35,accel=hvf \
-device virtio-net-pci,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::5555-:22,net=192.168.7.0/24,host=192.168.7.1,dhcpstart=192.168.7.2 \
-drive file=core-image-minimal-qemux86-64-20230327162556.rootfs.ext4,if=virtio,format=raw \
-append "root=/dev/vda console=ttyS0 ip=dhcp" \
-serial stdio \
-m 2048M
view raw qemu-macos hosted with ❤ by GitHub

-kernel , -drive should be populated with build artifacts

-accel=hvf enables hardware acceleration for faster execution of QEMU

-hostfwd=tcp::5555-:22 forward guest port 22 to host 5555

Then it shall be possible to SSH to qemu using

ssh -p 5555 root@localhost

To copy a file

scp  -P 5555 root@localhost:/path/to/src/file /path/to/destination/file

Leave a comment