For now, make the gpart commands verbose so we know exactly what's

being installed.

Fix problem with gpt + zfs installing the wrong loader...

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-12-15 23:16:27 +00:00
parent 68eadcec0f
commit 9b544478b1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326883

View File

@ -15,6 +15,11 @@ die() {
exit 1
}
doit() {
echo $*
eval $*
}
find-part() {
dev=$1
part=$2
@ -30,7 +35,7 @@ boot_nogeli_gpt_zfs_legacy() {
if [ -z "$idx" ] ; then
die "No freebsd-boot partition found"
fi
gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
doit gpart bootcode -b ${gpt0} -p ${gptzfs2} -i $idx $dev
exit 0
}
@ -42,7 +47,7 @@ boot_nogeli_gpt_ufs_legacy() {
if [ -z "$idx" ] ; then
die "No freebsd-boot partition found"
fi
gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
exit 0
}
@ -58,9 +63,9 @@ boot_nogeli_mbr_zfs_legacy() {
# search to find the freebsd-zfs partition within the slice
# Or just assume it is 'a' because it has to be since it fails otherwise
dd if=${dst}/boot/zfsboot of=/tmp/zfsboot1 count=1
gpart bootcode -b /tmp/zfsboo1 ${dev}s${s} # Put boot1 into the start of part
doit gpart bootcode -b /tmp/zfsboo1 ${dev}s${s} # Put boot1 into the start of part
sysctl kern.geom.debugflags=0x10 # Put boot2 into ZFS boot slot
dd if=${dst}/boot/zfsboot of=/dev/${dev}s${s} iseek=1 seek=1024
doit dd if=${dst}/boot/zfsboot of=/dev/${dev}s${s} iseek=1 seek=1024
sysctl kern.geom.debugflags=0x0
exit 0
@ -70,12 +75,12 @@ boot_nogeli_mbr_ufs_legacy() {
dev=$1
dst=$2
gpart bootcode -b ${mbr0} ${dev}
doit gpart bootcode -b ${mbr0} ${dev}
s=$(findpart $dev "freebsd-ufs")
if [ -z "$s" ] ; then
die "No freebsd-zfs slice found"
fi
gpart bootcode -p ${mbr2} ${dev}s${s}
doit gpart bootcode -p ${mbr2} ${dev}s${s}
exit 0
}