Raspberry Pi :Emulate Raspberry Pi using QEMU

in #utopian-io6 years ago (edited)

What Will I Learn?

This tutorial is all about how to emulate R-Pi on Linux.

  • You will learn how to emulate Raspberry-Pi on Linux.
  • You will learn what is QEMU and how to download it.

Requirements

  • Raspberry Pi running in Linux
  • Ubuntu Linux knowledge
  • Getting the Raspberry-Pi Image
  • Installing QEMU emulator
  • Compile or download a QEMU-Ready kernel of Raspberry-Pi

Difficulty

  • Intermediate

Tutorial Contents


Getting the Raspberry-Pi Image

You can simply download the latest Raspbian Wheezy distribution from RaspberryPi.org.

QEMU

QEMU is short term for Quick Emulator . It is generic and open source machine emulator and it is a free and open-source hosted hypervisor that performs hardware virtualization (not to be confused with hardware-assisted virtualization).

You need to install QEMU on your Linux.
On Ubuntu terminal do:

$sudo apt-get update && sudo apt-get install qemu-system-x86

To check the correct installation, do as follow:

$qemu-system-arm --version

Get things going…

  • So first of all create a working directory anywhere you like in your system.
  • Copy your newly downloaded Raspberry Pi image to current directory and unzip it.
  • Then rename it to rpi.img.

Download the QEMU-Ready R-Pi’s kernel

Download it from here
or you simply clone the git repository in the directory that you just created using the command below.

$git clone https://github.com/dhruvvyas90/qemu-rpi-kernel.git

Set-up Phase

  • If you have done everything correctly your working folder should contain these files and folders.

    image.png
  • you need to make a simple script to make it easier to start the emulator. Open up your favorite text editor and save the content below as a new file and name it config
qemu-system-arm -kernel ./qemu-rpi-kernel/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda rpi.img
  • After saving the file, make sure you make it executable by the command below:
$chmod +x config
  • Now you are ready to start the raspberry pi in configuration mode. To do so, run the script you just created:
$./config
  • If you have done everything correctly you will be greeted by terminal prompt of Raspberry Pi:

image.png



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Hi, I am your moderator and I think this tutorial is acceptable but I think the GitHub repository should rather be the one for QEMU than for RaspberryPi as the entire tutorial is all about how to use QEMU (in order to emulate Raspberry Pi). If you change the repo I will accept this tutorial.

@flauwy done changing the repo :)

Awesome, this is going to help running classes at the maker space when they forget to bring their pi!

HAHAHA I bet it will ;)

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @athenamae I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x