Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Installing on LFS



Hi,

      The way amd64 (and i386) boots is that code in the first sector
(sector 0) looks for the NetBSD partition (type 169) and simply
reads the first 14(?) sectors from there and executes it.  If it
is NetBSD's code in sector 0, then there may or may not be an OS
selection menu.  However, it's not critical that it be NetBSD's
code as they all do the same thing.  The code that is read by the
code in sector 0 comes from the bootxx_<fstype> files.  That code
is responsible for finding and loading /boot, and is the first bit
of code that actually needs to understand the filesystem.  /boot
in turn, loads /boot.cfg, presents the menu if any, and loads and
executes the kernel.

      Just as a side note, /boot puts the system into 32-bit mode.
Prior to that, the system is in real mode (essentially behaving
like an ancient IBM PC with an 8086 processor).  The amd64 kernel
is responsible for putting the system into 64-bit mode.

Some minor corrections:

You are mixing up the MBR code and the partition boot (PBR) code
a bit.  The BIOS reads the first sector of the device and simply
jumps to that code.  (Well, some BIOSs try to do something else
with the data from this first sector like determining the disk
geometry, but for now we can ignore this.)

Assuming MBR partitions, this first sector holds a partition table
of at most 4 partitions.  Depending on what code was installed there,
it may or may not present a boot menu, where you can select the
partition to boot, or boot a preselected partition (the so
called active one.)  Booting from a partition in this context
means to read the first sector of that partition and jumping to
that code.  That code is then responsible for booting the OS
installed on that partition.

In the NetBSD case it reads in the rest of the first 8k of the
partition (i.e. it reads 15 additional sectors.)  Whether or not
bootxx_<fstype> understands the filesystem depends.  If it does
not, the sectors containing /boot are patched into the code
in these first 8k by installboot.  On i386/amd64 most of these
files do understand the filesystem; that's why you need different
code depending on the filesystem.

Ciao,
Wolfgang
--
Wolfgang%Solfrank.net@localhost				Wolfgang Solfrank


Home | Main Index | Thread Index | Old Index