emulateing raspberry pi 1 with qemu

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Is it possible to emulate raspberry pi 1 with qemu without changing the  
qemu source code?

Example:

qemu-system-arm -kernel raspi1/kernel7.img  -M raspi2 -append "rw  
earlyprintk loglevel=8 bcm2708.boardrev=0xd dwc_otg.lpm_enable=0 root=/
dev/mmcblk0p2" -sd devuan_jessie_1.0.0_armel_raspi1.img -dtb raspi1/
bcm2708-rpi-b.dtb

doesn't work.

sources:

https://mirror.leaseweb.com/devuan/devuan_jessie/embedded/
https://www.raspberrypi.org/forums/viewtopic.php?t26%561&start12%5
openwrt/trunk/target/linux/brcm2708/image/cmdline.txt
https://blog.agchapman.com/using-qemu-to-emulate-a-raspberry-pi
https://www.mail-archive.com/ snipped-for-privacy@nongnu.org/msg335990.html
https://elinux.org/Board_revisions
https://elinux.org/RPi_Serial_Connection
https://elinux.org/RPI_BCM2708_Parameters
https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-
Peripherals.pdf
https://github.com/raspberrypi/documentation/blob/master/hardware/
raspberrypi/bootmodes/bootflow.md

Re: emulateing raspberry pi 1 with qemu
Quoted text here. Click to load it

Define "doesn't work".

What version of qemu are you using and where are you getting it from?

Theo

Re: emulateing raspberry pi 1 with qemu
On Tue, 14 Nov 2017 15:46:40 +0000, Theo wrote:

Quoted text here. Click to load it

"doesn't work" means there is no response (boot messages) besides heavy
host cpu consumption.  qemu window remains black.

I tried the latest windows installer from www.qemu.org "qemu-w64-
setup-20171108.exe" which installs qemu v2.10.90. That again seems to come
from http://repo.or.cz .

This version has a promising machine option "-M raspi" instead of the
afore mentioned "-M raspi2".  Sadly this version stops with the Error
"ERROR:/home/stefan/src/qemu/repo.or.cz/qemu/ar7/qom/
object.c:176:type_get_parent: assertionfailed: (type->parent_type !=
NULL).

I also tried the master branch (qemu 2.11.0-rc1) from git.qemu.org/
qemu.git on archlinux.  This version has the option "-M raspi2" only which
"doesn't work" for raspi1 images (black screen, no response, no
"decrompressing initrd/kernel image").

With the raspi2 image devuan_jessie_1.0.0_armhl_raspi2.img and
corresponding "kernel7.img" qemu shows some boot messages (until init is
killed) using qemu command line option "-dtb bcm2709-rpi-2-b.dtb" instead
of "-dtb bcm2708-rpi-b.dtb"

qemu/hw/arm/raspi.c from git.qemu.org/qemu.git seems to differentiate
between raspi 1 and 2 though:

static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43};

This master branch from git.qemu.org/qemu.git has a function
"raspi2_machine_init" in hw/arm/raspi.c but lacks a "raspi_machine_init"
as in https://patchwork.kernel.org/patch/9670983 /.

My hope was that it is simply a question of finding the right command line
options.  But the code suggests it is not (yet/anymore) implemented.


Re: emulateing raspberry pi 1 with qemu
Quoted text here. Click to load it

OK, so you're doing sensible things compiling the head of upstream sources,
rather than running old versions which you might be if you downloaded qemu
from somewhere random.

Though maybe the Pi stuff is on a branch somewhere?

Quoted text here. Click to load it

It may be the relevant machine isn't compiled in.

Quoted text here. Click to load it

That's promising.  I'm puzzled why Pi 1 images don't work though - qemu
should support them.

Try bog standard Raspbian?

Quoted text here. Click to load it

I think this board ID is the some jumpers which are hardwired on the PCB.  I
think it's mostly used by things like wiringPi to name the GPIOs
appropriately on different boards.  I don't know if there's anything in the
kernel that uses it.

Quoted text here. Click to load it

My guess would be that qemu emulates the GPU firmware, it doesn't emulate
the whole SoC.  So it could be that they have iterated the firmware and qemu
has not kept up.  A bit of a wild stab in the dark though.

Can you find a version of the kernel that qemu has been tested with?

Theo

Re: emulateing raspberry pi 1 with qemu
On Tue, 14 Nov 2017 12:20:34 +0000 (UTC), Mark Moss

Quoted text here. Click to load it
In windows 10 that works fine:

<https://sourceforge.net/projects/rpiqemuwindows/>
--  
aen

Site Timeline