From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 08:29:25 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 752E41065672; Wed, 20 Jun 2012 08:29:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6193A8FC17; Wed, 20 Jun 2012 08:29:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K8TPnk028909; Wed, 20 Jun 2012 08:29:25 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K8TPcK028907; Wed, 20 Jun 2012 08:29:25 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206200829.q5K8TPcK028907@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 08:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: 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 08:29:25 -0000 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. Modified: user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Modified: user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s ============================================================================== --- user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Wed Jun 20 08:02:44 2012 (r237293) +++ user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Wed Jun 20 08:29:24 2012 (r237294) @@ -255,6 +255,16 @@ boot_uuid: .long 0x83bd6b9d .org DISKSIG,0x90 sig: .long 0 # OS Disk Signature .word 0 # "Unknown" in PMBR - -partbl: .fill 0x10,0x4,0x0 # Partition table + # Partition table +partbl: .byte 0x80 # bootable flag + .byte 0x00 # CHS address + .byte 0x02 # of first + .byte 0x00 # sector + .byte 0xee # Partition type PMBR + .byte 0xff # CHS address + .byte 0xff # of last + .byte 0xff # sector + .long 1 # LBA of first sector + .long 0xffffffff # LBA of last sector + .fill 0x10,0x3,0x0 # Remaining partition records .word MAGIC # Magic number