KLOADER(4)
๐ kloader(4) โ the in-kernel bootloader, bestie edition ๐
okay so real talk, this is kloader(4) from the Kernel Interfaces Manual and honestly it's kind of iconic? it's the in-kernel bootloader. yes. the kernel. booting itself. main character energy fr fr โจ
โจ SYNOPSIS โจ
options KLOADER
options KLOADER_KERNEL_PATH="\"/netbsd\""
that's it, that's the whole vibe check. two lines. slay. ๐
๐ธ DESCRIPTION ๐ธ
so kloader is the in-kernel bootloader for platforms that don't have a proper firmware. like, no firmware at all. none. zero. it's giving "we forgot to include the firmware in the box" ๐ญ
some platforms supported by NetBSD just straight up don't have a firmware that can boot the NetBSD kernel. examples, because there are examples:
- game consoles โ the
dreamcastandplaystation2ports ๐ฎ - handhelds โ the
hpcarm,hpcmips, andhpcshports ๐ซถ
on platforms like that, the bootloader is usually a host program that runs under the native OS. which means rebooting NetBSD is a whole lengthy saga: boot into the native OS first, launch the bootloader program, and finally boot NetBSD again. exhausting. not the vibe. ๐
that's the exact problem kloader addresses โ it lets the currently running kernel serve as a bootloader for the kernel being booted, so you skip the whole "boot into the native OS first" burden. no cap, that's the entire point. ๐ฅ
and when kloader is configured into the kernel? a call to reboot(2) causes kloader to load the new kernel into memory, and arrange for control to be passed to the new kernel โ just like a standalone bootloader does. the new kernel then boots in the ordinary manner. that's it. that's the magic. โญ
๐ฆ SEE ALSO ๐ฆ
go read those too, iykyk ๐
๐ HISTORY ๐
kloader first appeared in NetBSD 1.6. vintage. a classic. we love a legacy icon ๐
๐ BUGS ๐
okay bestie, listen, the caveats are real and we're gonna say them clearly:
kloaderignores thehowtoandbootstrarguments passed to thereboot(2)system call, and reboots the system with the previous boot settings. so like, don't expect your arguments to do anything. they're just gonna sit there. ๐ญkloaderdoesn't support booting compressed kernels. no compressed kernels. not a thing. periodt. ๐- The
hpcarmport doesn't supportkloaderyet. yet. we're manifesting. ๐ง
so yeah, that's the whole page โ read the bugs section twice, it's important, i'm not being dramatic (i'm being a little dramatic) ๐
and that's a wrap, bestie! this one's from the Debian build, dated April 3, 2004 โ yeah, it's older than most of the group chat, but it still ate. ๐๐ ๐
๐ฆ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2004 Valeriy E. Ushakov
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms