Re: Emulating Raspberry Pi in Windows the easy way


145 posts   Page 1 of 6   1, 2, 3, 4, 5, 6
by mjlally » Fri May 11, 2012 7:34 pm
For anybody who isn't sure how to get qemu to emulate the Raspberry Pi in windows here is a zip folder to download.

Just download, extract all the contents and run the extracted run.bat file.

login is pi

password is raspberry

then type startx to get a window based desktop and it is ready to use.

There is a README.txt file for more information. The zip folder contains qemu for windows and the R Pi debian squeeze image. It works in Windows XP. I've only been able to test it briefly in Windows 7, seems to work. Should work in other versions of windows too.

Comments below deal with some issues such as changing keyboard layout.
Last edited by mjlally on Sun May 13, 2012 10:26 pm, edited 1 time in total.
Posts: 49
Joined: Thu May 10, 2012 9:08 pm
Location: Reading, UK
by bredman » Fri May 11, 2012 8:22 pm
Be very cautious of a first-time poster who tells you to download software to your Windows PC.

As a public service, I will try it on a disposable PC to see what my virus checker thinks.
Posts: 1413
Joined: Tue Jan 17, 2012 2:38 pm
by mjlally » Fri May 11, 2012 8:27 pm
Hi there Bredman, sorry, hadn't thought of that side of it! The link to the sourceforge page is http://sourceforge.net/project.....muwindows/

you can check the contents without running anything. I would be grateful if you did test it however and post your thoughts here afterwards.

Thanks MJL
Posts: 49
Joined: Thu May 10, 2012 9:08 pm
Location: Reading, UK
by bredman » Fri May 11, 2012 9:02 pm
I have tested it in Windows Vista and it seems to be working. I can't get to an external network, even though I can reach my gateway. This is my first time to use qemu, so that's something new for me to learn.

I got no warnings from a corporate-grade virus checker, so there are no obvious problems. Apologies to mjlally, but we have to be cautious.

For anybody waiting for hardware, this would be a great way to get a feel of the Raspberry Pi.

Warning: The download file size is 460MB.
Posts: 1413
Joined: Tue Jan 17, 2012 2:38 pm
by bredman » Fri May 11, 2012 9:12 pm
Apologies for the confusion above, networking is working OK.

The fault was between my chair and my keyboard. I forgot about some fairly aggressive security settings on my network.

There are some problems with colours, but this should not really impact the usability.
Posts: 1413
Joined: Tue Jan 17, 2012 2:38 pm
by mjlally » Fri May 11, 2012 9:12 pm
Thanks for the feedback Bredman, no need to apologise for being cautious, I should have thought of it myself.

Sorry about the size of the download, will see if I can strip out anything.
Posts: 49
Joined: Thu May 10, 2012 9:08 pm
Location: Reading, UK
by bredman » Fri May 11, 2012 9:15 pm
I forgot to say thanks to mjlally for the effort he has put in.

Making things dirt simple will help new people take the plunge.
Posts: 1413
Joined: Tue Jan 17, 2012 2:38 pm
by hippy » Sat May 12, 2012 2:29 am
mjlally said:


For anybody who isn't sure how to get qemu to emulate the Raspberry Pi in windows here is a zip folder to download.


You're a hero.

Worked as advertised. Win XP SP2.
Posts: 801
Joined: Fri Sep 09, 2011 10:34 pm
by Kphillis » Sat May 12, 2012 2:42 am
I was giving the emulation a try, and checked out the site. Would it be possible to place the code for Qemu on the website along with the possible compilation instructions?

Edit: I tried to use the basic shell commands and found the keyboard mapping is off... For example, when i ran the following command, the system failed to input this properly.

dmesg | less

This command instead of having the pipe operand "|", it wound up having the "#" key instead, and when i pressed "" it placed the wrong key yet again.

Posts: 8
Joined: Mon Apr 16, 2012 7:51 pm
by DuncanKennedy » Sat May 12, 2012 4:09 am
Kphillis - I"m having the same problem - I think it relates to the default keyboard mapping being set up to a British keyboard. There have been a number of other post about remapping the keyboard on actual Pi"s so assume it"s not related to the Qemu emulation.

I"m going to try the remap and see if that cures things. In the meantime, try all of your shift keys to see what they produce. On my keyboard shift-2 produces the " character, although haven"t found an equivalent for the pipe | character.

Duncan
Duncan
The mind is an infinite resource, provided you don't waste it!
Posts: 44
Joined: Sun Apr 22, 2012 3:35 am
by bredman » Sat May 12, 2012 7:02 am
On a UK keyboard, the pipe character is shifted on the key to the left of "z".
Posts: 1413
Joined: Tue Jan 17, 2012 2:38 pm
by mjlally » Sat May 12, 2012 10:35 am
Editing this post - I'm afraid my suggested fix as outlined below does not work. Read post 14 for Duncan's fix which does work.

ok, it looks like qemu for windows uses the uk keyboard layout by default.

In the extracted folder "RPi Emulation" there is a folder called "qemu".

Inside this there is another folder called "keymaps"

