-
Notifications
You must be signed in to change notification settings - Fork 373
Home
Welcome to the qemu-rpi-kernel wiki!
Emulation is a necessary aspect of embedded system development and Qemu is the right open source tool to do so for linux based SBCs.
To emulate RPi on Qemu, you will need these two files.
- Rpi kernel
- Rpi rootfs (That would be second portion of official .img file)
If you want to emulate newer jessie images with 4.1.7 kernel from this repo, you should probably prepare your image as per given on this Emulating-Jessie-image-with-4.1.x-kernel.
You will also need to have latest Qemu for your OS. Go to official (http://wiki.qemu.org/Download).
You can probably download Qemu by using package manager as well.
- For ubuntu (and any debian based OSes):
sudo apt-get install qemu
- For Mac OS X :
brew install qemu
- For windows users :
You will have to download Qemu installer.
Once, Qemu installed and you have necessary files for emulation as mentioned above, Follow these particular steps for emulating RPi.
-
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda image-file-name.img
-
You should get
#
prompt (bash) at the end of processing. -
nano /etc/ld.so.preload
-
Comment the 1st line saying
/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
by putting#
in front of it. -
Now,
nano /etc/udev/rules.d/90-qemu.rules
-
Add these lines.
KERNEL=="sda", SYMLINK+="mmcblk0"
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
KERNEL=="sda2", SYMLINK+="root"
-
sudo poweroff
-
Re-emulate by this command,
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda image-file-name.img
Key notes :
You can have maximum ram upto 256 only as there's a bug in versatilepb which doesn't allow to emulate more than 256 MB.
You might want to set up ssh by adding this extra flag while using Qemu
. -redir tcp:2222::22
Hope it helps.