Install QEMU for 64-bit Windows 10
- Go to the following web site https://www.qemu.org/download/ and download the latest QEMU installer for Windows 64bit.
- Run the installer.
The QEMU executable files are installed, e.g. C:\Program Files\qemu\
- Go to the following web site https://github.com/dhruvvyas90/qemu-rpi-kernel and download a suitable kernel, e.g. kernel-qemu-4.4.34-jessie.
- Place the kernel file in a folder e.g. D:/Temp/raspbian/kernel-qemu-4.4.34-jessie
- Go to the following web site http://downloads.raspberrypi.org/raspbian/images/ and download the latest image e.g. 2019-06-20-raspbian-buster.zip
- Unzip the image file into a folder, e.g. D:/Temp/raspbian/2019-06-20-raspbian-buster.img
- Run a text editor.
- Type in the following lines.
"c:\Program Files\qemu\qemu-system-arm.exe" ^
-kernel kernel-qemu-4.4.34-jessie ^
-cpu arm1176 ^
-m 256 ^
-M versatilepb ^
-serial stdio ^
-append "root=/dev/sda2 rootfstype=ext4 rw" ^
-hda 2019-06-20-raspbian-buster.img ^
-net nic ^
-net user,hostfwd=tcp::5022-:22 ^
-no-reboot
Note: rename the kernel and image file names (in bold) to match the downloaded file names accordingly. - Save as a bat file e.g. run_raspbian.bat and close the editor.
Thank you for this tutorial!
ReplyDeleteYou absolutely ROCK for this tutorial. In my case I had to add the -dtb parameter with the compiled device tree. After that, the latest Buster release cranked right on up. Thank you VERY much for this! -- Chuck
ReplyDeleteyou are the Best akmost ,all other Tutorials are outdated
ReplyDeleteC:\Temp\raspbian>"C:\Program Files\qemu\qemu-system-arm.exe" -kernel kernel-qemu-4.19.50-buster -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda 2020-05-27-raspios-buster-full-armhf.img -net nic -net user,hostfwd=tcp::5022-:22 -no-reboot
ReplyDeleteWARNING: 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.
PS C:\Temp\raspbian>
You'll have to add dtb file asking with the kernel and invoke in the qemu command
DeleteTry this:
ReplyDelete"c:\Program Files\qemu\qemu-system-arm.exe" ^
-kernel kernel-qemu-4.19.50-buster ^
-cpu arm1176 ^
-m 256 ^
-M versatilepb ^
-serial stdio ^
-append "root=/dev/sda2 rootfstype=ext4 rw" ^
-hda 2020-02-13-raspbian-buster.img ^
-dtb versatile-pb-buster.dtb ^
-net nic ^
-net user,hostfwd=tcp::5022-:22 ^
-no-reboot
Hi,
ReplyDeleteDo you know how to configure this to emulate raspi 3B+?
Thanks
dominoc925, it says this:
ReplyDeleteD:\Downloads\Captive Portal OS Project\Emulator>"D:\Other Programs\qemu\qemu-system-arm.exe" -kernel kernel-qemu-4.19.50-buster -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda 2020-02-13-raspbian-buster.img -dtb versatile-pb-buster.dtb
WARNING: Image format was not specified for '2020-02-13-raspbian-buster.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.
Couldn't open dtb file versatile-pb-buster.dtb
D:\Downloads\Captive Portal OS Project\Emulator>-net nic -net user,hostfwd=tcp::5022-:22 -no-reboot
'-net' is not recognized as an internal or external command,
operable program or batch file.
Hi @ThatAverageCodist, for the latest kernel you have to download versatile-pb-buster.dtb from the kernel repo https://github.com/dhruvvyas90/qemu-rpi-kernel
ReplyDeleteHi, thanks for this!
ReplyDeleteI assume changing "-m 256 ^" for "-m 1024 ^" will set 1GB of ram, is it true?
In the other hand, how can I set e.g. 10 or 15 GB for disk usage?
Hi @Felipe Arce, yeah -m defaults to mega but you can use optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-and exabytes for clarity too.
ReplyDeleteI'm not sure whether I can change the allocated Raspbian disk image usage size; I would think you'd need to add in another disk image. Needs some investigation.
@dominoc925 I just tried to asign more ram, but it seems that it is not posible because versatilepb board is limited to 256MB RAM. You know how to avoid this?
ReplyDeleteHello, my update config:
ReplyDelete"c:\Program Files\qemu\qemu-system-arm.exe" ^
-kernel kernel-qemu-4.19.50-buster ^
-dtb versatile-pb-buster.dtb ^
-cpu arm1176 ^
-m 256 ^
-M versatilepb ^
-serial stdio ^
-append "root=/dev/sda2 rootfstype=ext4 rw" ^
-hda 2020-02-13-raspbian-buster.img ^
-net nic ^
-net user,hostfwd=tcp::5022-:22 ^
-no-reboot
;-)
Hello, can you explain how I can configure a network in qemu with Windows 10?
ReplyDelete"c:\Program Files\qemu\qemu-system-arm.exe" -kernel kernel-qemu-4.4.34-jessie -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda 2020-02-05-raspbian-buster.img -dtb versatile-pb-buster.dtb -net nic -net user,hostfwd=tcp::5022-:22 -no-reboot
ReplyDeleteThe system cannot find the path specified.
Hey i'm facing this issue , can anyone tell me whats wrong . I tried checking the path . Its all correct.
? @Unknown, at first glance, the command line seems fine. Try troubleshooting the options.
ReplyDeleteAre you able to run the qemu-system-arm.exe by itself - that should print out some help messages. If so, add in more options and run again.
I want to emulate latest raspbian (2020-08-20-raspios-buster-armhf.img).i want to use 5.4 kernel.
ReplyDeletewhat will be the command for version 5.4 kernel?
This is my batch file:
ReplyDelete"c:\Program Files\qemu\qemu-system-arm.exe" ^
-kernel kernel-qemu-5.4.51-buster ^
-cpu arm1176 ^
-m 256 ^
-M versatilepb ^
-serial stdio ^
-append "root=/dev/sda2 rootfstype=ext4 rw" ^
-hda 2020-08-20-raspios-buster-armhf-lite.img ^
-dtb versatile-pb-buster.dtb ^
-net nic ^
-net user,hostfwd=tcp::5022-:22 ^
-no-reboot
The Raspberry VM starts but I get the following error:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper Tainted: G W 5.4.51 #1
Hardware name: ARM-Versatile (Device Tree Support)
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (panic+0xe4/0x2d8)
[] (panic) from [] (mount_block_root+0x1f0/0x2b4)
[] (mount_block_root) from [] (prepare_namespace+0x15c/0x1bc)
[] (prepare_namespace) from [] (kernel_init+0x8/0xe8)
[] (kernel_init) from [] (ret_from_fork+0x14/0x2c)
Exception stack(0xcf825fb0 to 0xcf825ff8)
5fa0: 00000000 00000000 00000000 00000000
5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
@Roel Janssens - I'm seeing the same thing.
ReplyDeleteme too
ReplyDeleteKernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.50+ #1
Hardware name: ARM-Versatile (Device Tree Support)
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (panic+0xc8/0x240)
[] (panic) from [] (mount_block_root+0x1dc/0x2a8)
[] (mount_block_root) from [] (mount_root+0xfc/0x140)
[] (mount_root) from [] (prepare_namespace+0x168/0x1c8)
[] (prepare_namespace) from [] (kernel_init_freeable+0x174/0x1bc)
[] (kernel_init_freeable) from [] (kernel_init+0x8/0xe8)
[] (kernel_init) from [] (ret_from_fork+0x14/0x2c)
Exception stack(0xcf831fb0 to 0xcf831ff8)
1fa0: 00000000 00000000 00000000 00000000
1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
Rebooting in 1 seconds..
With this https://howtoraspberrypi.com/download/raspbian_lite_latest.zip image
ReplyDeleteand this file:
"...\qemu-system-arm.exe" ^
-M versatilepb ^
-cpu arm1176 ^
-m 256 ^
-net nic ^
-net user,hostfwd=tcp::5022-:22 ^
-serial stdio ^
-drive "file=...2020-12-02-raspios-buster-armhf-lite.img,if=none,index=0,media=disk,format=raw,id=disk0" ^
-device "virtio-blk-pci,drive=disk0,disable-modern=on,disable-legacy=off" ^
-dtb ...versatile-pb-buster.dtb ^
-kernel ...kernel\kernel_qemu_5451_buster ^
-append "root=/dev/vda2 panic=1" ^
-no-reboot
Hello,
ReplyDeleteDid anyone find a way to increase the ram for buster?