New Raspberry Pi bootloader (rpi-boot)
New Raspberry Pi bootloader (rpi-boot)
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
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)
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
Cheers,
Adam
Re: New Raspberry Pi bootloader (rpi-boot)
Nice job. I've recently received my RPi and it's very cool.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).
One request regarding code sharing and bug reports - would you mind to republish this code on github?
Learn to read.
Re: New Raspberry Pi bootloader (rpi-boot)
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.dozniak wrote:One request regarding code sharing and bug reports - would you mind to republish this code on github?
Regards,
John.
Re: New Raspberry Pi bootloader (rpi-boot)
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.
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.
- Brynet-Inc
- 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)
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)
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:jnc100 wrote:I stick to this purely because my subversion-fu is substantially greater than my git-fu.
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
Code: Select all
git svn rebase
git push
Code: Select all
git pull
git svn dcommit
Learn to read.
Re: New Raspberry Pi bootloader (rpi-boot)
Awesome. I will give it a go soon!jnc100 wrote:github repository
Learn to read.
- Brynet-Inc
- 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)
That's so sad.jnc100 wrote:Very well I have bowed to collective pressure.
Re: New Raspberry Pi bootloader (rpi-boot)
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.