You can emulate the raspberry pi on your Windows Computer with QEMU. It will not have the extension pins, no sound and some other restrictions: It will simulate Raspberry 1 hardware, have only 256 Mbytes of RAM and only one core. It will have network connections and you can easily change the installed software. However it is slow and unless raspi2/3 emulation is not updated to include network and mouse and keyboard support its not useful for this course at this time. The purpose of this effort was to figure out how to easily create an updated software image for distribution to the class. However its easier to use the real hardware.
1. Download latest version of QEMU for windows and install it from https://www.qemu.org/download/#windows
2. Download latest version of Raspian from https://downloads.raspberrypi.org/raspbian_latest
3. Download latest Raspberry Pi Kernel from https://github.com/dhruvvyas90/qemu-rpi-kernel e.g. kernel.qemu-4.14.50-stretch
4. From same place also download latest versatile-pb.dtb
5. Download OpenVPN from https://openvpn.net/community-downloads/. Run the installation and only install the TAP driver.
6. Unzip the raspian image file.
7. Copy the image file, the kernel and the dtb to the QEMU directory. Make those files writable using windows file properties/security.
8. Open the network settings by opening the Control Panel\All Control Panel Items\Network and Sharing Center and then Change Adapter Settings. Rename your new adapter TAP. On your wireless adapter select properties then sharing, then enable allow other users to connect through this connection and in the list of users select TAP. This will allow your wireless internet connection be used by the raspberry emulator.
9. Run the emulator with:
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -dtb versatile-pb.dtb -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -drive "file=image.img, index=0,media=disk" -net nic -net tap,ifname=TAP10. Fix some settings in the raspberry installation by logging in with pi/raspberry as username/pw and then open a terminal/shell and type:
sudo nano /etc/udev/rules.d/90-qemu.rulesIn that file you need to add the following:
KERNEL=="sda", SYMLINK+="mmcblk0"KERNEL=="sda?", SYMLINK+="mmcblk0p%n"KERNEL=="sda2", SYMLINK+="root"11. Overclock the CPU
In a terminal windowsudo raspi-config12. Change the disk size so that it expands to the full size :
Expand the image by adding extra space: qemu-img.exe resize image.vhd +5G13. Increase the swap size:
sudo nano /etc/dphys-swapfile14. Increase screen resolution
open file /etc/X11/app-defaults/Editresand edit the 2 lines to your desired resolution:*porthole.tree.width: 1280*porthole.tree.height: 102416. Start the simulator with:
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -smp 1 -M versatilepb -dtb versatile-pb.dtb -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -drive "file=image.img,index=0,media=disk,format=raw" -net nic -net tap,ifname=TAPComments:
Much information is from https://blogs.msdn.microsoft.com/iliast/2016/11/10/how-to-emulate-raspberry-pi/