Running U-Boot on QEMU simulation of RaspberryPi

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
revolver
Posts: 4
Joined: Mon Oct 11, 2010 1:06 am

Running U-Boot on QEMU simulation of RaspberryPi

Post by revolver »

I want to run U-Boot on RaspberryPi (in order to eventually load some other OS on the board). Before I do it on the actual hardware, I first want to simulate it on QEMU. I am working on an Ubuntu 12.10 x86_64 machine.

So, I downloaded the U-Boot source (from https://github.com/gonzoua/u-boot-pi/tree/rpi) and cross-compiled it for ARM (using the arm-linux-gnueabi-gcc provided by the distro). However, when I try to run the QEMU using the

Code: Select all

 qemu-system-arm -cpu arm1176 -M versatilepb -m 128 -kernel u-boot 
command, the U-Boot fails to load, nor is there any error message -- it seems as though the QEMU gets stuck. Also, when the -cpu flag is omitted, U-Boot does load successfully, but then it is not a simulation of RPi.

The question is, where am I wrong in the process? Did anyone try running U-Boot on a simulation of RPi previously?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Running U-Boot on QEMU simulation of RaspberryPi

Post by AJ »

Hi,

Although there are some here who are programming RPis, you'll probably get a much better signal:noise ratio for this question on the RPi forums [waits for someone to prove me wrong by answering...].

Cheers,
Adam
User avatar
XanClic
Member
Member
Posts: 138
Joined: Wed Feb 13, 2008 9:38 am

Re: Running U-Boot on QEMU simulation of RaspberryPi

Post by XanClic »

revolver wrote:Also, when the -cpu flag is omitted, U-Boot does load successfully, but then it is not a simulation of RPi.
Actually, as far as I know, qemu cannot simulate a RPi anyway. What it does is simulating the same CPU with very different hardware (the one used by the Versatile/PB board, obviously). The Linux distributions for the RPi only run there, because Linux does not only support the RPi hardware, but the Versatile/PB stuff as well.

That's at least what I know. If it's true, it may help you solving your U-Boot problem, but it will certainly help you figuring out whether qemu is the right tool for emulating a RPi in the first place (hint: if what I said is true, it isn't).
revolver
Posts: 4
Joined: Mon Oct 11, 2010 1:06 am

Re: Running U-Boot on QEMU simulation of RaspberryPi

Post by revolver »

Thanks a lot for advices. It looks like developing OS low level code on emulator is not a good idea, in general.

One more question on this topic.
Maybe you are aware of any ARM based board for which exists QEMU-like emulator that does exact emulation of this specific board?
I am not limited to Raspberry Pi and I still like the conveniences emulator can provide.
Last edited by revolver on Sat Jun 15, 2013 5:16 am, edited 1 time in total.
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Running U-Boot on QEMU simulation of RaspberryPi

Post by iansjack »

Some ideas to get you started here: http://en.wikipedia.org/wiki/QEMU#ARM
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Running U-Boot on QEMU simulation of RaspberryPi

Post by dozniak »

You can use pretty much any qemu supported board (e.g. versatile), but it won't be the same as panda board, beagle board or rpi hardware wise.

Just develop on the emulator and then test on the real rpi. It has very simple boot process with an SD card, and I've seen a serial bootloader somewhere, so you can just boot it up and send your kernel to it without fiddling with SD cards at all.
Learn to read.
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Re: Running U-Boot on QEMU simulation of RaspberryPi

Post by xyzzy »

Linaro maintains a branch of QEMU which has support for more ARM boards, in particular the BeagleBoard: https://launchpad.net/qemu-linaro/

For the RPi, if you use U-Boot you can set up a TFTP server on your development machine and then boot from that on the real hardware. That's what I've been doing, saves messing around copying to the SD card every time you want to make a change. Instead I just have to compile, copy into the TFTP root and power on the Pi.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: Running U-Boot on QEMU simulation of RaspberryPi

Post by jnc100 »

There is a reasonably complete emulation of the RPi here.

Regards,
John.
revolver
Posts: 4
Joined: Mon Oct 11, 2010 1:06 am

Re: Running U-Boot on QEMU simulation of RaspberryPi

Post by revolver »

xyzzy wrote:Linaro maintains a branch of QEMU which has support for more ARM boards, in particular the BeagleBoard: https://launchpad.net/qemu-linaro/
This is what I am going to try -- looks like Linaro QEMU emulates the complete board hardware (e.g. beagleboard, pandaboard), not just board's CPU.
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: Running U-Boot on QEMU simulation of RaspberryPi

Post by Griwes »

dozniak wrote:I've seen a serial bootloader somewhere, so you can just boot it up and send your kernel to it without fiddling with SD cards at all.
https://github.com/mrvn/raspbootin
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
Post Reply