From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 26 12:59:48 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F7A91065670; Tue, 26 Jun 2012 12:59:48 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id B82F38FC15; Tue, 26 Jun 2012 12:59:47 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id EBB45997; Tue, 26 Jun 2012 14:59:39 +0200 (CEST) Date: Tue, 26 Jun 2012 14:57:37 +0200 From: Pawel Jakub Dawidek To: "Andrey V. Elsukov" Message-ID: <20120626125737.GA1372@garage.freebsd.pl> References: <4FE9B01C.30306@yandex.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CE+1k2dSO48ffgeK" Content-Disposition: inline In-Reply-To: <4FE9B01C.30306@yandex.ru> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers , Doug Rabson , freebsd-current , Andriy Gapon Subject: Re: [CFC/CFT] large changes in the loader(8) code X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 12:59:48 -0000 --CE+1k2dSO48ffgeK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 26, 2012 at 04:50:36PM +0400, Andrey V. Elsukov wrote: > Hi All, >=20 > Some time ago i have started reading the code in the sys/boot. > Especially i'm interested in the partition tables handling. > I found several problems: > 1. There are several copies of the same code in the libi386/biosdisk.c > and common/disk.c, and partially libpc98/biosdisk.c. > 2. ZFS probing is very slow, because the ZFS code doesn't know how many > disks and partitions the system has: > http://www.freebsd.org/cgi/query-pr.cgi?pr=3D148296 > http://www.freebsd.org/cgi/query-pr.cgi?pr=3D161897 > 3. The GPT support doesn't check CRC and even doesn't know anything > about the secondary GPT header/table. Just a quick note here. At some point when I was adding GPT attributes to allow for test starts I greatly improved, at least parts of, the GPT implementation. I did implement support for both CRC checksum verification and fallback to backup GPT header when primary is broken. And the code is still in sys/boot/common/gpt.c. So my question would be what do you mean by this sentence? > So, i have created the branch and committed the changes: > http://svnweb.freebsd.org/base/user/ae/bootcode/ > The patch is here: > http://people.freebsd.org/~ae/boot.diff >=20 > What i already did: > 1. The partition tables handling now is machine independent, > and it is compatible with the kernel's GEOM_PART implementation. > There is new API for disk drivers in the loader to get information > about partitions and tables: > common/Makefile.inc > common/part.c > common/part.h >=20 > 2. The similar and general code from the disk drivers merged in the > disk.c: > common/disk.c > common/disk.h > i386/libi386/libi386.h > i386/libi386/biosdisk.c > userboot/test/test.c > userboot/userboot/userboot_disk.c > userboot/userboot.h > 3. ZFS code now uses new API and probing on the systems with many disks > should be greatly increased: > zfs/zfs.c > i386/loader/main.c > 4. The gptboot now searches the backup GPT header in the previous sectors, > when it finds the "GEOM::" signature in the last sector. PMBR code also > tries to do the same: > common/gpt.c > i386/pmbr/pmbr.s >=20 > 5. Also the pmbr image now contains one fake partition record. > When several first sectors are damaged the kernel can't detect GPT > (see RECOVERING section in the gpart(8)). We can restore PMBR with dd(1) > command, but the old pmbr image has an empty partition table and > loader doesn't able to boot from GPT, when there is no partition record > in the PMBR. Now it will be able. When pmbr is installed via 'gpart bootc= ode' > command, the kernel correctly modifies this partition record. So, this is= only > for the first rescue step. >=20 > 6. I have changed userboot interface. I guess there is none consumers exc= ept > the one test program. But if it isn't that, i can make it compatible. >=20 > Any comments are welcome. >=20 > --=20 > WBR, Andrey V. Elsukov >=20 >=20 --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --CE+1k2dSO48ffgeK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/pscEACgkQForvXbEpPzRnngCgzmPlaecRHxfJkLn4Q9MhzbmT +hsAoLf2biw+RP8N9qalavPbyhMnihnL =Yxgu -----END PGP SIGNATURE----- --CE+1k2dSO48ffgeK--