For Raspberry Pis the installer puts various file onto the ESP, assuming
root disk and boot disk are the same.

With root on softraid(4) that's not true;  loop over possible chunks if any
or the single disk as before, just like installboot(8) works.

This means no behaviour change for plain installs, but working boot for
softraid installs.

'cvs diff -b -U0':

        @@ -39 +39 @@ md_installboot() {
        -       local _disk=$1 _mdec _plat
        +       local _disk=$1 _chunks _bootdisk _mdec _plat
        @@ -62 +62,3 @@ md_installboot() {
        -               mount ${MOUNT_ARGS_msdos} /dev/${_disk}i /mnt/mnt
        +               _chunks=$(get_softraid_chunks)
        +               for _bootdisk in ${_chunks:-$_disk}; do
        +                       mount ${MOUNT_ARGS_msdos} /dev/${_bootdisk}i 
/mnt/mnt
        @@ -74,0 +77 @@ md_installboot() {
        +               done

(I have yet to dig out my rpi4, fix the console cable and test myself...)

Feedback? OK if it works for both plain and softraid?

Index: install.md
===================================================================
RCS file: /cvs/src/distrib/arm64/ramdisk/install.md,v
retrieving revision 1.42
diff -u -p -r1.42 install.md
--- install.md  3 Apr 2023 10:51:50 -0000       1.42
+++ install.md  3 Apr 2023 13:47:11 -0000
@@ -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

Reply via email to