Southend Linux User Group

Raspberry PI Emulation

Emulation of Raspbery PI and Cream

Introduction

The Raspberry Pi as it stands consists of the following:

Features of the Raspberry Pi model B board

  • Broadcom BCM2835 700MHz ARM1176JZFS processor with FPU and Videocore 4 GPU
  • GPU provides Open GL ES 2.0, hardware-accelerated OpenVG, and 1080p30 H.264 high-profile decode
  • GPU is capable of 1Gpixel/s, 1.5Gtexel/s or 24GFLOPs with texture filtering and DMA infrastructure
  • 256MB RAM(Model A) and 512MB RAM(Model B)
  • Boots from SD card, running the Fedora or Debian version of Linux
  • 10/100 BaseT Ethernet socket
  • Price: £21.60 (exc VAT & delivery)

Attractive though this board is in price at least, it measures about the size of a credit card, it was quite hard to get one I know I had to wait 4 or 5 months since I knew I could place an order. I don’t know how true this figure is but am lead to believe some 2,000,000 people have ordered and waiting delivery for their Raspberry PI Board since (statistics accurate as of January 2014). If you can’t wait to try Raspberry PI you can at least emulate the operating system and it’s processor using a method described below. The board itself may be a good price but you may also need to buy ancillary equipment to use it, which could cost you as much as the board itself.

Below is a procedure for Raspbian and to get working there are other distro which you could use instead and should be able to run using a slight variation on the command line executed in fact all you need do is change the image filename.

You need to download and use a qemu-kernel which needs be in same location preferably as the img file I found mine here.

linux-qemu

You will also need the disk image which I obtained here.

http://www.raspberrypi.org/downloads

You will also need to install some dependent programs this will of course be for Ubuntu or debian

  • qemu
  • qemu-user
  • qemu-kvm-extras
  • qemu-utils
  • kvm-ipxe

You can use the following command line or use the software centre and install these packages

#> sudo apt-get install qemu qemu-user 
qemu-kvm-extras qemu-utils kvm-ipxe

If you want to know what arm emulation processors are available type just the following

#> qemu-arm -cpu ?

The Raspberry PI has the Broadcom BCM2835 700MHz ARM1176JZFS processor with FPU, qemu now works with the “-kernel kernel-qemu -cpu arm1176” specified for Ubuntu versions 12.04 and above.

I had put both kernel-qemu and disk image in the same directory and changed my directory to it eg

#> cd /home/delboy/Downloads/iso

This is the command line in its entirety you can if you want add -m 256 if you can spare the memory for it.

#> sudo qemu-system-arm -kernel kernel-qemu -cpu arm1176 -M 
versatilepb -no-reboot -append "root=/dev/sda2 panic=1" 
-hda 2012-12-16-wheezy-raspbian.img

Note:- I have noticed recently that I have had to add “sudo” to the front of the command and that I needed to replace the double quotes within the command string, if you do get an error replace your double quotes with new ones from your keyboard do not attempt to paste them. This cured my problem it might fix yours. The backslash has been added above and bellow purely for ease of use if you have trouble executing the command when copied please remove the backslash first and then execute command.

If you have available the memory you can try this it might be a bit more responsive:-

#> sudo qemu-system-arm -kernel kernel-qemu -cpu arm1176 -M 
versatilepb -no-reboot -append "root=/dev/sda2 panic=1" 
-hda 2012-12-16-wheezy-raspbian.img -m 256

What follows is a breakdown of the qemu command this can be pronounced “q” “emu” if your from the land downunder or you may prefer “qem” “u” choice as always is yours

  • qemu-system-arm :the command to emulate an arm system
  • -kernel kernel-qemu :the kernel which we use
  • -cpu arm1136-r2 :the cpu we need to emulate
  • -M versatilepb :the machine we need to emulate
  • -no-reboot -append “root=/dev/sda2 panic1” :we mount our root filesystem to /dev/sda in the emulated R-Pi
  • -hda debian6-19-04-2012.img :the file which contains the filesystem
  • -m 512 :the amount of memory set that this version of the R-Pi has (256 is normal for model B just increase if you want to add more)

rpi-cream1

Once you have the login prompt you will need to enter the username “pi” in lowercase and without the quotes that surround it, you will be prompted to enter a password and you should use “raspberry” for the image distro we are using above and again lowercase and without the quotes.

rpi-cream2

To run the graphical part of the distro type the following:

rpi-cream3

Before running “startx” you may want to improve the display output resolution from 640 x 480 to 800 x 600 here is one way to achieve that. Whilst at the command line and before you start the Xserver type the following:-

#> sudo nano /etc/X11/xorg.conf

Type the following into the file you have just created:-

Section “Screen”
Identifier “Default Screen”
SubSection “Display”
Depth 16
Modes “800×600” “640×480”
EndSubSection
EndSection

Now you can run “startx” at the command line, still cannot achieve 1024 x 768 tried it but didn’t work neither did 24bit colour depth

#> startx

rpi-cream4

If this is the first time you have run either one of these commands please be patient until the program reaches the login prompt

That in a nutshell is it, this should get you running if you can help obtain a working solution for better graphics and resolution please comment below.

IF YOU HAVE COMPLETED THE ABOVE SECTION YOU DO NOT NEED TO DO ANY OF WHAT FOLLOWS BELOW

Installing Qemu from “git”

First what is “git”

Git is an open source version control system. Git is developed and maintained by the creator of the Linux kernel. Git stores complete files each time the user commits his changes, making recovery and version-diffing reliable, responsive, and simple. This is in contrast to other version control systems which store complete versions as “Deltas” or descriptions of the changes between versions of a file. If a file has not changed between commits then Git simply links to the last changed version.

Why install a later version of “Qemu”

It is an experiment really the above procedure works well enough but does not produce any resolution other than 640 x 480 which is pretty pants really, especially for presentations and demonstrations. So it was felt a later build would allow us to increase the window resolution – hopefully.

Without any variation to the command line code above there was no change in output it was still 640 x 480.

What you need to do and how to do if you want to install “git” yourself

#> sudo apt-get remove qemu

#> sudo apt-get install git build-essential

#> git clone git://git.linaro.org/qemu/qemu-linaro.git

#> cd qemu-linaro

#> ./configure --target-list=arm-softmmu

#> make

#> sudo make install

If you have a machine that has a multicore uProcessor you may want to use -j n option were the “n” signifies the number of processors but is not strictly necessary, you can use the option like this.

#> make -j 2

and

#> sudo make install -j 2

Author: Derek Shaw - Page reference: 2862
Last modified: paul - 2015-08-21