Advanced Search | Customer Care | NCIXUS Forums |
Newsletters | Contact Us | Your Account | VIEW CART  
 Welcome 
 Hot Deals 
 NCIX PC 
 Forums 
  CANADA |  USA
Hot Topics  |  Latest Postings  |  View Unreplied  |  Forum Bookmarks
 LATEST TOPICS |  FORUMS » LINUX » HOW TO: EMULATE RASPBERRY PI ON WINDOWS ...
Subject: How To: Emulate Raspberry Pi on Windows 7
Share this:  
Author Date Posted Tools
Wall Dec 31, 2012 10:47 PM Reply | Bookmark
Like (5) | Top | Bottom

So, after struggling with getting qemu running how I wanted to over the weekend, thought I would put up this how to guide, use it as you will.

After this guide you will have the following:
Raspberry Pi Emulator, with Raspbian "wheezy"
1920x1080 resolution
as much extra space as you require.

So far from my tests, there are some difficulties, some things just do not work as they should, but there are ways around them.

First of all, you will need a program called "Qemu". There is a pre-built version, already good to go with Raspbian, will just need to tweak it. You can grab it from sourceforge at: http://sourceforge.net/projects/rpiqemuwindows/ This contains everything to just run Raspbian, the rest of this tutorial will cover getting more disk space available (Stock it has about 350 mb free), 1920x1080 resolution (Qemu is limited to a max resolution of 800x600), and how to get full access to your LAN.

As soon as you have it downloaded, and backed up we need to increase the size of the .img file, this acts as your virtual SD card. Open up a command prompt (Start>Search>CMD) you then want to CD to the directory of qemu. Just run CD C:usersusernamedownloads or wherever you extracted the .zip.

As soon as you have CD'ed to this directory, you want to run the following command:
qemu-img resize 2012-07-15-wheezy-raspbian.img 3.7G
Where 3.7G is the final size of the disk, 3.7G means this image could be moved over too an actual raspberry Pi on a 4GB SD Card.

Once this has been resized, go ahead and double click the "run.bat" file, may just be labelled as "run".

Wait till you see a blue screen, with some options. If you try to click the "expand rootfs" option, it will just kick back an error, so we need to trick raspbian a bit. Go ahead an set your timezone, do not worry about keyboard or anything yet, it gets fixed later on. You should run the update , it will update  raspi-config. Once the update  is done, just type "sudo raspi-config" to get back into the config screen. If you plan on using it for video, change the memory split to 128/128. This means that 128MB of RAM will be for CPU, and 128MB for GPU. Now, click on boot behaviour, and set it too boot into X. Now go ahead and hit tab, then finished to restart raspbian.

Once you have a pretty desktop like the below image:

http://imageshack.us/a/img825/5186/desktopttm.jpg

Go ahead and double click on LXTERMINAL

Once terminal opens, run the following commands to trick raspi-config into expanding the root FS:

cp /usr/bin/raspi-config ~
sed -i 's/mmcblk0p2/sda2/' ~/raspi-config
sed -i 's/mmcblk0/sda/' ~/raspi-config

I enter them one line at a time, but you can open this up in a Midori, and copy and paste to terminal.

Those should take no time at all (If done right, you should just get another $, another note, I need to press shift (Or |) to do a proper ~ in qemu)

Now, type:
sudo ~/raspi-config

Run the Expand RootFS again, should complete, if it returns an error, retype those commands exactly as they are.

If it completes with no errors, click finish on the blue raspi-config screen (Tab-Finish)

So now we have a decently large Disk to work with in raspbian, now for the fun part.... Getting external network access (Not just HTML, but full network ability with a local IP Address)

This is done using a TAP. I just used the most recent community release of OpenVPN which installs a TAP Network interface. http://openvpn.net/index.php/download.html Scroll down to community downloads,and grab the windows installer.

Install OpenVPN, I did not actually configure it, we just need the TAP network interface. Ensure that the Install TAP interface is select ed during the installation.

