Wednesday, May 25, 2016

Raspberry Pi on qemu

Hi all,

In case you ever try to run a Raspberry Pi in qemu on your own laptop: for some reason it should be easy, but it isn't (particularly now in 2016).  So I'm making this blog post in the hope that it can be useful for at least one other person.

I will spare you the numerous attempts that failed and go straight to the one that nicely worked: the original from 2012.


Download this, unpack.

qemu-system-arm -M versatilepb -cpu arm1136 -m 256 -kernel raspbian/vmlinuz-2.6.32-qemu-armv6 -initrd raspbian/initrd.img-2.6.32-qemu-armv6 -hda raspbian/raspbian.img -net nic -net user,hostfwd=tcp:127.0.0.1:5022-:22 -append "root=/dev/sda1"

Username "root", password "root"; or "raspbian", "raspbian".  This command has the user-mode network set so that we can also run "ssh -p 5022 raspbian@127.0.0.1" from the host to connect to the ARM board.


The installation is minimal.  If we want to use "apt-get" to get anything more, we need to fix the file "/etc/apt/sources.list" so that it says:


deb http://debian.raspbian.com/raspbian wheezy main
deb-src http://debian.raspbian.com/raspbian wheezy main

i.e. "/raspbian wheezy" instead of "/debian testing".  Then run "apt-get update".



Have fun!

Armin