Git Product home page Git Product logo

qemu-rpi-kernel's Introduction

qemu-rpi-kernel

Ready-made kernels that can be used to emulate a Raspberry Pi using QEMU.

They are compiled from the same kernel sources used for official Raspian images, with tweaks to make them suitable for use with QEMU, and are supposed to be used along with official Raspbian images.

Obtaining Raspbian

Before starting, you should download a Raspbian image from the Raspberry Pi website and extract the .zip archive to obtain an .img file.

Choosing a kernel image

This repository contains three types of kernel images:

  • kernel-qemu-4.*.*-buster are the most recent images, which are compatible with Raspbian Buster and Stretch. To use these images, you'll need a compiled device tree file (.dtb) which is also contained in this repository. Use versatile-pb-buster.dtb for Buster, or use versatile-pb.dtb for Stretch. Unless you are positive you need a different kernel, the most recent of these images is probably what you want.

  • kernel-qemu-4.*.*-stretch are images compatible with Raspbian Stretch and Jessie. To use these images, you'll need the versatile-pb.dtb file which is also contained in this repository.

  • kernel-qemu-4.4.*-jessie are images compatible with Raspbian Jessie and Wheezy.

  • kernel-qemu-3.10.25-wheezy is the original image from xecdesign.com, which is compatible with Raspbian Wheezy only.

Using kernel images with QEMU

The QEMU command line will look like

$ qemu-system-arm \
  -M versatilepb \
  -cpu arm1176 \
  -m 256 \
  -hda /.../2019-09-26-raspbian-buster-lite.img \
  -net user,hostfwd=tcp::5022-:22 \
  -dtb /.../versatile-pb-buster.dtb \
  -kernel /.../kernel-qemu-4.19.50-buster \
  -append 'root=/dev/sda2 panic=1' \
  -no-reboot

with the paths to the disk image, .dtb file and kernel image adjusted appropriately.

There is a Docker image available to automate this whole process:

docker run -it lukechilds/dockerpi

More information: https://github.com/lukechilds/dockerpi

Using kernel images with libvirt

Assuming your libvirt version is at least 5.0.0, you can use something like

$ virt-install \
  --name pi \
  --arch armv6l \
  --machine versatilepb \
  --cpu arm1176 \
  --vcpus 1 \
  --memory 256 \
  --import \
  --disk /.../2019-09-26-raspbian-buster-lite.img,format=raw,bus=virtio \
  --network user,model=virtio \
  --video vga \
  --graphics spice \
  --rng device=/dev/urandom,model=virtio \
  --boot 'dtb=/.../versatile-pb-buster.dtb,kernel=/.../kernel-qemu-4.19.50-buster,kernel_args=root=/dev/vda2 panic=1' \
  --events on_reboot=destroy

to create a new libvirt guest called pi. You'll be able to manage the guest with all the usual tools, such as virsh and virt-manager.

Building your own kernel image

See the contents of the tools/ directory, where the build scripts and instructions on how to use them are stored.

Origin of this repository

While searching the Internet for information on emulating a Raspberry Pi using QEMU in Jun 2015, most of the guides pointed to kernel images hosted on xecdesign.com; however, at the time the resource was no longer online, and that's still the case as of Feb 2019.

This repository was initially created as a way to make those kernel images available once again, and has since been expanded to provide improved and up-to-date images.

Further information

Additional documentation can be found on the wiki.

qemu-rpi-kernel's People

Contributors

dhruvvyas90 avatar andreabolognani avatar ferbar avatar rimmington avatar hekkup avatar coreprocess avatar amitaronovitch avatar curioustommy avatar edgaroliveira avatar zicmama avatar puhitaku avatar juokelis avatar wesc avatar alexswilliams avatar chiwanpark avatar ddosolitary avatar monkeyboy107 avatar jlaine avatar lukechilds avatar janisozaur avatar jangid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.