Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jan 95 11:51:41 MST
From:      terry@cs.weber.edu (Terry Lambert)
To:        mmead@goof.com (matthew c. mead)
Cc:        hackers@FreeBSD.org
Subject:   Re: writing bootcode; need a method
Message-ID:  <9501231851.AA08997@cs.weber.edu>
In-Reply-To: <199501230226.VAA08808@goof.com> from "matthew c. mead" at Jan 22, 95 09:26:25 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
>     Does anyone know how to write the FreeBSD bootcode despite the fact that
> disklabel doesn't like the way sysinstall sets up the drives?  My setup is
> this: I have an IDE drive (for a couple doom games and such), so I still want
> FreeBSD to boot off sd0.  I need to put the bootmanager on the wd0 drive, and
> then to run FreeBSD, point it to disk 2.  Then I've got to manually type in
> hd(1,a)/kernel each time it boots.  I know how to modify the bootcode and
> rebuild it, but disklabel won't write the bootcode, cause it doesn't like how
> sysinstall set things up...  Any ideas?

Examining a disk:

,---.--------------------------.----------------------------.
| A | B                        | C                          |
`---'--------------------------'----------------------------'

A)	DOS MBR (Master Boot Record) containing BIOS boot
	code and a DOS partition table.
B)	Some non-BSD partition.
C)	The BSD paritition for our example.


Examining a BSD partition:

,---.---.----------------.----------------.
| 1 | 2 | 3              | 4 ...          |
`---'---'----------------'----------------'

1)	BSD second stage boot.
2)	BSD disklabel.
3)	BSD slice 'a'.
4)	BSD subsequent slices.


Examining a BSD disklabel:

,-----------.
| a         |
.-----------.
| b | c | d |
.---+---+---.
| b | c | d |
`-----------'

a)	Per BSD partition information
		BIOS apparent geometry (obsolete, but still used)
		BAD144 info (broken in FreeBSD 2.x)
b)	C/H/S value for a particular slice
c)	absolute sector offset for a particular slice
d)	absolute length in sectors

There are three required slices, which BSD calls 'a', 'c', and 'd':

o	Slice 'a' is the root (/) partition from which the kernel
	is loaded.
o	Slice 'c' is the entire DOS partition containing BSD information.
o	Slice 'd' is the entire disk, including the MBR and everything
	else on the disk (other partitions, etc.).


When you write the boot code, the disklabel is used to locate the start
of the BSD partition and write the boot code there.

Without a disklabel, this is impossible, since there is no way to know
where the parition starts.


This is the current approach.  It's actually the wrong approach, since
it should be possible for the running OS to decode the DOS partition
table information -- the 'c' and 'd' slices are truly antiquated space
wasters.  It's even worse when you have to define a disklabel entry
for a DOS partition, when all of the needed info is already stored
elsehere.


For right now, you are required to have a disklabel before proceeding.


					Terry Lambert
					terry@cs.weber.edu
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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