{"id":1203,"date":"2013-09-27T08:07:25","date_gmt":"2013-09-27T08:07:25","guid":{"rendered":"https:\/\/raspberry-projects.com\/pi\/?p=1203"},"modified":"2014-09-26T15:05:13","modified_gmt":"2014-09-26T15:05:13","slug":"installing-eclipse-on-qemu-emulated-raspberry-pi-windows","status":"publish","type":"post","link":"https:\/\/raspberry-projects.com\/pi\/programming-in-c\/compilers-and-ides\/eclipse-raspberry-pi\/installing-eclipse-on-qemu-emulated-raspberry-pi-windows","title":{"rendered":"Installing Eclipse on QEMU Emulated Raspberry Pi &#8211; Windows"},"content":{"rendered":"<p>\nWhilst you can technically run eclipse on the Raspberry Pi, in reality it doesn&#39;t have the power to make it usable. &nbsp;This guide is based on virtualising Raspbian using QEMU\n<\/p>\n<h4>\nQEMU<br \/>\n<\/h4>\n<p>\nQEMU is an emulator for various CPUs. It works on Linux, Windows, FreeBSD and Mac OS X. The Windows version is in an alpha stage.\n<\/p>\n<p>\n<span style=\"color:#FF0000;\"><em><strong>Sorry &#8211; but qemu&nbsp;is not the magic solution it seems it should be. &nbsp;After doing all this you will have raspbian and eclipse running on your windows PC, but it is SLOOOOOOOOOOOW. &nbsp;Too slow to use and probably slower than using your RPi itself. &nbsp;If anyone finds a solution to this or wants to take on creating a better kernel for qemu&nbsp;to run to solve the problem please share it in the comments below!<\/strong><\/em><\/span>\n<\/p>\n<h4>\nResources<br \/>\n<\/h4>\n<p>\nThis guide was helped by these pages:\n<\/p>\n<p>\n<a href=\"http:\/\/lassauge.free.fr\/qemu\/\" target=\"_blank\">lassauge.free.fr\/qemu\/<\/a>\n<\/p>\n<p>\n<a href=\"http:\/\/techny.tumblr.com\/post\/36589722093\/quick-guide-on-emulating-a-raspberry-pi-in-windows\" target=\"_blank\">http:\/\/techny.tumblr.com\/post\/36589722093\/quick-guide-on-emulating-a-raspberry-pi-in-windows<\/a>\n<\/p>\n<p>\n<a href=\"http:\/\/forums.us.ncix.com\/forums\/topic.php?id=2581507\" target=\"_blank\">http:\/\/forums.us.ncix.com\/forums\/topic.php?id=2581507<\/a>\n<\/p>\n<p>\n<a href=\"http:\/\/www.verious.com\/tutorial\/faster-compiling-on-an-emulated-raspberry-pi-on-linux\/\" target=\"_blank\">http:\/\/www.verious.com\/tutorial\/<\/a>faster-compiling-on-an-emulated-raspberry-pi-on-linux\/\n<\/p>\n<p>\n<a href=\"http:\/\/sentryytech.blogspot.co.uk\/2013\/02\/faster-compiling-on-emulated-raspberry.html\" target=\"_blank\">http:\/\/sentryytech.blogspot.co.uk\/2013\/02\/faster-compiling-on-emulated-raspberry.html<\/a>&nbsp; &lt;&lt;&lt;&lt;This page has details of fixing the speed issue running under linux &#8211; we&#39;ve not tried\n<\/p>\n<h4>\nInstalling QEMU&nbsp;For Windows<br \/>\n<\/h4>\n<p>\n1. Download the latest &quot;Qemu-#.#.#-windows.zip&quot;&nbsp;from the very helpful page <a href=\"http:\/\/lassauge.free.fr\/qemu\/\" target=\"_blank\">http:\/\/lassauge.free.fr\/qemu\/<\/a>&nbsp;(we installed &quot;Qemu-1.5.2-windows.zip&quot;)<br \/>\nUnzip it into C:\/qemu\/Qemu-windows-#.#.#\/ (change #.#.# to match your version number)\n<\/p>\n<p>\n2. Download <a href=\"http:\/\/xecdesign.com\/downloads\/linux-qemu\/kernel-qemu\" target=\"_blank\">http:\/\/xecdesign.com\/downloads\/linux-qemu\/kernel-qemu<\/a> and place it in the same directory.\n<\/p>\n<p>\n3. Download the latest Raspbian&nbsp;image file from <a href=\"http:\/\/www.raspberrypi.org\/downloads\" target=\"_blank\">http:\/\/www.raspberrypi.org\/downloads<\/a>.&nbsp;Unzip it if necessary and store the .img file in the same directory (we used &quot;2013-07-26-wheezy-raspbian.img&quot;).\n<\/p>\n<p>\n4. Use notepad to create a new text file and paste the following into it:\n<\/p>\n<pre>\r\n<code>\r\nqemu-system-armw.exe -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -hda 2013-07-26-wheezy-raspbian.img -append &quot;root=\/dev\/sda2 panic=1&quot;\r\n<\/code><\/pre>\n<p>\n(Change &quot;2013-07-26-wheezy-raspbian.img&quot; to match the filename of your image)\n<\/p>\n<p>\nSave it as &quot;raspberry.bat&quot; in the same directory.\n<\/p>\n<p>\nTo run it all just double click the raspberry.bat file.\n<\/p>\n<h5>\n&quot;INIT: ID &quot;1&quot; respawning too fast: disabled for 5 minutes&quot;<br \/>\n<\/h5>\n<p>\nThis is probably due to the issue of the &quot;\/etc\/ld.so.preload&quot; file in new raspbian images. If you search on this error messages you&#39;ll find instructions on how to edit this file within the .img file. &nbsp;There&#39;s another way though, just setup your SD card as you normally would for the raspberry pi and run it in a raspberry pi. &nbsp; 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. &nbsp;You still need to edit the&nbsp;&quot;\/etc\/ld.so.preload&quot; 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 &quot;kernel panic&quot; apparently), so from the command line use:\n<\/p>\n<pre>\r\n<code>\r\nsudo nano \/etc\/ld.so.preload\r\n<\/code><\/pre>\n<p>\nNow insert a # as the start of the only line in there to comment it out, giving:\n<\/p>\n<pre>\r\n<code>\r\n#\/usr\/lib\/arm-linux-gnueabihf\/libcofi_rpi.so\r\n<\/code><\/pre>\n<p>\nUse CTRL+X to save and exit. &nbsp;Then use this before powering off:\n<\/p>\n<pre>\r\n<code>\r\nsudo halt\r\n<\/code><\/pre>\n<p>\nNow use&nbsp;Win32DiskImager&nbsp;to read the SD card and create an .iso image file. &nbsp;Copy this into the qemu directory used above, update the&nbsp;raspberry.bat file to use its name and hey presto you have raspbian on your desktop. &nbsp;There will be a few error messages as it boots due to hardware that isn&#39;t there, but it should load to the login prompt and be ready to go.\n<\/p>\n<h4>\nQEMU&nbsp;Tips<br \/>\n<\/h4>\n<p>\nTo exit the QEMU window and get your mouse back use CTRL+ALT or CTRL+TAB\n<\/p>\n<h4>\nRAM Size<br \/>\n<\/h4>\n<p>\nYou might be tempted to alter the .bat file &quot;-m 256&quot; to something more useful like &quot;-m 1024&quot;? &nbsp;You can&#39;t, you&#39;ll just get a black screen of nothing. &nbsp;The physical memory map on versatile hardware does not allow more than 256MB of space for RAM and as we&#39;re using the&nbsp;versatile&nbsp;kernel we can&#39;t have more.\n<\/p>\n<h4>\nNetworking<br \/>\n<\/h4>\n<p>\nQemu doesn&#39;t sort out an network bridge so you&#39;ve got to provide&nbsp;it yourself. &nbsp; The easy way to do this is using an OpenVPN &nbsp;&quot;TAP&quot;. &nbsp; Go to&nbsp;<a href=\"http:\/\/openvpn.net\/index.php\/download.html\" target=\"_blank\">http:\/\/openvpn.net\/index.php\/download.html<\/a> and select &quot;community downloads&quot; to get the the windows installer.\n<\/p>\n<p>\n1. Install it using the default options ensuring the the Install TAP interface option is selected.\n<\/p>\n<p>\n2. Go to the windows network and sharing centre and select the new &quot;TAP-Windows Adapter&quot; Local Area Connection. &nbsp;Right click and rename it to &quot;TAP0&quot;. &nbsp;Then right click and select properties.\n<\/p>\n<p>\nNow select the TAP0 interface&nbsp;and holding CTRL&nbsp;also select your primary local area connection. Then right click and select &quot;Bridge Connections&quot;. &nbsp; This will create a new &quot;Network Bridge&quot;. &nbsp;If you want to give it a fixed IP address you can edit its properties.\n<\/p>\n<p>\n3. Now edit the &quot;raspberry.bat&quot; file and add the following to the end of it:\n<\/p>\n<pre>\r\n<code>\r\n-net nic -net tap,ifname=TAP0\r\n<\/code><\/pre>\n<p>\nThis will give you something like this:\n<\/p>\n<pre>\r\n<code>\r\nqemu-system-armw.exe -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -hda my_rpi_image_name.img -append &quot;root=\/dev\/sda2 panic=1&quot; -net nic -net tap,ifname=TAP0\r\n<\/code><\/pre>\n<p>\nThat&#39;s it, save the file, double click it and when raspbian boots it will have an IP address on your local network.\n<\/p>\n<h4>\nDisplay Resolution<br \/>\n<\/h4>\n<p>\nQemu is limited to a max resolution of 800&#215;600. &nbsp;You can run the raspbian&nbsp;GUI in it fine, but who wants to at that resolution. &nbsp;To get round this you can just use remote desktop to give the full&nbsp;1920&#215;1080. &nbsp;\n<\/p>\n<pre>\r\n<code>\r\nsudo apt-get install xrdp\r\n<\/code><\/pre>\n<p>\nThis will install XRDP&nbsp;which allows you&nbsp;to use Remote desktop to remote into the qemu instance and&nbsp;get full monitor resolution.\n<\/p>\n<p>\nTo use it press the windows start button &gt; All programs &gt; Accessories &gt; Remote desktop connection. &nbsp;Enter your IP address and then the standard RPi login when prompted and you&#39;ll get a full size grey screen followed by the GUI.\n<\/p>\n<h5>\nSwitching between full screen and window mode in remote desktop<br \/>\n<\/h5>\n<p>\nUse CTRL+ALT+Break to toggle\n<\/p>\n<h4>\nCopy And Paste<br \/>\n<\/h4>\n<p>\nQemu doesn&#39;t allow you to copy and paste between the host OS and its virtual OS. &nbsp;There are tools which can do this but now that networking is setup you can just use your ffavorite&nbsp;SSH tool&nbsp;instead (e.g. FireSSH) which does support copy and paste and access the RPi command line that way. &nbsp;You&#39;ll also be able to get past the qemu&nbsp;tiny display resolution for the command line this way too.\n<\/p>\n<h4>\nInstall Eclipse<br \/>\n<\/h4>\n<p>\nsudo apt-get install eclipse\n<\/p>\n<p>\nThat&#39;s it, now marvel at how slow it is! &nbsp;Sorry see warning at the top of this page.\n<\/p>\n<h4>\nSpeeding QEMU up<br \/>\n<\/h4>\n<p>\nRaspbian&nbsp;has a swap file based solution instead of the &quot;standard&quot; swap-partition based solution. &nbsp;You can edit its setup using this from the command line:\n<\/p>\n<pre>\r\n<code>\r\nsudo nano \/etc\/dphys-swapfile \r\n<\/code><\/pre>\n<p>\nThe default value is 100MB, so change it to say 1024MB (assumign you have enough free disk space in your disk&nbsp;image)\n<\/p>\n<p>\n\u200bPress CTRL+X to save and exit and then reboot or use the following to use the new size:\n<\/p>\n<pre>\r\n<code>\r\n\/etc\/init.d\/dphys-swapfile stop\r\n\/etc\/init.d\/dphys-swapfile start<\/code><\/pre>\n<p>\nWe tried this but it made little difference for us :-(\n<\/p>\n<p>\n&nbsp;\n<\/p>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whilst you can technically run eclipse on the Raspberry Pi, in reality it doesn&#39;t have the power to make it usable. &nbsp;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80],"tags":[],"class_list":["post-1203","post","type-post","status-publish","format-standard","hentry","category-eclipse-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/1203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/comments?post=1203"}],"version-history":[{"count":22,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/1203\/revisions"}],"predecessor-version":[{"id":1205,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/1203\/revisions\/1205"}],"wp:attachment":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/media?parent=1203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/categories?post=1203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/tags?post=1203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}