Re: "The installed loader is a binary, not a filesystem, so even minor changes require recompiling." -George W. Lucas in Absolute fBSD

From: Paul Procacci <pprocacci_at_gmail.com>
Date: Mon, 18 Dec 2023 20:50:21 UTC
On Mon, Dec 18, 2023 at 3:19 PM Jop <redc3ll@protonmail.com> wrote:

> Hello everyone,
>
> I have just begun my journey into FreeBSD using George W. Lucas' *Absolute
> FreeBSD *3rd edition*.* My question is about *chapter 4* *Start Me Up!
> The Boot Process,* page 51.
> I was befuddled by a statement he made, likely due to my IT nescience.
> To my confusion, Lucas states:
>
> > A BIOS has all sorts of limitations. The boot loader must reside in a very
> specific section of the disk. BIOS can’t boot from disks larger than 2.2TB.
> The target boot loader must be smaller than 512KB—huge by 1980
> >standards, yes, but paltry today. :::*The installed loader is a binary,
> not a filesystem, so even minor changes require recompiling *:::*.*
>
>
> Though this aspect of his introduction to FreeBSD is not about FreeBSD
> directly, it seems vital for me to understand this correctly so that I can
> aptly understand FreeBSD as a sheer operating system and how an operating
> system boots. I was confused about Lucas' description because he is
> implying there are *some *conditions in which a bootloader can be an
> actual *filesystem*. This appears very illogical to me, as to me he seems
> to be saying the loader itself should be something like FAT32, UFS, or ZFS.
> Though filesystems, if my understanding is correct, help us *organise *our
> data, they do not themselves *contain *data but rather offer an organised
> space *for *that data, like a library with empty bookshelves that we are
> ourselves to fill. Hence, if that "library" does not contain a bit of data
> (e.g. the bootloader) that tells the BIOS how to boot the operating system,
> the operating system cannot boot. Hence, it is logically implied that the
> bootloader cannot be called in itself a filesystem—not just *sometimes *under
> some conditions, but *ever*.
> As I trust Lucas' expertise, how have I misread him? What is he actually
> trying to say?
>
> I have searched online, and read a Wiki on bootloaders
> <https://en.wikipedia.org/wiki/Bootloader>and filesystems
> <https://en.wikipedia.org/wiki/Bootloader>, only to have my asinine
> interpretation confirmed.
>
> Now, one a second note, I am new to the FreeBSD community, I have not
> before used mailing lists, and the FreeBSD forums were down. I understand
> IT communities can be strict about what and how things are communicated,
> and I hope i have done right by sending this email. I hope that I have done
> sufficient research by searching online, consulting the WiKi pages, the
> mailing list archives, and of course Lucas' book. I hope that my question
> is on-topic enough and that my beginner-level will not stagnate the flow of
> your erudite communications. Should I have not utilised this mailing list
> properly, kindly accept my apologies and let me know.
>
> Sincerely,
>
> *J.*
>

Your comment is well written.  I'm afraid my response will fail in any
attempt to be as articulate as you.  -- Sorry in advance.

BIOS understands one thing; that is where to find an initial binary blob
(or MBR).  The binary that gets placed into that MBR we call a stage0
bootloader.  That MBR must exist for all operating systems in the same
place; it's how BIOS hands off control to an actual kernel.
The MBR doesn't live within any filesystem.  It's the first sector / first
block of a given boot disk, is always the same size and will always be
loaded into memory and executed as the first "task" BIOS does.

In the world of FreeBSD even though there can only ever be one MBR on a
given disk, that data that's stored within the MBR, can be exploited to
read other sectors off of a disk which could in turn load basic file system
functionality.
You can imagine once basic file system functionality is loaded, at that
point it's just a matter of calling the necessary bits to load other parts
of your loader.

FreeBSD differentiates these different stages as: stage0, stage1 ..., etc.

stage0 being more or less what I described above; it's the entrypoint for
BIOS.
stage1 and onward dealing with basic filesystem functionality (at least
initially) and then going from there.

When I refer to the term `bootloader', I generally use it in the context of
`stage0', though truthfully it could mean the entire process.

~Paul
-- 
__________________

:(){ :|:& };: