Raspberry Pi Emulator for Windows 10

141,604

128

28

Introduction: Raspberry Pi Emulator for Windows 10

About: I'm a YouTube Maker and Creator who loves to find ways outside of the box to create and use things. My primary mission is to teach what I have learnt in the simplest way possible to all human kind. Follow me o…

In this article, you are going to learn how to run Raspbian on your Windows 10 PC.

If you really enjoy this article, consider checking out my TechWizTime YouTube Channel.

And for an awesome source of Raspberry Pi Accessories, check out my Raspberry Pi Amazon List.

Let’s get started!

Step 1: What You'll Need

  1. QEMU
  2. Compatible Kernel
  3. Raspbian
  4. Windows 10
  5. Keyboard
  6. 7Zip

Step 2: Download QEMU

Go to http://qemu.weilnetz.de/w32/

Select the 32-bit folder.

Click on the version with the most recent modify date.

When it downloads, use 7zip to extract it’s contents into a folder.

Step 3: Download the Kernel

Go to https://github.com/dhruvvyas90/qemu-rpi-kernel

Select the most recent file.

Click on the “Download” at the left of “History”

After it downloads, place the file inside the folder where you extracted the QEMU.

Step 4: Download Raspbian

Go to http://downloads.raspberrypi.org/

Click on “Downloads” Select “Raspbian”

Download the Pixel desktop version.

After it downloads, extract the contents on the same folder where you extracted QEMU.

Step 5: Set Up the Emulator

Get inside the folder where you extracted Raspbian, QEMU and placed the Kernel.

Create a new text file and name it “start.bat”

Right click on it and press “Edit”

Type in “qemu-system-arm -kernel kernel-qemu-4.4.34-jessie -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append “root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash” -drive “file=2017-03-02-raspbian-jessie.img,index=0,media=disk,format=raw” -redir tcp:2222::22″

Save the file and close it.

Type “cmd” on the address bar to start up the command prompt.

In the command prompt, type “start.bat”

Type in “sudo nano /etc/udev/rules.d/90-qemu.rules” Press “Enter” Type in “KERNEL==”sda”, SYMLINK+=”mmcblk0″ KERNEL==”sda?”, SYMLINK+=”mmcblk0p%n” KERNEL==”sda2″, SYMLINK+=”root””

Press “Ctrl X” “Y” “Enter”

Close the emulator.

Go to the “start.bat” file.

Delete the line “init=/bin/bash””

Save and close the file.

In the cmd, type in “qemu-img.exe resize 2017-03-02-raspbian-jessie.img +4G”

Press “Enter”

A small error will appear, but the resizing will take effect.

Type in “start.bat”

Press “Enter”

Step 6: Optimize the Emulator

Once it loads, open up the Terminal.

Type in “sudo fdisk/dev/sda”

Press “Enter”

Type “P”

Press “Enter”

Type “D”

Press “Enter”

Type “2”

Press “Enter”

Type “N”

Press “Enter”

Type “P”

Press “Enter”

You’ll be asked for the first sector of the partition, type in the number you see on the first partition +1. IE: 20298 + 1 = 20299

Press “Enter”

When it ask for the last sector, press “Enter” to use the whole ammount of the image.

Type “W”

Press “Enter”

You’ll get a message stating that the creation of the partition failed, shut down the emulator for the changes to take effect.

In the cmd, start the emulator by starting the “start.bat” file.

Get inside the Terminal of Raspbian once it loads.

Type in “sudo resize2fs /dev/sda2”

Press “Enter”

A message will appear saying that the partition rezise was successful.

Type in “sudo nano /etc/dphys-swapfile”

Press “Enter”

Go down to where it says “conf_swapsize=100” and change the “100” to “1024”

Press “Ctrl X” “Y” and “Enter”

Type in “sudo /etc/init.d/dphys-swapfile stop”

Press “Enter”

Type in “sudo /etc/init.d/dphys-swapfile start”

Go to “Raspberry Pi Configuration”

Click on “Enabled”

Locate “SSH” and press “Enable”

Click on “Performance”

On “Overclock”, select “Tubo (1000GHz)”

EXTRA: You can go to Localization and select your country of residence or the country you prefer and then click on “Keyboard” to change your keyboard settings.

Press “OK” to save all of your changes.

Shut down the Emulator.

Open it again via cmd using the “start.bat”

If you turned on SSH, you’ll see a warning, click on “Yes”

Congratulations, you’ve just installed Raspbian on your Windows 10 PC via QEMU, configured it, optimized it and that’s it for this Instructable.

If you enjoy this Instructable, consider checking out my TechWizTime YouTube Channel.

And for a good source of Raspberry Pi products, check out my Raspberry Pi Amazon List.

