qemu_with_working_gui
This is an old revision of the document!
A short list of instructions
- I use macports - install latest qemu and qemu-utils.
- Download 2024-10-22-raspios-bullseye-armhf.img.xz. Unpack this with Archiver, and mount it as a drive (right click on the newly created .img file). You might need to change your Finder settings to view all drives.
- Create a new directory somewhere (for tidiness) and copy initramfs8, kernel8.img, bcm2710-rpi-3-b.dtb into this new directory.
- To use ssh (I presume you do), In Terminal in the mounted bullseye drive (probably at /Volumes/bootfs), run 'touch ssh'. This creates an empty file which signals to raspios to start the ssh server on first boot.
- Unmount the bootfs drive in Finder, and copy the bullseye image into your new directory with the other files.
- Open a text editor and copy this code to create a file (I called mine rpi.sh). Change permissions to be executable with 'chmod a+x rpi.sh'.
qemu-system-aarch64 \ -machine raspi3b -m 1G -kernel kernel8.img -initrd initramfs8 -dtb bcm2710-rpi-3-b.dtb \ -sd 2024-10-22-raspios-bullseye-armhf.img \ -cpu cortex-a53 \ -smp 4 \ -append "root=/dev/mmcblk0p2 rootwait" \ -usb \ -serial stdio \ -usbdevice keyboard \ -usbdevice mouse \ -netdev user,id=net0,hostfwd=tcp::2222-:22 -device usb-net,netdev=net0
- Run this script! You will be able to ssh to the emulated raspi3b at localhost:2222, as well as direct at 10.0.2.15 (default address for first DHCP machine on the QEMU virtual network).
NB You will probably get a warning about the 'Image format was not specified…'. format=raw is meant to solve this after the filename, but it gave me an error. I ignore this warning, YMMV.
Notes
I can't remember the number of sites I went around picking bits and pieces up to make this work. Thanks to all who went before (shoulders of giants &c.). Importantly, it only works with bullseye. It might work with the 64bit version, but I needed the 32bit armhf. There are other solution on macos for 64 bit Arm operating systems. I use UTM for those, but as of May 2025 it does not support armhf.
qemu_with_working_gui.1746179379.txt.gz · Last modified: (external edit)
