Whilst you can technically run eclipse on the Raspberry Pi, in reality it doesn't have the power to make it usable.  This guide is based on virtualising Raspbian using QEMU

QEMU

QEMU is an emulator for various CPUs. It works on Linux, Windows, FreeBSD and Mac OS X. The Windows version is in an alpha stage.

Sorry – but qemu is not the magic solution it seems it should be.  After doing all this you will have raspbian and eclipse running on your windows PC, but it is SLOOOOOOOOOOOW.  Too slow to use and probably slower than using your RPi itself.  If anyone finds a solution to this or wants to take on creating a better kernel for qemu to run to solve the problem please share it in the comments below!

Resources

This guide was helped by these pages:

lassauge.free.fr/qemu/

http://techny.tumblr.com/post/36589722093/quick-guide-on-emulating-a-raspberry-pi-in-windows

http://forums.us.ncix.com/forums/topic.php?id=2581507

http://www.verious.com/tutorial/faster-compiling-on-an-emulated-raspberry-pi-on-linux/

http://sentryytech.blogspot.co.uk/2013/02/faster-compiling-on-emulated-raspberry.html  <<<<This page has details of fixing the speed issue running under linux – we've not tried

Installing QEMU For Windows

1. Download the latest "Qemu-#.#.#-windows.zip" from the very helpful page http://lassauge.free.fr/qemu/ (we installed "Qemu-1.5.2-windows.zip")
Unzip it into C:/qemu/Qemu-windows-#.#.#/ (change #.#.# to match your version number)

2. Download http://xecdesign.com/downloads/linux-qemu/kernel-qemu and place it in the same directory.

3. Download the latest Raspbian image file from http://www.raspberrypi.org/downloads. Unzip it if necessary and store the .img file in the same directory (we used "2013-07-26-wheezy-raspbian.img").

4. Use notepad to create a new text file and paste the following into it:


qemu-system-armw.exe -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -hda 2013-07-26-wheezy-raspbian.img -append "root=/dev/sda2 panic=1"

(Change "2013-07-26-wheezy-raspbian.img" to match the filename of your image)

Save it as "raspberry.bat" in the same directory.

To run it all just double click the raspberry.bat file.

"INIT: ID "1" respawning too fast: disabled for 5 minutes"

This is probably due to the issue of the "/etc/ld.so.preload" file in new raspbian images. If you search on this error messages you'll find instructions on how to edit this file within the .img file.  There's another way though, just setup your SD card as you normally would for the raspberry pi and run it in a raspberry pi.   You can do the normal things like expand the filesystem to fill your SD card, which will mean you get the same size of disk in qemu also.  You still need to edit the "/etc/ld.so.preload" file as it will stop you being able to log on in qemu (it causes the load of some shared-library, which will make you unable to login causes "kernel panic" apparently), so from the command line use:


sudo nano /etc/ld.so.preload

Now insert a # as the start of the only line in there to comment it out, giving:


#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so

Use CTRL+X to save and exit.  Then use this before powering off:


sudo halt

Now use Win32DiskImager to read the SD card and create an .iso image file.  Copy this into the qemu directory used above, update the raspberry.bat file to use its name and hey presto you have raspbian on your desktop.  There will be a few error messages as it boots due to hardware that isn't there, but it should load to the login prompt and be ready to go.

QEMU Tips

To exit the QEMU window and get your mouse back use CTRL+ALT or CTRL+TAB

RAM Size

You might be tempted to alter the .bat file "-m 256" to something more useful like "-m 1024"?  You can't, you'll just get a black screen of nothing.  The physical memory map on versatile hardware does not allow more than 256MB of space for RAM and as we're using the versatile kernel we can't have more.

Networking

Qemu doesn't sort out an network bridge so you've got to provide it yourself.   The easy way to do this is using an OpenVPN  "TAP".   Go to http://openvpn.net/index.php/download.html and select "community downloads" to get the the windows installer.

1. Install it using the default options ensuring the the Install TAP interface option is selected.

2. Go to the windows network and sharing centre and select the new "TAP-Windows Adapter" Local Area Connection.  Right click and rename it to "TAP0".  Then right click and select properties.

Now select the TAP0 interface and holding CTRL also select your primary local area connection. Then right click and select "Bridge Connections".   This will create a new "Network Bridge".  If you want to give it a fixed IP address you can edit its properties.

3. Now edit the "raspberry.bat" file and add the following to the end of it:


-net nic -net tap,ifname=TAP0

This will give you something like this:


qemu-system-armw.exe -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -hda my_rpi_image_name.img -append "root=/dev/sda2 panic=1" -net nic -net tap,ifname=TAP0

That's it, save the file, double click it and when raspbian boots it will have an IP address on your local network.

Display Resolution

Qemu is limited to a max resolution of 800×600.  You can run the raspbian GUI in it fine, but who wants to at that resolution.  To get round this you can just use remote desktop to give the full 1920×1080.  


sudo apt-get install xrdp

This will install XRDP which allows you to use Remote desktop to remote into the qemu instance and get full monitor resolution.

To use it press the windows start button > All programs > Accessories > Remote desktop connection.  Enter your IP address and then the standard RPi login when prompted and you'll get a full size grey screen followed by the GUI.

Switching between full screen and window mode in remote desktop

Use CTRL+ALT+Break to toggle

Copy And Paste

Qemu doesn't allow you to copy and paste between the host OS and its virtual OS.  There are tools which can do this but now that networking is setup you can just use your ffavorite SSH tool instead (e.g. FireSSH) which does support copy and paste and access the RPi command line that way.  You'll also be able to get past the qemu tiny display resolution for the command line this way too.

Install Eclipse

sudo apt-get install eclipse

That's it, now marvel at how slow it is!  Sorry see warning at the top of this page.

Speeding QEMU up

Raspbian has a swap file based solution instead of the "standard" swap-partition based solution.  You can edit its setup using this from the command line:


sudo nano /etc/dphys-swapfile 

The default value is 100MB, so change it to say 1024MB (assumign you have enough free disk space in your disk image)

​Press CTRL+X to save and exit and then reboot or use the following to use the new size:


/etc/init.d/dphys-swapfile stop
/etc/init.d/dphys-swapfile start

We tried this but it made little difference for us :-(

 

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *