Make root on softraid installations boot out of the box on Raspberry Pis
authorkn <kn@openbsd.org>
Tue, 4 Apr 2023 08:31:35 +0000 (08:31 +0000)
committerkn <kn@openbsd.org>
Tue, 4 Apr 2023 08:31:35 +0000 (08:31 +0000)
Various files are put onto a pi's ESP, assuming root disk means boot disk,
which is not true for root on softraid(4).

Wrap the code in a loop over chunks (if any) or the single disk as before,
just like installboot(8) does.

OK mbuhl

distrib/arm64/ramdisk/install.md

index 0650822..e4a8a67 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: install.md,v 1.42 2023/04/03 10:51:50 kn Exp $
+#      $OpenBSD: install.md,v 1.43 2023/04/04 08:31:35 kn Exp $
 #
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@ NCPU=$(sysctl -n hw.ncpufound)
 MOUNT_ARGS_msdos="-o-l"
 
 md_installboot() {
-       local _disk=$1 _mdec _plat
+       local _disk=$1 _chunks _bootdisk _mdec _plat
 
        case $(sysctl -n machdep.compatible) in
        apple,*)                _plat=apple;;
@@ -59,19 +59,22 @@ md_installboot() {
                done)
                ;;
        rpi)
-               mount ${MOUNT_ARGS_msdos} /dev/${_disk}i /mnt/mnt
-               cp $_mdec/{bootcode.bin,start*.elf,fixup*.dat,*.dtb} /mnt/mnt/
-               cp $_mdec/u-boot.bin /mnt/mnt/
-               mkdir -p /mnt/mnt/overlays
-               cp $_mdec/disable-bt.dtbo /mnt/mnt/overlays
-               if [[ ! -f /mnt/mnt/config.txt ]]; then
-                       cat > /mnt/mnt/config.txt<<-__EOT
-                               arm_64bit=1
-                               enable_uart=1
-                               dtoverlay=disable-bt
-                               kernel=u-boot.bin
-                       __EOT
-               fi
+               _chunks=$(get_softraid_chunks)
+               for _bootdisk in ${_chunks:-$_disk}; do
+                       mount ${MOUNT_ARGS_msdos} /dev/${_bootdisk}i /mnt/mnt
+                       cp $_mdec/{bootcode.bin,start*.elf,fixup*.dat,*.dtb} /mnt/mnt/
+                       cp $_mdec/u-boot.bin /mnt/mnt/
+                       mkdir -p /mnt/mnt/overlays
+                       cp $_mdec/disable-bt.dtbo /mnt/mnt/overlays
+                       if [[ ! -f /mnt/mnt/config.txt ]]; then
+                               cat > /mnt/mnt/config.txt<<-__EOT
+                                       arm_64bit=1
+                                       enable_uart=1
+                                       dtoverlay=disable-bt
+                                       kernel=u-boot.bin
+                               __EOT
+                       fi
+               done
                umount /mnt/mnt
                ;;
        esac