New Raspberry Pi bootloader (rpi-boot)

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
Post Reply
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

New Raspberry Pi bootloader (rpi-boot)

Post by jnc100 »

I've recently obtained a RPi and have been playing with porting my OS to it. As a side effect of my experiments with it I've come up with a small second stage bootloader that I've released under a MIT licence in the hope that it may prove useful.

Its main selling point is that it provides the loaded kernel with 'BIOS-like' functions to aid debugging and hardware access during early kernel initialisation. Specifically, it provides a printf() function for writing text to the framebuffer, read-only filesystem access and timer support. Note that all the drivers are not optimised and are designed to be replaced by OS ones once the OS is more fully loaded. For example the block devices use synchronous PIO calls only, the filesystem drivers do not perform caching, the console driver is slow to scroll (as making it quicker would involve using up one of the RPi's DMA channels which the kernel itself may want to use).

It supports parsing a command file (/boot/rpi-boot.cfg) loaded from the SD card and can load kernels from both ext2 and FAT partitions. It currently supports loading Multiboot compliant kernels in ELF or a.out format and standard ELF kernels.

In Multiboot mode it supports loadable kernel modules, providing a list of devices and a memory map ala E820 (but actually interpreted from the ATAGs supplied by the first stage bootloader).

Currently unsupported features:
- USB support (work in progress)
- Network boot (requires USB)
- Interactive boot (requires USB)
- Ability to ask for a particular framebuffer mode in the Multiboot header (work in progress)

For the source see here, precompiled binaries and a test kernel are available here and further documentation is available at README and MULTIBOOT-ARM.

Please note this is a work in progress and bug reports are most welcome either on this thread or via email. In particular the ext2 code has only been tested in an emulator (but no SD writes are made so will not damage your filesystem).

Regards,
John
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: New Raspberry Pi bootloader (rpi-boot)

Post by AJ »

Nice - I've actually dusted some of my code off recently and am working on RPi too. Although my aim is for the RPi port to be self booting, I'll give your boot loader a try.

Cheers,
Adam
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: New Raspberry Pi bootloader (rpi-boot)

Post by dozniak »

jnc100 wrote:For the source see here, precompiled binaries and a test kernel are available here and further documentation is available at README and MULTIBOOT-ARM.

Please note this is a work in progress and bug reports are most welcome either on this thread or via email. In particular the ext2 code has only been tested in an emulator (but no SD writes are made so will not damage your filesystem).
Nice job. I've recently received my RPi and it's very cool.

One request regarding code sharing and bug reports - would you mind to republish this code on github?
Learn to read.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: New Raspberry Pi bootloader (rpi-boot)

Post by jnc100 »

dozniak wrote:One request regarding code sharing and bug reports - would you mind to republish this code on github?
I'd considered it, but stuck to using my own server as it makes it far easier to produce nightly builds of the repository. If you want to use RCS tools to access the repository you can do 'svn co http://www.johncronin.org.uk/svn/rpi-boot rpi-boot'. I stick to this purely because my subversion-fu is substantially greater than my git-fu.

Regards,
John.
OrOS
Member
Member
Posts: 143
Joined: Sat Sep 08, 2007 11:26 pm
Location: Canada

Re: New Raspberry Pi bootloader (rpi-boot)

Post by OrOS »

Out of curiosity, how does it make it easier?

Also, if you'd like to edge yourself into git, github repo's can be treated directly as SVN repos (since 2010) or you can use git-svn.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: New Raspberry Pi bootloader (rpi-boot)

Post by Brynet-Inc »

Github is social networking mated with VCS, you'll be branded a terrorist if you try to avoid it.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: New Raspberry Pi bootloader (rpi-boot)

Post by dozniak »

jnc100 wrote:I stick to this purely because my subversion-fu is substantially greater than my git-fu.
It would make it much easier to contribute patches and other feedback (like code review). Not that lack of github would stop me from doing so anyway. But here's some simple commands to convert things:

Code: Select all

git svn clone --no-metadata http://www.johncronin.org.uk/svn/rpi-boot 
cd rpi-boot
git remote add origin [email protected]:jnc100/rpi-boot.git
git push -u origin master
This creates a one-time export only, if you want to still keep track of the svn repo while being able to sync up with github, simply remove "--no-metadata" from the clone line. Then you would be able to sync up any changes from svn to git with a simple two-liner:

Code: Select all

git svn rebase
git push
And back to svn with

Code: Select all

git pull
git svn dcommit
Learn to read.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: New Raspberry Pi bootloader (rpi-boot)

Post by jnc100 »

Very well I have bowed to collective pressure.

github repository

Regards,
John
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: New Raspberry Pi bootloader (rpi-boot)

Post by dozniak »

jnc100 wrote:github repository
Awesome. I will give it a go soon!
Learn to read.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: New Raspberry Pi bootloader (rpi-boot)

Post by Brynet-Inc »

jnc100 wrote:Very well I have bowed to collective pressure.
That's so sad. :-(
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: New Raspberry Pi bootloader (rpi-boot)

Post by Antti »

Thank you very much. I ordered two RPis some time ago and now I am waiting to get them. It will be very exciting to do experiments on real hardware.
Post Reply