Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (Sierra)
# Install QEMU OSX port with ARM support
/usr/bin/ruby -e "$(curl -fsSL" && brew update && brew install qemu
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
curl -OL \
export RPI_KERNEL=./kernel-qemu-4.4.34-jessie
# Download filesystem and export location
curl -o \
export RPI_FS=./
# Tweak filesystem: start qemu with init flag, switch to guest window to execute tweak and close window afterwards
$QEMU -kernel $RPI_KERNEL \
-cpu arm1176 -m 256 \
-M versatilepb -no-reboot -serial stdio \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" \
-drive "file=2017-03-02-raspbian-jessie.img,index=0,media=disk,format=raw"
sed -i -e 's/^/#/' /etc/
sed -i -e 's/^/#/' /etc/
sed -i -e 's/^/#/' /etc/fstab
# Emulate Raspberry Pi
$QEMU -kernel $RPI_KERNEL \
-cpu arm1176 -m 256 \
-M versatilepb -no-reboot -serial stdio \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-drive "file=2017-03-02-raspbian-jessie.img,index=0,media=disk,format=raw" \
-net user,hostfwd=tcp::5022-:22,vlan=0 -net nic,vlan=0
# -net user,hostfwd=tcp::5022-:22
# Login to Raspberry Pi
ssh -p 5022 pi@localhost
# Referenced from OSX raspberry pi emulation via QEMU -
# Referenced from Emulating Jessie image with 4.1.7 kernel -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.