Page 1 of 1

New Raspberry Pi bootloader (rpi-boot)

Posted: Sun Feb 24, 2013 4:13 pm
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

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Sun Feb 24, 2013 5:17 pm
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

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Mon Feb 25, 2013 11:08 am
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?

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Mon Feb 25, 2013 6:38 pm
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.

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Mon Feb 25, 2013 10:59 pm
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.

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Tue Feb 26, 2013 12:01 am
by Brynet-Inc
Github is social networking mated with VCS, you'll be branded a terrorist if you try to avoid it.

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Tue Feb 26, 2013 1:04 am
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

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Tue Feb 26, 2013 4:56 am
by jnc100
Very well I have bowed to collective pressure.

github repository

Regards,
John

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Tue Feb 26, 2013 5:03 am
by dozniak
jnc100 wrote:github repository
Awesome. I will give it a go soon!

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Tue Feb 26, 2013 11:23 am
by Brynet-Inc
jnc100 wrote:Very well I have bowed to collective pressure.
That's so sad. :-(

Re: New Raspberry Pi bootloader (rpi-boot)

Posted: Wed Feb 27, 2013 6:03 am
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.