History log of /openbsd-current/usr.sbin/installboot/efi_softraid.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.4 07-Nov-2022 kn

Merge duplicate MD code into MI sr_open_chunk()

It does not have the prettiest signature, but nicely folds identical copies
into softraid.c, which then allows us to reuse sr_open_chunk() yet again in
an upcoming diff to make -p softraid aware (fixes arm64 installations).

Regress keeps passing.
Works fine on amd64, arm64 and sparc64.
"looks fine" mlarkin for whom this unbreaks a fresh arm64 softraid install


# 1.3 05-Oct-2022 kn

Skip softraid(4) keydisks

Keydisks appear as chunks internally (with special properties) and
installboot(8) thus treated them like actual data chunks.

Most users probably don't hit this as their keydisk is detached and thus
appears "offline" and gets skipped.

Installing to online keydisks may work but is neither expected nor intended
to work, so properly skip them.

Odd setups like keydisk and CRYPTO chunk on the same physical disk would
end up installing getting bootblocks installed twice.

Pointed out by Mikolaj Kucharski <mikolaj AT kucharski DOT name> who also
provided the actual diff (minor wording tweaks by me)

OK jsing


Revision tags: OPENBSD_7_2_BASE
# 1.2 29-Aug-2022 kn

softraid: make verbose messages -n/nowrite aware

Using installboot(8) in dry-run mode aka. -vn (verbose + nowrite) and first
reading "would install" followed by an "installing" made me uneasy.

Luckily, nothing was written in dry-run mode, it's just that the
softraid specific code fails to honour -n/nowrite.

So make sure it does and pull the printf out of `if (!nowrite)' so we
see the "would install" messages in dry-run mode in the first place.

Output diff for root on CRYPTO softraid on biosboot(8/amd64) to illustrate:

-# installboot -nv sd1
+# ./obj/installboot -nv sd1
would install bootstrap on /dev/rsd1c
using first-stage /usr/mdec/biosboot, second-stage /usr/mdec/boot
sd1: softraid volume with 1 disk(s)
+sd1: would install boot loader on softraid volume
/usr/mdec/boot is 6 blocks x 16384 bytes
-sd0a: installing boot blocks on /dev/rsd0c, part offset 144
+sd0a: would install boot blocks on /dev/rsd0c, part offset 144
master boot record (MBR) at sector 0
partition 3: type 0xA6 offset 64 size 488392001
/usr/mdec/biosboot will be written at sector 64

OK jsing


# 1.1 15-Aug-2022 kn

Add initial piece for softraid(4) support on arm64

arm64 is the only currently supported OpenBSD platform which both
a) supports booting off root on softraid(4) (kernel and bootloader) and
b) is an EFI platform (as far as installboot(8) is concerned).

Currently, installboot treats softraid root volumes as regular devices,
ignoring ignores chunk devices completely.

Teach installboot the first bits of softraid support for EFI:
installing the single-stage boot loader on chunks rather than the volume.

Copy over sparc64's softraid stage-1 code as-is and make its stage-2 a NOOP:

# ./obj/installboot -v sd4
Using / as root
installing bootstrap on /dev/rsd4c
using first-stage /usr/mdec/BOOTAA64.EFI
sd4: softraid volume with 1 disk(s)
sd0a: installing boot blocks on /dev/rsd0c
copying /usr/mdec/BOOTAA64.EFI to /tmp/installboot.KuBD4zkfpM/efi/boot/bootaa64.efi
writing /tmp/installboot.KuBD4zkfpM/efi/boot/startup.nsh

arm64 miniroot fits and boots with this.

OK stsp


As of now, EFI partitions must still be created manually as installboot's
'-p' does not support softraid at all (next missing piece for root on
softraid on arm64 installations to work out-of-the-box).


# 1.3 05-Oct-2022 kn

Skip softraid(4) keydisks

Keydisks appear as chunks internally (with special properties) and
installboot(8) thus treated them like actual data chunks.

Most users probably don't hit this as their keydisk is detached and thus
appears "offline" and gets skipped.

Installing to online keydisks may work but is neither expected nor intended
to work, so properly skip them.

Odd setups like keydisk and CRYPTO chunk on the same physical disk would
end up installing getting bootblocks installed twice.

Pointed out by Mikolaj Kucharski <mikolaj AT kucharski DOT name> who also
provided the actual diff (minor wording tweaks by me)

OK jsing


Revision tags: OPENBSD_7_2_BASE
# 1.2 29-Aug-2022 kn

softraid: make verbose messages -n/nowrite aware

Using installboot(8) in dry-run mode aka. -vn (verbose + nowrite) and first
reading "would install" followed by an "installing" made me uneasy.

Luckily, nothing was written in dry-run mode, it's just that the
softraid specific code fails to honour -n/nowrite.

So make sure it does and pull the printf out of `if (!nowrite)' so we
see the "would install" messages in dry-run mode in the first place.

Output diff for root on CRYPTO softraid on biosboot(8/amd64) to illustrate:

-# installboot -nv sd1
+# ./obj/installboot -nv sd1
would install bootstrap on /dev/rsd1c
using first-stage /usr/mdec/biosboot, second-stage /usr/mdec/boot
sd1: softraid volume with 1 disk(s)
+sd1: would install boot loader on softraid volume
/usr/mdec/boot is 6 blocks x 16384 bytes
-sd0a: installing boot blocks on /dev/rsd0c, part offset 144
+sd0a: would install boot blocks on /dev/rsd0c, part offset 144
master boot record (MBR) at sector 0
partition 3: type 0xA6 offset 64 size 488392001
/usr/mdec/biosboot will be written at sector 64

OK jsing


# 1.1 15-Aug-2022 kn

Add initial piece for softraid(4) support on arm64

arm64 is the only currently supported OpenBSD platform which both
a) supports booting off root on softraid(4) (kernel and bootloader) and
b) is an EFI platform (as far as installboot(8) is concerned).

Currently, installboot treats softraid root volumes as regular devices,
ignoring ignores chunk devices completely.

Teach installboot the first bits of softraid support for EFI:
installing the single-stage boot loader on chunks rather than the volume.

Copy over sparc64's softraid stage-1 code as-is and make its stage-2 a NOOP:

# ./obj/installboot -v sd4
Using / as root
installing bootstrap on /dev/rsd4c
using first-stage /usr/mdec/BOOTAA64.EFI
sd4: softraid volume with 1 disk(s)
sd0a: installing boot blocks on /dev/rsd0c
copying /usr/mdec/BOOTAA64.EFI to /tmp/installboot.KuBD4zkfpM/efi/boot/bootaa64.efi
writing /tmp/installboot.KuBD4zkfpM/efi/boot/startup.nsh

arm64 miniroot fits and boots with this.

OK stsp


As of now, EFI partitions must still be created manually as installboot's
'-p' does not support softraid at all (next missing piece for root on
softraid on arm64 installations to work out-of-the-box).