Skip to content

Instantly share code, notes, and snippets.

@rossja
Last active October 22, 2020 14:52
Show Gist options
  • Save rossja/caf9b639aec1ebce6f227096e3bead38 to your computer and use it in GitHub Desktop.
Save rossja/caf9b639aec1ebce6f227096e3bead38 to your computer and use it in GitHub Desktop.
QEMU Raspberry Pi 2 Emulation on Mac OS X
#!/bin/bash
# tested on Max OS X 10.13.2 "High Sierra"
# install qemu using: `brew install qemu`
# get kernel from: https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.4.34-jessie?raw=true
# get raspbian image from: http://downloads.raspberrypi.org/raspbian_latest
qemu-system-arm \
-kernel kernel-qemu-4.4.34-jessie \
-cpu arm1176 \
-m 256 \
-machine versatilepb \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-drive "file=./2017-11-29-raspbian-stretch.img,index=0,media=disk,format=raw" \
-no-reboot \
-serial stdio \
-curses \
-device e1000,netdev=user.0 \
-netdev user,id=user.0,hostfwd=tcp::2222-:22
# note the last line redirects ssh on the emulated raspi to localhost:2222
@rossja
Copy link
Author

rossja commented Oct 22, 2020

Wondering if some of the Catalina+ changes may be getting in the way here? I'll run some tests tomorrow and update with what I find.

@rossja
Copy link
Author

rossja commented Oct 22, 2020

yep. looks like this is a combination of Catalina and newer raspi images. Looks like the place I ref'd for the kernel image has this working in a much better format: https://github.com/dhruvvyas90/qemu-rpi-kernel/ (and they link to a docker image, also).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment