Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Oct 2006 11:33:06 +0300
From:      Valentin Nechayev <netch@lucky.net>
To:        Jerry McAllister <jerrymc@msu.edu>
Cc:        Jan Pfeifer <jan.pfeifer@yahoo.com.br>, freebsd-questions@freebsd.org
Subject:   Re: Boot2 loading process
Message-ID:  <20061015083306.GA7624@lucky.net>
In-Reply-To: <20061015011555.GB25929@gizmo.acns.msu.edu>
References:  <20061014164101.8507.qmail@web52113.mail.yahoo.com> <20061014183053.GA6898@lucky.net> <20061015011555.GB25929@gizmo.acns.msu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
 Sat, Oct 14, 2006 at 21:15:55, jerrymc wrote about "Re: Boot2 loading proc=
ess":=20

> >> 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.
>  www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/book.html#BOOT-B=
OOT0
> 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
/boot/boot1:

$ dd if=3D/dev/ad0s1a bs=3D512 count=3D1 | head -c 446 | md5 -r
42b4daabbfea8c8d3ec45e24b340868a
$ head -c 446 /boot/boot1 | md5 -r
42b4daabbfea8c8d3ec45e24b340868a

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
=66rom 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.


-netch-



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061015083306.GA7624>