Install on octeon correctly copies /bsd to the MSDOS filesystem
where the manufacturer's boot program finds it

It appears that syspatch doesn't. If so, fixing this is important
because as it stands security patches won't actually be installed
in running systems.

This is an * untested * * conceptual * patch. My only octeon
system is my firewall. Another can be purchased if consensus is
that this should be tested here.

I haven't looked for update-link yet

geoff steckel

Index: Makefile.octeon
===================================================================
RCS file: /cvs/src/sys/arch/octeon/conf/Makefile.octeon,v
retrieving revision 1.49
diff -u -p -r1.49 Makefile.octeon
--- Makefile.octeon     9 Feb 2018 03:59:15 -0000       1.49
+++ Makefile.octeon     20 May 2019 17:40:17 -0000
@@ -28,6 +28,14 @@ S!=  cd ../../../..; pwd
 _machdir?=     $S/arch/${_mach}
 _archdir?=     $S/arch/${_arch}
 
+# as long as there is no boot program which loads from ufs,
+# we must copy any kernels to the FAT filesystem where the
+# manufacturer provided finds it
+# this script assumes a valid partition and filesystem exist
+
+BOOTROOTDIR?=  /mnt/
+BOOTROOTDEV?=  /dev/sd0i
+
 INCLUDES=      -nostdinc -I$S -I${.OBJDIR} -I$S/arch
 CPPFLAGS=      ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
 CWARNFLAGS=    -Werror -Wall -Wimplicit-function-declaration \
@@ -154,12 +162,22 @@ context.o cp0access.o exception.o locore
 lcore_access.o lcore_ddb.o lcore_float.o tlbhandler.o: assym.h
 mips64r2.o: assym.h
 
-hardlink-obsd:
+hardlink-obsd: mount_bootroot
        [[ ! -f /bsd ]] || cmp -s bsd /bsd || ln -f /bsd /obsd
+       [[ -z $BOOTROOTDIR && ! -f $BOOTROOTDIR/bsd ]] || \
+               cmp -s bsd $BOOTROOTDIR/bsd || \
+               ln -f $BOOTROOTDIR/bsd $BOOTROOTDIR/obsd
 
-newinstall:
+newinstall:    mount_bootroot
        umask 077 && cp bsd /nbsd && mv /nbsd /bsd && \
            sha256 -h /var/db/kernel.SHA256 /bsd
+       [[ -z $BOOTROOTDIR ]] || \
+           cp /bsd $BOOTROOTDIR/nbsd && \
+               mv $BOOTROOTDIR/nbsd $BOOTROOTDIR/bsd
+
+mount_bootroot:
+       [[ -z $BOOTROOTDIR ]] || \
+               mount -t $BOOTROOTDEV /mnt
 
 install: update-link hardlink-obsd newinstall
 

Reply via email to