stand: Update testing harness to start to use UFS labels

Minor changes to the non-geli UFS targets: migrate to using ufs labels
so we don't need to know the name of the device we booted off of. This
doesn't change the GELI test cass just yet since I've not tested them.
ZFS doesn't need these changes since we don't need to encode the device
for it.

Sponsored by:		Netflix
This commit is contained in:
Warner Losh 2022-08-15 12:09:55 -06:00
parent aff95057bc
commit 159b158a1d

View File

@ -15,14 +15,14 @@ dev=vtbd0
# and copies that into the ~150MB root images we create (we create the du
# size of the kernel + 20MB
#
# Sad panda sez: this runs as root, but could be userland if someone
# creates userland geli and zfs tools.
# Sad panda sez: this runs as root, but could be any user if someone
# creates userland geli.
#
# This assumes an external program install-boot.sh which will install
# the appropriate boot files in the appropriate locations.
#
# These images assume ${dev} will be the root image. We should likely
# use labels, but we don't.
# use labels, but we don't for all cases just yet (see GELI cases)
#
# Assumes you've already rebuilt... maybe bad? Also maybe bad: the env
# vars should likely be conditionally set to allow better automation.
@ -43,9 +43,9 @@ mk_nogeli_gpt_ufs_legacy() {
img=$2
cat > ${src}/etc/fstab <<EOF
/dev/${dev}p2 / ufs rw 1 1
/dev/ufs/root / ufs rw 1 1
EOF
makefs -t ffs -B little -s 200m ${img}.p2 ${src}
makefs -t ffs -B little -s 200m -o label=root ${img}.p2 ${src}
mkimg -s gpt -b ${src}/boot/pmbr \
-p freebsd-boot:=${src}/boot/gptboot \
-p freebsd-ufs:=${img}.p2 -o ${img}
@ -57,10 +57,10 @@ mk_nogeli_gpt_ufs_uefi() {
img=$2
cat > ${src}/etc/fstab <<EOF
/dev/${dev}p2 / ufs rw 1 1
/dev/ufs/root / ufs rw 1 1
EOF
make_esp_file ${img}.p1 ${espsize} ${src}/boot/loader.efi
makefs -t ffs -B little -s 200m ${img}.p2 ${src}
makefs -t ffs -B little -s 200m -o label=root ${img}.p2 ${src}
mkimg -s gpt \
-p efi:=${img}.p1 \
-p freebsd-ufs:=${img}.p2 -o ${img}
@ -72,10 +72,10 @@ mk_nogeli_gpt_ufs_both() {
img=$2
cat > ${src}/etc/fstab <<EOF
/dev/${dev}p3 / ufs rw 1 1
/dev/ufs/root / ufs rw 1 1
EOF
make_esp_file ${img}.p1 ${espsize} ${src}/boot/loader.efi
makefs -t ffs -B little -s 200m ${img}.p3 ${src}
makefs -t ffs -B little -s 200m -o label=root ${img}.p3 ${src}
# p1 is boot for uefi, p2 is boot for gpt, p3 is /
mkimg -b ${src}/boot/pmbr -s gpt \
-p efi:=${img}.p1 \
@ -208,9 +208,9 @@ mk_nogeli_mbr_ufs_legacy() {
img=$2
cat > ${src}/etc/fstab <<EOF
/dev/${dev}s1a / ufs rw 1 1
/dev/ufs/root / ufs rw 1 1
EOF
makefs -t ffs -B little -s 200m ${img}.s1a ${src}
makefs -t ffs -B little -s 200m -o label=root ${img}.s1a ${src}
mkimg -s bsd -b ${src}/boot/boot -p freebsd-ufs:=${img}.s1a -o ${img}.s1
mkimg -a 1 -s mbr -b ${src}/boot/boot0sio -p freebsd:=${img}.s1 -o ${img}
rm -f ${src}/etc/fstab
@ -221,10 +221,10 @@ mk_nogeli_mbr_ufs_uefi() {
img=$2
cat > ${src}/etc/fstab <<EOF
/dev/${dev}s2a / ufs rw 1 1
/dev/ufs/root / ufs rw 1 1
EOF
make_esp_file ${img}.s1 ${espsize} ${src}/boot/loader.efi
makefs -t ffs -B little -s 200m ${img}.s2a ${src}
makefs -t ffs -B little -s 200m -o label=root ${img}.s2a ${src}
mkimg -s bsd -p freebsd-ufs:=${img}.s2a -o ${img}.s2
mkimg -a 1 -s mbr -p efi:=${img}.s1 -p freebsd:=${img}.s2 -o ${img}
rm -f ${src}/etc/fstab
@ -235,10 +235,10 @@ mk_nogeli_mbr_ufs_both() {
img=$2
cat > ${src}/etc/fstab <<EOF
/dev/${dev}s2a / ufs rw 1 1
/dev/ufs/root / ufs rw 1 1
EOF
make_esp_file ${img}.s1 ${espsize} ${src}/boot/loader.efi
makefs -t ffs -B little -s 200m ${img}.s2a ${src}
makefs -t ffs -B little -s 200m -o label=root ${img}.s2a ${src}
mkimg -s bsd -b ${src}/boot/boot -p freebsd-ufs:=${img}.s2a -o ${img}.s2
mkimg -a 2 -s mbr -b ${src}/boot/mbr -p efi:=${img}.s1 -p freebsd:=${img}.s2 -o ${img}
rm -f ${src}/etc/fstab