Petitboot & Non-Linux Operating Systems

Nathan Whitehorn nwhitehorn at freebsd.org
Tue Jan 6 08:54:40 AEDT 2015


I'm doing platform bringup for FreeBSD on one of the Tyan Palmetto 
systems. FreeBSD usually boots in conjunction with a secondary 
bootloader that loads kernel modules etc. one by one from disk into 
memory and passes them to the kernel at boot rather than the kernel + 
ramdisk approach that Linux uses. On most systems (Open Firmware, BIOS, 
EFI, etc.) the firmware provides some kind of API for disk, network, and 
console IO that the loader uses to accomplish this. kexec of course 
doesn't provide any runtime services, which breaks this completely. One 
option would be to put real hardware drivers into the loader, which we 
did for PS3, but that was awful and doesn't scale to less-predictable 
systems. Another would be to redo the boot process or to only allow 
monolithic kernels, but those are invasive or lead to a poor user 
experience.

What I ended up doing is porting the regular bootloader to run in 
userspace on Linux so that it can use the normal Linux APIs for doing 
all of the things it needs. Conceivably, it could then prep a "initrd" 
with its work and then use kexec-tools; what I found easier was to have 
it include a custom purgatory and do the kexec syscall itself. This 
works well and is way less of a maintenance nightmare than the PS3 
approach. petitboot doesn't have any way to execute such a thing except 
by "Exit to Shell", however. What's the best way to do this?
-Nathan


More information about the Petitboot mailing list