Page 1 of 1

Running U-Boot on QEMU simulation of RaspberryPi

Posted: Fri Jun 14, 2013 5:15 am
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?

Re: Running U-Boot on QEMU simulation of RaspberryPi

Posted: Fri Jun 14, 2013 6:12 am
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

Re: Running U-Boot on QEMU simulation of RaspberryPi

Posted: Fri Jun 14, 2013 9:36 am
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).

Re: Running U-Boot on QEMU simulation of RaspberryPi

Posted: Sat Jun 15, 2013 4:51 am
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.

Re: Running U-Boot on QEMU simulation of RaspberryPi

Posted: Sat Jun 15, 2013 5:04 am
by iansjack
Some ideas to get you started here: http://en.wikipedia.org/wiki/QEMU#ARM

Re: Running U-Boot on QEMU simulation of RaspberryPi

Posted: Mon Jun 17, 2013 2:51 am
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.

Re: Running U-Boot on QEMU simulation of RaspberryPi

Posted: Mon Jun 17, 2013 3:50 am
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.

Re: Running U-Boot on QEMU simulation of RaspberryPi

Posted: Mon Jun 17, 2013 7:57 am
by jnc100
There is a reasonably complete emulation of the RPi here.

Regards,
John.

Re: Running U-Boot on QEMU simulation of RaspberryPi

Posted: Mon Jun 17, 2013 10:22 am
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.

Re: Running U-Boot on QEMU simulation of RaspberryPi

Posted: Mon Jun 17, 2013 1:45 pm
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