The available keymaps in this version of qemu are in here. NOTE, file names are all in lower case.

Back up one level in the qemu folder there is a batch file called "run.bat"

which has the single line

bin\qemu-system-arm.exe -M versatilepb -cpu arm1136-r2 -hda debian6-19-04-2012.img -kernel zImage_3.1.9 -m 192 -append "root=/dev/sda2"

edit the "run.bat" file in notepad and add "-k [keymap]" where keymap is the file name of your preferred keymap in the keymaps folder, as shown in the following examples..

For English US keyboard layout

bin\qemu-system-arm.exe -k en-us -M versatilepb -cpu arm1136-r2 -hda debian6-19-04-2012.img -kernel zImage_3.1.9 -m 192 -append "root=/dev/sda2"

For Italian keyboard layout

bin\qemu-system-arm.exe -k it -M versatilepb -cpu arm1136-r2 -hda debian6-19-04-2012.img -kernel zImage_3.1.9 -m 192 -append "root=/dev/sda2"

For Lithuanian keyboard layout

bin\qemu-system-arm.exe -k lt -M versatilepb -cpu arm1136-r2 -hda debian6-19-04-2012.img -kernel zImage_3.1.9 -m 192 -append "root=/dev/sda2"




I haven't tested this yet but will later once I get on a windows computer again. For now though it is a most glorious sunny morning here so I will off outside for the day!
Last edited by mjlally on Sat May 12, 2012 8:59 pm, edited 1 time in total.
Posts: 49
Joined: Thu May 10, 2012 9:08 pm
Location: Reading, UK
by dussel » Sat May 12, 2012 12:57 pm
@mjlally: My run.bat looks like this:

binqemu-system-arm.exe -k de -M versatilepb -cpu arm1136-r2 -hda debian6-19-04-2012.img -kernel zImage_3.1.9 -m 192 -append "root=/dev/sda2"

But if I try to start, it only says in bin/stderr.txt:
Could not read keymap file: 'de'
 
If I try it without the additional "-k de" parameter it runs fine.
 
@all
Is it possible to adjust the resolution of the screen qemu is emulating?
Posts: 1
Joined: Sat May 12, 2012 11:50 am
by DuncanKennedy » Sat May 12, 2012 5:00 pm
Ok - I"m running the Debian package. In order to get the keyboard fixes I used

sudo dpkg-reconfigure keyboard-configuration
sudo shutdown -r now

Once it rebooted my problem was resolved.

Duncan
Duncan
The mind is an infinite resource, provided you don't waste it!
Posts: 44
Joined: Sun Apr 22, 2012 3:35 am
by DuncanKennedy » Sat May 12, 2012 6:12 pm
Ok - on getting a better resolution in Qemu, I haven't found a working direct answer - however if you follow the instructions in;

http://www.raspberrypi.org/for.....vnc-server

This will walk you through setting up a vnc server (tight vnc) on the RPi and configuring it to support a 1920x1080 desktop, which works beautifully!

Note that for this to work, you have to have networking installed and running with a real ip address on your local network.

Duncan
Duncan
The mind is an infinite resource, provided you don't waste it!
Posts: 44
Joined: Sun Apr 22, 2012 3:35 am
by mjlally » Sat May 12, 2012 6:48 pm
Thanks Duncan.

Your keyboard fix seems to be the easiest way around it.

Haven't had a chance to look at resolution yet.
Posts: 49
Joined: Thu May 10, 2012 9:08 pm
Location: Reading, UK
by Kphillis » Sat May 12, 2012 9:43 pm
I gave some locale configuration a try, and it still resists fixing my keyboard layout... Anyways, Here's a step by step I tried:

Code: Select all
step 1) Run the Virtual machine, and login.
step 2) Run the following command
sudo dpkg-reconfigure locales

step 3) Find the Locale you have, and in my case, I scrolled down and pressed space on
"en_US.UTF-8 UTF-8"
"en_US ISO-8859-1"

step 4) Press return, this list should be short, and for this list, Select the new entries.

step 5) press return after you select the default locale.

step 6) Be patient... This step can take a while, but let the Locales be regenerated.

step 7) Run the following command:
sudo dpkg-reconfigure keyboard-configuration

step 8) select the appropriate keyboard. Most users can get away with selecting "Generic 105-key (intl) PC" for most modern desktop computers.

step 9) Select the setting in the list if your lucky... If not select "Other".

step 10) select your country. In my case I will use "USA"
step 11) Now select your keyboard Layout. Most generic Keyboards in the United states use USA.
step 12) This step is asking about what modifications to the Function keys are made... In this case I recommend selecting "The default for the keyboard layout" option if you have no idea as to what these mean.
step 13) This step is asking about the Combination keys... Generally this can be left alone safely.
step 14) This step asks if you want to terminate the xserver. For the most part I would just click OK.

step 15) test the keyboard settings a bit... If they do not work, redo steps 7 to 14.

step 16) if this still does not fix the problem, shutdown the system with, and procede to steps 17 to 20.
sudo shutdown -h now

step 17) Open up the run.bat file in the main folder for qemu, and look for the line that says: ( if the file does not have this line, you got the wrong folder )

bin\qemu-system-arm.exe -M versatilepb -cpu arm1136-r2 -hda debian6-19-04-2012.img -kernel zImage_3.1.9 -m 192 -append "root=/dev/sda2"

step 18) add the region specific keymap setting to the list of arguments... In my case I add the following at the end:

-L . -k en-us

step 19) After saving the Run.bat changes, the line should look somethin like this:

bin\qemu-system-arm.exe -M versatilepb -cpu arm1136-r2 -hda debian6-19-04-2012.img -kernel zImage_3.1.9 -m 192 -append "root=/dev/sda2" -L . -k en-us

step 20) restart from step 1, and skip steps 2 through 6 ( these should be fine )
Posts: 8
Joined: Mon Apr 16, 2012 7:51 pm
by ScoobyDoo » Sat May 12, 2012 9:45 pm
Thanks, works perfectly on windows 7 64bit.
I've managed to test out some packages that i wish to use when my pi arrives and they are installing and working
Great
User avatar
Posts: 65
Joined: Wed Apr 04, 2012 2:52 pm
Location: Staffordshire, UK
by Joe Schmoe » Sat May 12, 2012 10:35 pm
Just out of curiosity, why do you have to change the QEMU command line (adding the -L and -k options)? I.e., if it was working OK inside the emulation (once you did the various dpkg reconfigure thingies), why would you need to exit, change the command line, and re-run QEMU?

In any case, it worked fine for me, once I made the changes inside the image - I didn't have to add those options to the command line.
Never answer the question you are asked. Rather, answer the question you wish you had been asked.

- Robert S. McNamara - quoted in "Fog of War" -
Posts: 2675
Joined: Sun Jan 15, 2012 1:11 pm
by Vindicator » Sun May 13, 2012 12:14 am
The last 3 steps were if the previous way did not work.
If you are more worried about ,spelling, punctuation or grammar you have probably already missed the point so please just move on.
User avatar
Posts: 314
Joined: Sat Sep 17, 2011 11:10 pm
Location: Susanville Ca USA
by Kphillis » Sun May 13, 2012 3:34 am
Joe Schmoe wrote:Just out of curiosity, why do you have to change the QEMU command line (adding the -L and -k options)? I.e., if it was working OK inside the emulation (once you did the various dpkg reconfigure thingies), why would you need to exit, change the command line, and re-run QEMU?

In any case, it worked fine for me, once I made the changes inside the image - I didn't have to add those options to the command line.


The -L option changes the directory qemu searches for keymaps, and other elements in. As for the -k option, that changes the keyboard. Also, the last steps where in case the first set of steps did not work. It's not always guaranteed that things will fix without changing the settings of qemu itself.

Vindicator wrote:The last 3 steps were if the previous way did not work.


That's Correct. Also, the last 3 steps could mean the difference between having he keyboard replace "|" with "#", and also, I might also want to recommend looking at the pc104 keyboard too.
Posts: 8
Joined: Mon Apr 16, 2012 7:51 pm
by mjlally » Sun May 13, 2012 11:55 am
Joe Schmoe wrote:Just out of curiosity, why do you have to change the QEMU command line (adding the -L and -k options)?


Hi Joe, from my perspective it would be better if I could resolve the keyboard problem at the QEMU side of things, I could just have several different .bat files, one for each keyboard layout, which end users could download depending on the keyboard they needed. I'd like to keep it as simple and straightforward to use as possible.
Posts: 49
Joined: Thu May 10, 2012 9:08 pm
Location: Reading, UK
by n3tw0rk5 » Mon May 14, 2012 12:28 pm
Quick question, why is the virtual ram set to 192mb? Is this to mimic the cpu/gpu ram split or does it need to be 256mb to match the RasPi?
User avatar
Posts: 216
Joined: Fri Jan 06, 2012 6:04 pm
by mjlally » Mon May 14, 2012 7:44 pm
n3tw0rk5 wrote:Quick question, why is the virtual ram set to 192mb? Is this to mimic the cpu/gpu ram split or does it need to be 256mb to match the RasPi?


Hi there, as far as I am aware, the default cpu/gpu split on the model B is 192/64 but I haven't got a real RPi to play with yet so I don't know for sure if that is actually the case..
Posts: 49
Joined: Thu May 10, 2012 9:08 pm
Location: Reading, UK
by guachinver » Tue May 15, 2012 3:40 pm
I'm an absolute beginer with Debian, Qemu, and Raspberry pi
Suiving the instructions of this thread for obtain a good Keymap I have had a 90% of successful, Windows Vista Spanish and spanish keyboard. Thanks a lot I'll try to remap 6 bad keys.
Another problem:
When, from the console run startx, the graphic windows load but I lose the mouse control and obtain an annoying message:

"QEMU - Pres Ctrl-Alt to exit muse grab"

Yes, pressing Ctrl-Alt the mouse is now controlled,for windows vista, but when you clic on emulation window the cursor mouse go to top left of emulator window with losted control- The message appears.
Please, some idea?
Posts: 17
Joined: Fri Mar 30, 2012 7:37 am