From owner-freebsd-hackers Mon Jan 23 10:57:36 1995 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id KAA05171 for hackers-outgoing; Mon, 23 Jan 1995 10:57:36 -0800 Received: from cs.weber.edu (cs.weber.edu [137.190.16.16]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id KAA05163 for ; Mon, 23 Jan 1995 10:57:31 -0800 Received: by cs.weber.edu (4.1/SMI-4.1.1) id AA08997; Mon, 23 Jan 95 11:51:42 MST From: terry@cs.weber.edu (Terry Lambert) Message-Id: <9501231851.AA08997@cs.weber.edu> Subject: Re: writing bootcode; need a method To: mmead@goof.com (matthew c. mead) Date: Mon, 23 Jan 95 11:51:41 MST Cc: hackers@FreeBSD.org In-Reply-To: <199501230226.VAA08808@goof.com> from "matthew c. mead" at Jan 22, 95 09:26:25 pm X-Mailer: ELM [version 2.4dev PL52] Sender: hackers-owner@FreeBSD.org Precedence: bulk > > 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.