6680633 zfs SPARC disk layout causes boot header and bootblk to claim blocks 15-31
authorgw25295
Mon, 07 Jul 2008 17:08:29 -0700
changeset 7050 cd1c0bdd0838
parent 7049 d0b1e2eb4ab5
child 7051 5368a8e0f1d9
6680633 zfs SPARC disk layout causes boot header and bootblk to claim blocks 15-31 6718165 installboot usage not updated to include changes to support ZFS boot
usr/src/psm/stand/bootblks/ufs/sparc/installboot.sh
usr/src/psm/stand/bootblks/zfs/common/boot-zfs.fth
usr/src/tools/scripts/bfu.sh
--- a/usr/src/psm/stand/bootblks/ufs/sparc/installboot.sh	Mon Jul 07 15:54:05 2008 -0700
+++ b/usr/src/psm/stand/bootblks/ufs/sparc/installboot.sh	Mon Jul 07 17:08:29 2008 -0700
@@ -32,21 +32,21 @@
 }
 
 COUNT=15
+FSTYPE=ufs
 
 while getopts F: a; do
+
 	case $a in
 	F) case $OPTARG in
-	   ufs) COUNT=15;;
-	   hsfs) COUNT=15;;
-	   zfs) COUNT=31;;
+	   ufs|hsfs|zfs) FSTYPE=$OPTARG;;
 	   *) away 1 "$OPTARG: Unknown fstype";;
 	   esac;;
-	?) away 1 "unknows fstype: $fs"
+	?) away 1 "unknown fstype: $fs"
 	esac
 done
 shift `expr $OPTIND - 1`
 
-Usage="Usage: `basename $0` bootblk raw-device"
+Usage="Usage: `basename $0` [-F fstype] bootblk raw-device"
 
 test $# -ne 2 && away 1 "$Usage"
 
@@ -59,4 +59,15 @@
 # label at block 0, bootblk from block 1 through 15
 stderr=`dd if=$BOOTBLK of=$DEVICE bs=1b oseek=1 count=$COUNT conv=sync 2>&1`
 err=$? ; test $err -ne 0 && away $err "$stderr"
+
+#
+# The ZFS boot block is larger than what will fit into the first 7.5K so
+# we break it up and write the remaining portion into the ZFS provided boot
+# block region at offset 512K
+#
+if [ $FSTYPE = "zfs" ]; then
+	stderr=`dd if=$BOOTBLK of=$DEVICE bs=1b iseek=$COUNT oseek=1024 \
+	    count=16 conv=sync 2>&1`
+	err=$? ; test $err -ne 0 && away $err "$stderr"
+fi
 exit 0
--- a/usr/src/psm/stand/bootblks/zfs/common/boot-zfs.fth	Mon Jul 07 15:54:05 2008 -0700
+++ b/usr/src/psm/stand/bootblks/zfs/common/boot-zfs.fth	Mon Jul 07 17:08:29 2008 -0700
@@ -33,7 +33,9 @@
 create doheaders
 create bigbootblk
 d# 8192  constant  /fs-fcode
-d# 8192  constant  fs-offset
+
+\ Set the offset to the correct zfs boot block area. This area is at offset 512K
+d# 512 d# 1024 * constant  fs-offset
 
 \ for [ifdef] zfs
 create zfs
--- a/usr/src/tools/scripts/bfu.sh	Mon Jul 07 15:54:05 2008 -0700
+++ b/usr/src/tools/scripts/bfu.sh	Mon Jul 07 17:08:29 2008 -0700
@@ -7442,11 +7442,18 @@
 		case $target_isa in
 		    sparc)
 			if [[ "$rootfstype" = zfs ]]; then
+				print "Extracting usr/sbin/installboot for " \
+				    "zfs boot block installation ... \c" |
+				    tee -a $EXTRACT_LOG
+				do_extraction $cpiodir/generic.usr$ZFIX \
+				    'usr/sbin/installboot' | \
+				    tee -a $EXTRACT_LOG
 				cd $usr/platform/$karch/lib/fs/zfs
 				get_rootdev_list | while read physlice
 				do
 					print "Installing bootblk on $physlice."
-                                        installboot -F zfs ./bootblk $physlice
+                                        $usr/sbin/installboot -F zfs ./bootblk \
+					    $physlice
                                 done
 			elif [[ "$rootslice" = /dev/rdsk/* ]]; then
 				print "Installing boot block on $rootslice."