From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 12:26:21 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 880C41065677; Wed, 20 Jun 2012 12:26:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 5A6E18FC1F; Wed, 20 Jun 2012 12:26:21 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C2056B943; Wed, 20 Jun 2012 08:26:20 -0400 (EDT) From: John Baldwin To: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 07:44:57 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <201206200829.q5K8TPcK028907@svn.freebsd.org> In-Reply-To: <201206200829.q5K8TPcK028907@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201206200744.57808.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 20 Jun 2012 08:26:20 -0400 (EDT) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r237294 - user/ae/bootcode/sys/boot/i386/pmbr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 12:26:21 -0000 On Wednesday, June 20, 2012 4:29:25 am Andrey V. Elsukov wrote: > Author: ae > Date: Wed Jun 20 08:29:24 2012 > New Revision: 237294 > URL: http://svn.freebsd.org/changeset/base/237294 > > Log: > In case when we have damaged several first sectors, GEOM_PART_GPT class > will not detect GPT even if backup GPT header is ok. To recover we should > write PMBR to the LBA 0. But we can't use `gpart bootcode` command until > GPT is detected and geom created. We can dd(8) /boot/pmbr image and > kernel will be able detect GPT. But our PMBR image contains only empty > partition entries and our loader can't detect GPT when it hasn't the > partition record with type PMBR. > > Add one partition record to the PMBR image. It covers all space after > the LBA 0. It is better to have one partially correct record, than > have nothing. This latter part is not true. :( boot1 has a hardcoded partition in it (for use in dangerously dedicated mode). This has a mixed history. At one point the table entry it used caused certain SCSI BIOSes to crash due to a divide by zero (the SCSI BIOS read the MBR to try to guess what C/H/S geometry the rest of the system was expecting). I think having a hardcoded entry here can only really result in problems. I would rather you add some sort of 'restore' functionality to gpart that allowed it to build a PMBR 'from scratch' with a proper partition entry than to resort to this hack. -- John Baldwin