Petitboot for coreboot
Petitboot is a platform independent bootloader based on the Linux kexec warm reboot mechanism. Petitboot supports loading kernel, initrd and device tree files from any Linux mountable filesystem, plus can load files from the network using the FTP, SFTP, TFTP, NFS, HTTP and HTTPS protocols. Petitboot can boot any operating system that includes kexec boot support.
Petitboot includes graphical and command line user interface programs. The command line programs can be used to boot the system remotely via telnet or ssh sessions. Multiple user interface programs can run simultaneously.
Petitboot is licensed under the GPLv2.
See Petitboot website for more information.
About petitboot for coreboot
This builds a bzImage with a linked initramfs that contains petitboot. Currently, the kernel is trimmed down to fit in a the 8MB of a thinkpad x200, while maintaining essential functionality. This is done using an industry standard tool for building embedded linux distributions, buildroot.
It is inspired by the op-build package which builds openpower boot firmware, also containing petitboot
How to build
First get buildroot:
git submodule update --init
Then source petitboot-env
Configure and let buildroot do its thing
pfc-build petitboot_defconfig pfc-build
The resulting bzImage will be in
How to integrate with coreboot
The simplest way is it add it as
img/petitboot and load it from SeaBIOS. That way you have a fallback mechanism in case something is wrong with petitboot.
cbfstool coreboot.rom add-payload -f bzImage -n img/petitboot -C [command line arguments]
Another way is to use linux as a payload in coreboot.
You can sometimes only see a part of the petitboot tui. Hitting CTRL + l to clear the screen fixes this.
console=ttyS1 to the linux command line arguments also fixes this problem, by having the boot messages on a different, unused console.
When calling kexec to load a new kernel, the new kernel does not necesseraly have an available framebuffer. If you set up disk encryption this might be a problem since you cannot see the password prompt. To work around this you can add a KMS module like i915 to you distro's bzImage or initrd.
Customize buildroot, linux
To customize buildroot, run in the petitboot_for_coreboot directory:
make -C buildroot/ menuconfig
To customize linux, run:
make -C buildroot/ linux-menuconfig