On Sat, Mar 25, 2023 at 07:02:24PM +0000, Klemens Nanni wrote:
> Call the function argument `_disk' and construct full device paths where
> needed, so that other code can reuse the mnemonic variable.
>
> This matches install.sub's convention around ROOTDISK=sd0, ROOTDEV=sd0a and
> other disk/device code.
>
> Since it touches the installboot block, hoist it before the sysctl block
> which merely assigns `_plat'.
>
> A future diff then turns out much better.
> - dd if=$_mdec/u-boot-sunxi-with-spl.bin of=${_disk}c \
> + dd if=$_mdec/u-boot-sunxi-with-spl.bin of=/dev/${_disk}c \
Just noticed that this should use the raw device as done elsewhere across
distrib/ and explained in INSTALL.* docs.
Easily missed before the diff, obvious with it.
OK?
Index: ramdisk/install.md
===================================================================
RCS file: /cvs/src/distrib/arm64/ramdisk/install.md,v
retrieving revision 1.37
diff -u -p -r1.37 install.md
--- ramdisk/install.md 25 Mar 2023 18:29:37 -0000 1.37
+++ ramdisk/install.md 25 Mar 2023 19:06:43 -0000
@@ -36,7 +36,13 @@ NCPU=$(sysctl -n hw.ncpufound)
MOUNT_ARGS_msdos="-o-l"
md_installboot() {
- local _disk=/dev/$1 _mdec _plat
+ local _disk=$1 _mdec _plat
+
+ if ! installboot -r /mnt $_disk; then
+ echo "\nFailed to install bootblocks."
+ echo "You will not be able to boot OpenBSD from ${_disk}."
+ exit
+ fi
case $(sysctl -n machdep.compatible) in
apple,*) _plat=apple;;
@@ -44,12 +50,6 @@ md_installboot() {
raspberrypi,*) _plat=rpi;
esac
- if ! installboot -r /mnt ${1}; then
- echo "\nFailed to install bootblocks."
- echo "You will not be able to boot OpenBSD from ${1}."
- exit
- fi
-
# Apply some final tweaks on selected platforms
_mdec=/usr/mdec/$_plat
@@ -65,11 +65,11 @@ md_installboot() {
fi
;;
pine64)
- dd if=$_mdec/u-boot-sunxi-with-spl.bin of=${_disk}c \
+ dd if=$_mdec/u-boot-sunxi-with-spl.bin of=/dev/r${_disk}c \
bs=1024 seek=8 status=none
;;
rpi)
- mount ${MOUNT_ARGS_msdos} ${_disk}i /mnt/mnt
+ 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