Be the First to Share

    Recommendations

    • Make It Modular: Student Design Challenge

      Make It Modular: Student Design Challenge
    • Woodworking Contest

      Woodworking Contest
    • Stick It Challenge

      Stick It Challenge

    28 Comments

    0
    AnisB15
    AnisB15

    Tip 11 months ago

    Here's the run command: (be sure to download the versatile-pb-buster-5.4.51.dtb from the github repo)

    qemu-system-arm ^
    -M versatilepb ^
    -cpu arm1176 ^
    -m 256 ^
    -drive "file=2021-05-07-raspios-buster-armhf-full.img,if=none,index=0,media=disk,format=raw,id=disk0" ^
    -device "virtio-blk-pci,drive=disk0,disable-modern=on,disable-legacy=off" ^
    -net "user,hostfwd=tcp::5022-:22" ^
    -dtb versatile-pb-buster-5.4.51.dtb ^
    -kernel kernel-qemu-5.4.51-buster ^
    -append "root=/dev/vda2 panic=1 rootfstype=ext4 rw init=/bin/bash" ^
    -no-reboot

    0
    ahmedelswerkey
    ahmedelswerkey

    Reply 11 months ago

    Thank you very much, I've been trying with this bat code for 3 days with no progress
    and then I saw your comment and it worked

    can i use a bigger memory and higher cpu?

    0
    AnisB15
    AnisB15

    Reply 11 months ago

    Edit the append line as follows if you get a crash
    -append "root=/dev/vda2 panic=1" ^

    And if SSH doesn't work, update the -net "user..." line as follows:
    -net user,hostfwd=tcp::2222-:22 ^
    -net nic ^

    0
    stephen.parish57
    stephen.parish57

    11 months ago

    This is just typical Linux junk. Why can't the instructions above be put together into a single Windows executable? Then you would download and run RaspberryPi.exe, with no hassle, people who have never used a Raspberry Pi would be able to try it out and see what the desktop looks like, and it would be a good advertisement for the product.

    This, on the other hand is counterproductive. 4 separate downloads, a whole bunch of complicated command line instructions, and an end result that doesn't actually work, except for the Linux geek who wrote it. It just maintains the Raspberry Pi's reputation as a hard to use product for geeks only.

    0
    amihart
    amihart

    11 months ago

    You can't emulate the Raspberry Pi. QEMU has no capabilities of doing so. You are just emulating a generic ARM machine which is similar enough to the Pi to boot the OS, but if you run any programs that use the Pi's actual hardware, like its GPU, it will crash. It has no capabilities of emulating anything specific to the Pi so you can hardly even say you are "emulating the Raspberry Pi".

    0
    g-sanders
    g-sanders

    1 year ago

    5/17/2021 -- tried all of this multiple times and I tried latest versions and versions from original post -- I could not get it to work. I think these instructions are outdated and need updating.

    Ugh.png
    0
    akhil_2524
    akhil_2524

    1 year ago

    I tried to use the camera to take pictures using sudo raspistill -o image.jpg and I got " failed to open vchiq instance " (even though I enabled the camera and added my username to video group) can anyone please tell me how to use my webcam to take pictures?

    0
    virenghone37
    virenghone37

    1 year ago

    i am not being able to open batch file

    problem.PNG
    0
    sigowww
    sigowww

    Reply 1 year ago

    try to use "-net user,hostfwd=tcp::2222-:22" instead of "-redir tcp:2222::22″ and retype " signs

    0
    0799967
    0799967

    1 year ago

    Great post!! But that partitioning stuff, still working on it. But good which i can use. Please post more!! LOL!

    0
    vOOda
    vOOda

    3 years ago

    The post is very outdated ...

    0
    NikColAI
    NikColAI

    Reply 2 years ago

    Have you made updated version of it?
    Thanks.

    0
    alfredlgophiri
    alfredlgophiri

    Reply 1 year ago

    Where is the updated version I will appreciate

    0
    rulet5
    rulet5

    1 year ago

    C:\files1\qemu>qemu-system-arm -kernel kernel-qemu-4.19.50-buster -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda 2020-05-27-raspios-buster-full-armhf.img
    qemu-system-arm: warning: GdkPixbuf: Cannot open pixbuf loader module file 'C:\files1\qemu\lib\gdk-pixbuf-2.0\2.10.0\loaders.cache': No such file or directory

    This likely means that your installation is broken.
    Try running the command
    gdk-pixbuf-query-loaders > C:\files1\qemu\lib\gdk-pixbuf-2.0\2.10.0\loaders.cache
    to make things work again for the time being.
    WARNING: Image format was not specified for '2020-05-27-raspios-buster-full-armhf.img' and probing guessed raw.
    Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
    Specify the 'raw' format explicitly to remove the restrictions.
    dsound: Could not initialize DirectSoundCapture
    dsound: Reason: No sound driver is available for use, or the given GUID is not a valid DirectSound device ID

    Error: invalid dtb and unrecognized/unsupported machine ID
    r1=0x00000183, r2=0x00000100
    r2[]=05 00 00 00 01 00 41 54 01 00 00 00 00 10 00 00
    Available machine support:

    ID (hex) NAME
    ffffffff Generic DT based system
    ffffffff ARM-Versatile (Device Tree Support)

    Please check your kernel config and/or bootloader.

    C:\files1\qemu>


    0
    Lodbrok
    Lodbrok

    3 years ago

    Regarding “sudo fdisk /dev/sda”
    After doing this part I get
    "No filesystem could mount root, tried: ext4
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,2)"

    Does anyone know how to get out of that hole, and even better, what to do instead?

    0
    VladivariusV
    VladivariusV

    3 years ago

    I needed to do this emulation so many times, I created a small program to do it in one click! I also thought that other people would find it useful so I put on a website for it. You can find it here:

    http://www.rpi-emulator.com/

    0
    PavelS113
    PavelS113

    Reply 3 years ago

    your website is dead now :-(

    0
    nerduw
    nerduw

    Reply 3 years ago

    Hey mate, your program is working fine for me. Thanks for that! Your next coffee is on me ;-). Cheers.

    P.S.: Unfortunately, I wasn't able to use this instruction here with "2017-11-29-raspbian-stretch-lite.img". Only VladivariusV script did the trick.