I'm trying to emulate raspbian on QEMU and there're plenty of guides available on internet. However, every guide points to download qemu-linux kernel from link https://xecdesign.com/downloads/linux-qemu/kernel-qemu however, this link is dead and I was unable to find an alternative link. Is there any alternative link to the kernel or guide how to compile kernel from source to use it for emulation?
-
I used QEmu from https://sourceforge.net/projects/rpiqemuwindows/?source=typ_redirect – Thomas Weller Mar 31 '16 at 22:03
-
Generic howto version: http://raspberrypi.stackexchange.com/questions/165/emulation-on-a-linux-pc – Ciro Santilli OurBigBook.com Sep 15 '16 at 21:47
-
It still exsists on the internet archive. http://web.archive.org/web/20150512213356/http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/ – 5p0ng3b0b Aug 25 '21 at 04:40
5 Answers
Here is a link for that file I have uploaded it to dropbox. https://www.dropbox.com/s/g8u93xblz1v1ly0/kernel-qemu?dl=0
Also, it's been made available on github. Link --> https://github.com/dhruvvyas90/qemu-rpi-kernel

- 2,853
- 3
- 19
- 32

- 132
- 2
-
1That particular build seems to be lacking cgroups and therefore can't be used to boot Jessie :( – Nathan Osman Nov 17 '15 at 03:15
-
cant boot with jessie as well.. tested both kernel versions.. all gives me "Kernel panic - not syncing : Attempted to kill init" , tested with image 2016-02-09-raspbian-jessie.img – mariomol Feb 14 '16 at 12:50
-
7Please don't like to random files on dropbox. No one knows who you are, nor should they automatically trust you enough to run some random binary you uploaded to dropbox. – Cerin Apr 11 '16 at 17:22
- Install Qemu for Windows 32-bit, 64-Bit Doesn't Work
- Add
C:\Program Files(x86)\Qemu
to your PATH (Here's How) - Download the Raspbian Jessie Img(Unzip it after) and This Jessie Kernel*
- Put Them In Their own folder, say
%userprofile%\Qemu
- Open CMD Prompt in that folder
- Run:
qemu-system-arm.exe -kernel <your-kernel-file> -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -drive file=<your-jessie-img>.img,format=raw -cpu arm1176 -M versatilepb -m 256 -M versatilepb -no-reboot -serial stdio -net nic -net user,hostfwd=tcp::5022-:22
- After Everything Loads in Qemu, run:
nano /etc/udev/rules.d/90-qemu.rules
- Type: (Note, To Copy/Paste, go to the Beginning of the Line, Click, CTRL+K, then CTRL+U, as many times as you need to (three in this case))
KERNEL=="sda", SYMLINK+="mmcblk0"
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
KERNEL=="sda2", SYMLINK+="root"
To save, press CTRL+X, y, then enter
Close The Window
Now, Run:
qemu-img.exe resize <your-jessie-img>.img 8G
- Run that first command again
qemu-system-arm.exe -kernel <your-kernel-file> -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -drive file=<your-jessie-img>.img,format=raw -cpu arm1176 -M versatilepb -m 256 -M versatilepb -no-reboot -serial stdio -net nic -net user,hostfwd=tcp::5022-:22
Run
fdisk /dev/sda
a. Press 'p', to display the list of partitions. Note the 'Start' Number of /dev/sda2. We will need this later
b. Press 'd', and click 2. THIS WILL NOT ACTUALLY DELETE DATA (after we're done)!
c. Press 'n', then 'p', then '2'. Next Type the number we noted above. Then click enter for the last option
d. Click 'w' to Write and exit.
Reboot the Emulator (Close the window, then run):
qemu-system-arm.exe -kernel <your-kernel-file> -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -drive file=<your-jessie-img>.img,format=raw -cpu arm1176 -M versatilepb -m 256 -M versatilepb -no-reboot -serial stdio -net nic -net user,hostfwd=tcp::5022-:22
Run
resize2fs /dev/sda2
this might take a bit. After it is done do it again, until it says 'nothing to do'Reboot Again, instead, use this command(Remove 'init=/bin/bash'):
qemu-system-arm.exe -kernel <your-kernel-file> -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -drive file=<your-jessie-img>.img,format=raw -cpu arm1176 -M versatilepb -m 256 -M versatilepb -no-reboot -serial stdio -net nic -net user,hostfwd=tcp::5022-:22
Be patient, as this will take forever.
There is a full raspi armhf desktop!
NOTE: THIS GUIDE IS MOSTLY COPIED FROM HERE
*Kernel From Github, dhruvvyas90/qemu-rpi-kernel

- 41
- 4
As mentioned before, dhruvvyas90 provides new patched kernels regularly.
Like you say, most guides are outdated and contain broken links. I recommend this updated guide (feb 2017).
https://ownyourbits.com/2017/02/06/raspbian-on-qemu-with-network-access/
It provides a script that will take care of conditioning of the raspbian image to run in QEMU for you, and will share your network connection with QEMU so you can run apt-get
and such.

- 141
- 4
The answer seems to be pretty late but may help other people. About compiling the kernel from source for qemu, this link has a copy of the original xecdesign webpage as a pdf. Found it atlast !!

- 29
- 6
-
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Steve Robillard Oct 05 '15 at 00:46