Today, I am gonna talk about emulation of raspberry pi on windows.
This post is for specifically windows lovers 🙂
What is emulator ?
As wiki states, An emulator is hardware or software or both that duplicates (or emulates) the functions of one computer system (the guest) in another computer system (the host), different from the first one, so that the emulated behavior closely resembles the behavior of the real system (the guest).
It means that, virtual raspberry pi environment will be set up. Using which we can develop and test any application when Raspberry pi is not to hand, or when it’s not convenient or possible to power it up.
Here, in this post i am explaining to do this in four easy steps.
1. Get ARM emulator for windows
Raspberry pi has a ARM 11 based SoC. Open source processor emulator QEMU has a support for ARM architecture. The QEMU site itself does not have a Windows binary download. Some one(Eric Lassauge) has tweaked qemu for windows. You can get latest qemu from here.
Extract the ZIP file to a folder on your PC.
2. Get kernel for raspberry pi with Qemu support
Here, are the steps to compile Linux kernel with qemu support.
To escape this step toy can just download the pre-compiled image from here.
Move this file to the QEMU folder which is created in previous step.
3. Get any of Raspi distro image
I am using the raspian “raspbmc” image. You can download this image from raspberry pi site.
Extract the file and put it in qemu folder.
4. Finally launching the emulator
Now, its time to launch the emulator with your kernel and disc image. The below command has to be hit on dos prompt on windows.
To do that, press Window button, search cmd in search bar. You will get one application named “cmd”. Open that application to write command. This is basically Dos prompt. The below image will provide you more information about it.
So, navigate to the directory where you have extracted qemu and all downloaded binaries.
Hit the below command to start qemu-arm for raspberry pi. In my case, i have kernel-qemu (which is downloaded in step #2) is the kernel for raspberry pi and raspbmc.img (which is downloaded in step #3) is the image of file system.
qemu-system-armw.exe -M versatilepb -m 256 -cpu arm1176 -no-reboot -serial stdio -kernel kernel-qemu -hda raspbmc.img -append “root=/dev/sda2 panic=1”
The break down of the above command is :
1) qemu-system-armw : the command to emulate an arm system on windows
2) -M versatilepb : the machine we need to emulate
3) -m 256 : the amount of memory set that this version of the R-Pi has (The maximum memory size you can specify is 256Mb – that’s a limitation of QEMU for this hardware emulation – it may not work if you specify more)
4) -cpu arm1176 : the cpu we need to emulate
5) -no-reboot -append “root=/dev/sda2 panic1” : we mount our root filesystem to /dev/sda in the emulated R-Pi
First time,qemu will run raspbmc setup and configure it accordingly. After setup, u will get command prompt of raspbmc.
And thats it !!!
you are done with your virtual raspi configuration.