From owner-freebsd-doc@FreeBSD.ORG Wed Aug 17 08:11:39 2011 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E1031065670; Wed, 17 Aug 2011 08:11:39 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mail.kirov.so-ups.ru (ns.kirov.so-ups.ru [178.74.170.1]) by mx1.freebsd.org (Postfix) with ESMTP id 700348FC12; Wed, 17 Aug 2011 08:11:37 +0000 (UTC) Received: from kas30pipe.localhost (localhost.kirov.so-cdu.ru [127.0.0.1]) by mail.kirov.so-ups.ru (Postfix) with SMTP id 62D06B8070; Wed, 17 Aug 2011 11:56:01 +0400 (MSD) Received: from kirov.so-cdu.ru (unknown [172.21.81.1]) by mail.kirov.so-ups.ru (Postfix) with ESMTP id 44043B8026; Wed, 17 Aug 2011 11:56:01 +0400 (MSD) Received: by ns.kirov.so-cdu.ru (Postfix, from userid 1010) id 29474B8F07; Wed, 17 Aug 2011 11:56:01 +0400 (MSD) Received: from [10.118.3.52] (elsukov.kirov.oduur.so [10.118.3.52]) by ns.kirov.so-cdu.ru (Postfix) with ESMTP id E2EB0B8EFF; Wed, 17 Aug 2011 11:56:00 +0400 (MSD) Message-ID: <4E4B7410.1020208@FreeBSD.org> Date: Wed, 17 Aug 2011 11:56:00 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla Thunderbird 1.5 (FreeBSD/20051231) MIME-Version: 1.0 References: <4E4B73C0.9040502@FreeBSD.org> In-Reply-To: <4E4B73C0.9040502@FreeBSD.org> X-Enigmail-Version: 1.2 Content-Type: multipart/mixed; boundary="------------080801010507080403030907" X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0284], KAS30/Release X-SpamTest-Info: Not protected Cc: freebsd-doc@freebsd.org, Marcel Moolenaar , Pawel Jakub Dawidek , Marius Strobl Subject: Re: RFC: BOOTSTRAPPING section to the gpart(8) X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 08:11:39 -0000 This is a multi-part message in MIME format. --------------080801010507080403030907 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit On 17.08.2011 11:54, Andrey V. Elsukov wrote: > Hi All, > > i've prepared the patch to the gpart(8) manual page. > It adds new section that describes bootcode images we have and > how to use them. Sorry, forgot the patch :) -- WBR, Andrey V. Elsukov --------------080801010507080403030907 Content-Type: text/plain; name="gpart.8.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gpart.8.diff" Index: head/sbin/geom/class/part/gpart.8 =================================================================== --- head/sbin/geom/class/part/gpart.8 (revision 224925) +++ head/sbin/geom/class/part/gpart.8 (working copy) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 6, 2011 +.Dd August 17, 2011 .Dt GPART 8 .Os .Sh NAME @@ -260,29 +260,21 @@ and .Fl i Ar index ) . Not all partitioning schemes have embedded bootstrap code, so the .Fl b Ar bootcode -option is scheme-specific in nature. -For the GPT scheme, embedded bootstrap code is supported. -The bootstrap code is embedded in the protective MBR rather than the GPT. +option is scheme-specific in nature (see the section entitled +.Sx BOOTSTRAPPING +below). The .Fl b Ar bootcode option specifies a file that contains the bootstrap code. The contents and size of the file are determined by the partitioning scheme. -For the MBR scheme, it is a 512 byte file of which the first 446 bytes -are installed as bootstrap code. The .Fl p Ar partcode option specifies a file that contains the bootstrap code intended to be written to a partition. -For the VTOC8 scheme, it is a 8192 byte file of which the last 7680 bytes -are installed as bootstrap code. The partition is specified by the .Fl i Ar index option. -For the VTOC8 scheme, if the -.Fl i Ar index -option is omitted, the bootstrap code is written to all sufficiently large -partitions. The size of the file must be smaller than the size of the partition. .Pp Additional options include: @@ -716,6 +708,85 @@ The scheme-specific attributes for PC98: .It Cm active .It Cm bootable .El +.Sh BOOTSTRAPPING +.Fx supports several partitioning schemes and each scheme uses different +bootstrap code. The bootstrap code is located in the specific disk area for +each partitioning scheme and also it might have different size. +.Pp +The bootstrap code could be separated into two types. The first one is +embedded in the partitioning scheme's metadata, the second type is located on +the specific partition. Not The embedding bootstrap code should be done only with +the +.Cm gpart bootcode +command with +.Fl b +option. The GEOM PART class has knowleage on how to embed bootstrap code into +specific partitioning scheme metadata without damage. +.Pp +The Master Boot Record (MBR) uses 512-bytes bootstrap code image, embedded into +partition table's metadata area. There are two variants of this bootstrap code: +.Pa /boot/mbr +and +.Pa /boot/boot0 . +The first one searches partition with +.Cm active +attribute (see the +.Sx ATTRIBUTES +section) in the partition table. Then it runs next bootstrap stage. The +.Pa /boot/boot0 +image contains a boot manager with some additional interactive functions. +.Pp +The BSD disklabel is usually created on top of the MBR partition (slice) +with type +.Cm freebsd +(see the +.Sx "PARTITION TYPES" +section). It uses 8 KB size bootstrap code image +.Pa /boot/boot , +embedded into partition table's metadata area. +.Pp +Both types of bootstrap code are used to boot from the GUID Partition Table. +First of all, a protective MBR is embedded into first disk sector from the +.Pa /boot/pmbr +image. +It searches the +.Cm freebsd-boot +partition (see the +.Sx "PARTITION TYPES" +section) in the GPT and runs next bootstrap stage from it. +The +.Cm freebsd-boot +partition should be smaller than 545 KB. +There are two variants of bootstrap code to write to this partition: +.Pa /boot/gptboot +and +.Pa /boot/gptzfsboot . +The first one is used to boot from UFS. +It searches in the GPT partition with type +.Cm freebsd-ufs , +and it runs the thrid bootstrap stage ( +.Pa /boot/loader ) +if it is found. +The +.Pa /boot/gptzfsboot +is used to boot from ZFS. +It searches partition with type +.Cm freebsd-zfs +and starts +.Pa /boot/zfsloader +from it. +.Pp +The VTOC8 scheme does not support embedding bootstrap code. +Instead, the 8 KBytes bootstrap code image +.Pa /boot/boot1 +could be written with +.Cm gpart bootcode +command with +.Fl p +option to all sufficiently large VTOC8 partitions. +To do this the +.Fl i Ar index +option could be ommited. .Sh OPERATIONAL FLAGS Actions other than the .Cm commit --------------080801010507080403030907--