Boot2 loading process

Valentin Nechayev netch at
Sun Oct 15 01:33:14 PDT 2006

 Sat, Oct 14, 2006 at 21:15:55, jerrymc wrote about "Re: Boot2 loading process": 

> >> So my question is: where does the rest of the boot2 binary is located and how is it loaded ?
>> You skipped boot1 from attention. boot2 is loaded by boot1, not boot0.
> Not according to that piece of architecture documentation that was quoted.
> It says that boot1 is used only with floppy boots.

The doc is incorrect, or at least uses less detailed description. One
can see from code that boot0 loads _one_ sector from slice and calls
its code. Initial block of the bootable slice is identical to

$ dd if=/dev/ad0s1a bs=512 count=1 | head -c 446 | md5 -r
$ head -c 446 /boot/boot1 | md5 -r

And reading code in /usr/src/sys/boot/i386/boot2/boot1.S is enough
to see that it is the routine which loads 8K including boot2.

Maybe documentation clause (that boot0 loads boot2 directly) remains
from other version of boot0, or is used to simplify the description
(because boot1 is silent part and shows something only in case of
fatal error). But it's anyway too simplified as to reply to original
question in this thread.

This difference (boot0 loads boot2 directly or thru boot1) was vital
when 4.x and 5.x resides on the same disk. This was case for my home
machine a few years ago. Boot1 shall be the same version as boot2.
Changes in their interaction caused problem to load FreeBSD from
second slice (it was 5.x), that's why I had to use special boot setup.


More information about the freebsd-questions mailing list