Raspberry Pi bare bones not working?

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
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Raspberry Pi bare bones not working?

Post by Roman »

Hello, everyone.

I've built the bare bones tutorial for Raspberry Pi, but it doesn't seem to work.

What I've tried to test on:
- this QEMU port: with both "rapsi" and "raspi2" machine configurations;
- my own Raspberry Pi 2.

Please, can someone confirm that the code is actually correct?

Thanks in advance.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: Raspberry Pi bare bones not working?

Post by jnc100 »

Its been a while but I managed to get something similar to the bare bones code to work on the 'torlus' qemu port, which as far as I know only supports rpi ver 1, as well as a real rpi v1b.

When you say it doesn't work, what exactly happens? How are you loading the kernel? Through an elf file passed as a -kernel option? If so, you may need to adjust the entry point of your kernel to be 0x10000 rather than 0x8000 (specifically for qemu rather than real hardware).

Regards,
John.
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: Raspberry Pi bare bones not working?

Post by Roman »

Thank you for your reply!
When you say it doesn't work, what exactly happens?
It neither outputs the "Hello, World!" string to stdio (-serial stdio) in QEMU, nor it does so on my Raspberry Pi 2 (I have an Adafruit cable, which works perfectly under Linux).
How are you loading the kernel?
On QEMU I run it using the '-kernel' option, I also tried the '-bios' option. On RPi 2 I use U-boot and TFTP.

I also tried to adjust the base address as you suggested, but, unfortunately, it doesn't seem to work.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
User avatar
Enno
Posts: 1
Joined: Wed May 18, 2016 12:09 am
Location: Norway

Re: Raspberry Pi bare bones not working?

Post by Enno »

I tried to get the Raspberry Pi Bare Bones tutorial to work yesterday, and can confirm that it seems incomplete. Here's a list of my hangups:

1. Booting the kernel says "Do you still have the SD card with the original Raspbian image on it from when you where testing the hardware above?", but never speaks of testing the hardware or the SD card anywhere.

2. My Raspbian image looks different from the one in the wiki: I don't have a kernel.img, but a vmlinuz-3.18.0-trunk-rpi2 (I installed from the raspbian-ua-netinst image).

3. The wiki page speaks of replacing the kernel.img with the one that I just built. But the instructions only have me build myos.bin and myos.elf - my understanding is that myos.bin is the non-ELF kernel I should use?

4. The wiki says that raspi support is not in qemu yet, but the Torlus fork that's linked from the wiki says that this has since happened, and encourages me to use the official sources.

I tried both booting on the real hardware and in QEMU:

1. I changed config.txt to say kernel=myos.bin, booted my raspi2 from the SD card, and all I get is the rainbow color screen forever, no Hello World.

2. I built qemu from the official qemu github repo, and started it with -kernel myos.elf. This gives me a black window, no Hello World.

3. changed the base address from 0x8000 to 0x10000 according to the suggestion in the wiki, rebuilt, got the same results.

I'm obviously new to this, and have no idea how to proceed or debug my issues. I'm not even more than 50% sure that I did everything right, so even confirmation that what I described is not off the path would be nice.

EDIT: I believe my problems have a lot to do with the fact that I'm using a RPI2, and the tutorial is for the RPI1. The default kernel image name for the 2 is kernel7.img, for example. Also, the bootloader has changed and no longer requires the loader.bin file, so the tutorial is definitely out-of-date.
Post Reply