21

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?

3
10

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

3
  • 1
    That particular build seems to be lacking cgroups and therefore can't be used to boot Jessie :( Nov 17 '15 at 3: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
  • 7
    Please 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
3

The above link does appear dead, however this one is good.

2
  1. Install Qemu for Windows 32-bit, 64-Bit Doesn't Work
  2. Add C:\Program Files(x86)\Qemu to your PATH (Here's How)
  3. Download the Raspbian Jessie Img(Unzip it after) and This Jessie Kernel*
  4. Put Them In Their own folder, say %userprofile%\Qemu
  5. Open CMD Prompt in that folder
  6. 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
  1. After Everything Loads in Qemu, run:
nano /etc/udev/rules.d/90-qemu.rules
  1. 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"
  1. To save, press CTRL+X, y, then enter

  2. Close The Window

  3. Now, Run:

qemu-img.exe resize <your-jessie-img>.img 8G
  1. 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
  1. 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.

  2. 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
  1. Run resize2fs /dev/sda2 this might take a bit. After it is done do it again, until it says 'nothing to do'

  2. 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
  1. Be patient, as this will take forever.

  2. There is a full raspi armhf desktop!

NOTE: THIS GUIDE IS MOSTLY COPIED FROM HERE

*Kernel From Github, dhruvvyas90/qemu-rpi-kernel

1

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.

0

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 !!

1
  • 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. Oct 5 '15 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.