KLOADER(4)

๐Ÿ“ฆ version 11.0, in nixpkgs unstable

๐Ÿ’– 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 dreamcast and playstation2 ports ๐ŸŽฎ
  • handhelds โ€” the hpcarm, hpcmips, and hpcsh ports ๐Ÿซถ

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:

  • kloader ignores the howto and bootstr arguments passed to the reboot(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. ๐Ÿ˜ญ
  • kloader doesn't support booting compressed kernels. no compressed kernels. not a thing. periodt. ๐Ÿ’€
  • The hpcarm port doesn't support kloader yet. 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