Now that we have a TAP interface, we want to go into Network and sharing centre, then change adapter settings. You should now have a new TAP Network interface, go ahead and rename  this too "TAP0" (No quotes). Now select  the TAP0 interface, and select  your primary NIC (This can be done with Ctrl-Left Click) once both are highlighted, right click and select  "Bridge Interfaces"

Once they are both bridged, right click on this new bridge, right click the bridge, click properties, then double click on Internet Protocol Version 4 (TCP/IPv4), give it a static IP for your local network (You might also be able to leave this as Obtain IP address automatically, but I have most of my devices on static IP's and did not test it that way)

Once it has a static IP you can close out of all of that.

Head back over to the folder with the run.bat file in it (The folder with a bunch of qemu applications) right click on it, and select  "edit" or just open it in notepad.

You will see something like this:
qemu-system-arm.exe -M versatilepb -cpu arm1176 -hda 2012-07-15-wheezy-raspbian.img -kernel kernel-qemu -m 192 -append "root=/dev/sda2"

We need to add the following like:
-net nic -net tap,ifname=TAP0

Will look like this when finished:
qemu-system-arm.exe -M versatilepb -cpu arm1176 -hda 2012-07-15-wheezy-raspbian.img -kernel kernel-qemu -m 192 -append "root=/dev/sda2" -net nic -net tap,ifname=TAP0

Save this, and go ahead and double click the run.bat batch file to start qemu. Once it is started, double click LXTERMINAL and type in: "sudo ifconfig" Check the second line for your inet address, is it getting a local IP address? If it is, then the TAP is configured properly, and your emulator has LAN access.

OPTIONAL: Setting Static IP in Raspbian
Setup your IP address by typing the following command:
sudo nano /etc/network/interfaces

Go ahead and erase everything in there, and replace it with:
auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx

Once you get it all typed out, press "Ctrl-O" and hit enter, then type "Ctrl-X" to exit nano.

Now that you are back at terminal, type "sudo apt-get install xrdp" this will install XRDP allowing us to use Remote desktop to remote into the Qemu instance, so we can get our full monitor resolution.

Once it is finished, go ahead and type "sudo shutdown -r now" to restart raspbian.

Once you are back at the desktop, open up LXTERMINAL, type "sudo-ifconfig" write down your IP address.

Now go back to windows (Ctrl+tab, or ctrl+alt to release mouse), go to start menu>all programs>accessories>remote desktop connection.

Once this is open, type in the IP address you wrote down from the "sudo-ifconfig", and hit enter. You should be looking at a dull grey login screen. Username is "pi" password is "raspberry" unless you changed it in raspi-config. hit login, and you should now have full monitor resolution! You can go ahead and start fiddling with stuff, installing etc...

If for whatever reason you want to start from semi-scratch, just extract the .img file from the zip file, and overwrite the modified one, then just follow the steps above again to resize it + static IP's. Everything else should still be the same.


If you have any questions, I can try to answer them, I am by no means a Linux guru, or a Raspbian Pi guru, but I have been through hell and back over the weekend to get this up and running.

Also, thanks for reading this guide, was written while slightly inebriated on new years eve, while bored out of my mind (GF Has her friend over, playing video games, so I needed to kill an hour till midnight)


Happy New years Ncix!

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

Tip Posting | My Postings () | My Reviews () | View Source


Call Queue
Now Serving
Closed
Avg. Response Time
Closed
Request Call Back
(Web Orders Only)

All Time Experts
1. Mr. Friendly™ (51387)
2. The Wizard (39824)
3. death_hawk™ (35144)
4. Not An Expert (26343)
5. Lance W (25246)
 
Featured Brands:
Shop by brands
Your Order Company Info Memberships Services Hotlinks
Customer Care
Order Status
About NCIX
Contact Us
Careers
Terms & Conditions
Branding & Logos
Privacy Policy
NCIX Rewards
Premier Partner Reseller
Affiliate Program
NCIX Gift Cards
Online Price Match
NCIX Newsletters
Facebook
YouTube
Twitter
Forums
International Sites: United States Canada
Copyright© 2015 - NCIXUS.com/NCIXUS Technology Inc. All rights reserved.