svn commit: r237294 - user/ae/bootcode/sys/boot/i386/pmbr
Andrey V. Elsukov
ae at FreeBSD.org
Wed Jun 20 08:29:25 UTC 2012
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
More information about the svn-src-user
mailing list