From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 26 12:50:53 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E57291065673; Tue, 26 Jun 2012 12:50:53 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward1.mail.yandex.net (forward1.mail.yandex.net [IPv6:2a02:6b8:0:602::1]) by mx1.freebsd.org (Postfix) with ESMTP id B18658FC19; Tue, 26 Jun 2012 12:50:49 +0000 (UTC) Received: from smtp1.mail.yandex.net (smtp1.mail.yandex.net [77.88.46.101]) by forward1.mail.yandex.net (Yandex) with ESMTP id EDABC124170D; Tue, 26 Jun 2012 16:50:47 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1340715048; bh=GXt6cLLBcdsmnDtZzOzY0JG7K7AXBOo3qkBQU4UkcX8=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:Content-Type; b=RG8re+gV2O8Jx3iXAbs4BzMQK46lzG9HMVJA6nwAW+OCiY7PlTY1IoM9yeVQkN9Rj Qyzw6hZ24hlgB0hdlyyvGzuUN+jNxKzL5SpWX9mwaxingF743j9tw39LPHgvSrlHeO qIOX8Gf3js/SYE+IXGmdR0yx7cs8/7p+qD7dWS1c= Received: from smtp1.mail.yandex.net (localhost [127.0.0.1]) by smtp1.mail.yandex.net (Yandex) with ESMTP id 701C1AA0553; Tue, 26 Jun 2012 16:50:47 +0400 (MSK) Received: from ns.kirov.so-ups.ru (ns.kirov.so-ups.ru [178.74.170.1]) by smtp1.mail.yandex.net (nwsmtp/Yandex) with ESMTP id okAWnV8t-okAKNANs; Tue, 26 Jun 2012 16:50:47 +0400 X-Yandex-Rcpt-Suid: freebsd-current@freebsd.org X-Yandex-Rcpt-Suid: freebsd-hackers@freebsd.org X-Yandex-Rcpt-Suid: jhb@freebsd.org X-Yandex-Rcpt-Suid: dfr@freebsd.org X-Yandex-Rcpt-Suid: avg@FreeBSD.org X-Yandex-Rcpt-Suid: pjd@FreeBSD.org X-Yandex-Rcpt-Suid: steven.hartland@FreeBSD.org X-Yandex-Rcpt-Suid: olgeni@freebsd.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1340715047; bh=GXt6cLLBcdsmnDtZzOzY0JG7K7AXBOo3qkBQU4UkcX8=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: X-Enigmail-Version:Content-Type; b=ZHrcm1h7xF3ZdCs4k+Gj5xmTzBYcPALbz02XjFUF/Xfy+iHMw+6GjHmB5N25ue7s2 yCeJXBUpVGrPKC7iZk0+AgjxD5lLB1dxFwR7K2qU+52126/F+sjfX+0Aef/jEBRDLw 7451LxxoQxnHX17qyIUvvsQ0+e/LH+NxB1lnC6xE= Message-ID: <4FE9B01C.30306@yandex.ru> Date: Tue, 26 Jun 2012 16:50:36 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla Thunderbird 1.5 (FreeBSD/20051231) MIME-Version: 1.0 To: freebsd-current , freebsd-hackers X-Enigmail-Version: 1.4.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3DF35FE7979D7795EBCBB2D2" Cc: Doug Rabson , Pawel Jakub Dawidek , Andriy Gapon Subject: [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:50:54 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3DF35FE7979D7795EBCBB2D2 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable Hi All, 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. 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 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 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 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. 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. Any comments are welcome. --=20 WBR, Andrey V. Elsukov --------------enig3DF35FE7979D7795EBCBB2D2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJP6bAlAAoJEAHF6gQQyKF6yvwH/1+awIGkwRcAA/sKs1NGoEt7 85mZZ2t8KUKUy0Yjxe4p8doCVHQoeppBjEUChTW1yWncLWstOuoO/JQ8nUi8mlH5 WetoHH4dtShSuuaXB+N2dMv6g3ETyo0/uIMqX18V4FniLUXBwFjP2UnMc6JMJDkZ L7cUgTnvbeGU08GU9L6jDwA6xN/nwMSYN0U9fbGYbNhabtIL3JNb1MMsUAAwdijB a4EPPD3k4ZTOW/DBI+NQeYjpi3q0bEO1lmvEB/rSOq3ivMLxZHtV+Z9MMpEiPWTI q4eayZFalrT70RVjG/0Vxy3w0ISQcE5yfWMA0U2GLLt8k9kqPtePV8CH7pQXaHo= =1xLc -----END PGP SIGNATURE----- --------------enig3DF35FE7979D7795EBCBB2D2--