- Put
curl
and7z
on your%PATH%
I use "%USERPROFILE%\Documents\qemu-raspi"
for target directory.
Windows:
curl --version
7z --help
cd /d "%USERPROFILE%\Documents"
mkdir qemu-raspi
cd qemu-raspi
curl -OL http://qemu.weilnetz.de/w64/qemu-w64-setup-20140801.exe
7z x -oqemu qemu-w64-setup-20140801.exe
mkdir raspi
pushd raspi
curl -OL http://xecdesign.com/downloads/linux-qemu/kernel-qemu
curl -OL http://downloads.raspberrypi.org/raspbian_latest
7z x raspbian_latest -so > raspbian_latest.img
popd
Windows:
@cd /d "%USERPROFILE%\Documents\qemu-raspi"
@set QEMU_OPT=-M versatilepb -cpu arm1176 -hda raspi\raspbian_latest.img -kernel raspi\kernel-qemu -m 192 -redir tcp:5022::22
@start "" qemu\qemu-system-armw.exe %QEMU_OPT% -no-reboot -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash"
After you see the following prompt in QEMU window
QEMU:
root@(none):/#
Run the following command (it adds #
to the beginning of /etc/ld.so.preload
)
QEMU:
sed -i '1s/^/#/' /etc/ld.so.preload
Do exit
to close QEMU
QEMU:
exit
Windows:
@cd /d "%USERPROFILE%\Documents\qemu-raspi"
@set QEMU_OPT=-M versatilepb -cpu arm1176 -hda raspi\raspbian_latest.img -kernel raspi\kernel-qemu -m 256 -redir tcp:5022::22
@start "" qemu\qemu-system-armw.exe %QEMU_OPT% -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw"
- You may see "Raspberry Pi Software Configuration Tool (
raspi-config
)", do something you like- I recommend go to "4 Internationalisation Options" - "I3 Change Keyboard Layout" and select your keyboard properly.
- After that, press TAB key to select
<Finish>
, and press Enter to finishraspi-config
.
- Now, you can use QEMU window or SSH (
localhost:5022
) to login Raspbian- Use username:
pi
, password:raspberry
- Use username:
- Close QEMU window
- Increase disk image capacity with
qemu-img
(here I add +10 Giga Bytes)
Windows:
@cd /d "%USERPROFILE%\Documents\qemu-raspi"
@qemu\qemu-img resize raspi\raspbian_latest.img +10GB
- Run QEMU ("Usual Boot"), login
- Create a file
/etc/udev/rules.d/90-qemu.rules
QEMU:
sudo nano /etc/udev/rules.d/90-qemu.rules
- with the following content
QEMU:
KERNEL=="sda", SYMLINK+="mmcblk0"
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
KERNEL=="sda2", SYMLINK+="root"
- Reboot QEMU, login
- Make symlink and do
raspi-config
QEMU:
sudo ln -snf mmcblk0p2 /dev/root
sudo raspi-config
- Select
1 Expand Filesystem
inraspi-config
, and reboot - Make sure your storage capacity is increased
QEMU:
df -h
You may have seen the following error message in the boot log:
[....] mounting local filesystems...mount: special device /dev/mmcblk0p1 does not exist
failed
Since in this setup, QEMU does not have any SD card device, it is a proper error.
You can see running kernel version (uname -r
) and Raspbian Images required kernel
pi@raspberrypi ~ $ uname -r
3.10.26+
pi@raspberrypi ~ $ ls -1 /lib/modules
3.12.22+
This mismatch causes many related problems. For example, you can see the following error in boot sequence :
[info] Loading kernel module snd-bcm2835
libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open moddep file '/lib/modules/3.10.26+/modules.dep.bin'
And lsmod
is not working, etc.
- http://techny.tumblr.com/post/36589722093/quick-guide-on-emulating-a-raspberry-pi-in-windows
- http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
- http://www.richelbilderbeek.nl/CppRaspbianUnderQemu.htm
- http://www.v13.gr/blog/?p=276
- http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=42279
- https://blog.ymyzk.com/2013/12/raspberry-pi-qemu/
- http://www.sayargyi.com/content/?p=405