Kernel boot process and root fs in minimal systems

From: Bryce <678yym_at_gmail.com>
Date: Fri, 26 Jul 2024 18:22:43 UTC
Hello list,

Ive been using FreeBSD for a few months now, and have been using Linux for
a few years. I've read some man pages and relevant sections of the manual.
I'm not opposed to RTFM, but please point to relevant sections.

So what I've gathered:

BSD has a 3 stage bootloader, stage 0 is obviously just for getting past
the one sector limit, stage 1 passes kernel configuration options(?) to
stage 3, which finds the kernel on the rootfs (which may be the network),
and passes stage 2 config onto the kernel (ie, what modules to load etc?).

Then, what I assume happens is that the kernel takes the config options
from stage 2 and mounts rootfs and then executes /init.

Is this correct, list? If so, is it possible to use a tmpfs-like filesystem
to mount rootfs in memory alone?

I know about md(4), and how it bakes the md image into the kernel. This is
what I'm looking for, but what about the bootloaders? do they need to be
configured to not look for rootfs on disk?

sorry if my questions are uninformed, I'm quite new. If somebody wants to
point me to the relevant sources in the source tree I'd be happy to read
them.

also, if this is the wrong list to be writing to, I apologize, I couldn't
find a more appropriate list.

thanks list.