Hi all, On Tue, Sep 07, 2021 at 02:30:43PM +0200, Robert Nagy wrote: | /etc/reorder_kernel.conf
Thank you for your suggest Robert! In the mean time, I've had a few more off-list comments about this proposal - generally favorable, but no better suggestions have come along. After some more off-list discussion, I'm now proposing the below diff. It uses Theo's original suggestion of /etc/bsd.re-config. The diff includes: - the change to reorder_kernel, including a manpage for the file - the change to install.sub, so it works across installs and upgrades - references to the new manpage from config(8) and boot_config(8) - the changelist addition Any further feedback? Thanks, Paul Index: libexec/reorder_kernel/reorder_kernel.sh =================================================================== RCS file: /home/OpenBSD/cvs/src/libexec/reorder_kernel/reorder_kernel.sh,v retrieving revision 1.9 diff -u -p -r1.9 reorder_kernel.sh --- libexec/reorder_kernel/reorder_kernel.sh 28 Sep 2019 17:30:07 -0000 1.9 +++ libexec/reorder_kernel/reorder_kernel.sh 7 Sep 2021 16:12:07 -0000 @@ -63,6 +63,7 @@ fi cd $KERNEL_DIR/$KERNEL make newbsd +[ -f /etc/bsd.re-config ] && config -e -c /etc/bsd.re-config -f bsd make newinstall sync Index: libexec/reorder_kernel/bsd.re-config.5 =================================================================== RCS file: libexec/reorder_kernel/bsd.re-config.5 diff -N libexec/reorder_kernel/bsd.re-config.5 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ libexec/reorder_kernel/bsd.re-config.5 7 Sep 2021 16:16:28 -0000 @@ -0,0 +1,46 @@ +.\" $OpenBSD$ +.\" +.\" Copyright (c) 2021 Paul de Weerd <we...@weirdnet.nl> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: August 24 2021 $ +.Dt KERNEL.CONF 5 +.Os +.Sh NAME +.Nm bsd.re-config +.Nd kernel configuration file +.Sh DESCRIPTION +The +.Nm +file contains configuration information for the kernel. +If present, it is used during system startup to configure the kernel +that will be running at the next boot. +It can be used to enable or disable specific devices in the kernel. +.Sh EXAMPLES +To enable the +.Xr ipmi 4 +driver, add the following line to +.Nm : +.Pp +.Dl enable ipmi +.Pp +See +.Xr config 8 +for more details on how to configure the kernel. +.Sh FILES +.Bl -tag -width /etc/bsd.re-config -compact +.It Pa /etc/bsd.re-config +Kernel configuration file. +.Sh SEE ALSO +.Xr config 8 Index: libexec/reorder_kernel/Makefile =================================================================== RCS file: /home/OpenBSD/cvs/src/libexec/reorder_kernel/Makefile,v retrieving revision 1.1 diff -u -p -r1.1 Makefile --- libexec/reorder_kernel/Makefile 21 Aug 2017 21:24:11 -0000 1.1 +++ libexec/reorder_kernel/Makefile 7 Sep 2021 16:11:13 -0000 @@ -1,6 +1,7 @@ # $OpenBSD: Makefile,v 1.1 2017/08/21 21:24:11 rpe Exp $ SCRIPT= reorder_kernel.sh +MAN= bsd.re-config.5 realinstall: ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ Index: distrib/miniroot/install.sub =================================================================== RCS file: /home/OpenBSD/cvs/src/distrib/miniroot/install.sub,v retrieving revision 1.1175 diff -u -p -r1.1175 install.sub --- distrib/miniroot/install.sub 29 Aug 2021 13:31:52 -0000 1.1175 +++ distrib/miniroot/install.sub 7 Sep 2021 16:10:30 -0000 @@ -2857,7 +2857,10 @@ finish_up() { tar -C $_kernel_dir -xzf $_kernel_dir.tgz $_kernel rm -f $_kernel_dir.tgz chroot /mnt /bin/ksh -e -c "cd ${_kernel_dir#/mnt}/$_kernel; \ - make newbsd; make newinstall" + make newbsd; \ + [ -e /etc/bsd.re-config ] && \ + config -e -c /etc/bsd.re-config -f bsd; \ + make newinstall" ) >/dev/null 2>&1 && echo " done." || echo " failed." fi Index: etc/changelist =================================================================== RCS file: /home/OpenBSD/cvs/src/etc/changelist,v retrieving revision 1.128 diff -u -p -r1.128 changelist --- etc/changelist 30 Jul 2021 07:00:02 -0000 1.128 +++ etc/changelist 7 Sep 2021 16:10:53 -0000 @@ -14,6 +14,7 @@ /etc/bgpd.conf /etc/boot.conf /etc/bootparams +/etc/bsd.re-config /etc/changelist /etc/chio.conf /etc/crontab Index: share/man/man8/boot_config.8 =================================================================== RCS file: /home/OpenBSD/cvs/src/share/man/man8/boot_config.8,v retrieving revision 1.31 diff -u -p -r1.31 boot_config.8 --- share/man/man8/boot_config.8 6 Sep 2019 21:30:32 -0000 1.31 +++ share/man/man8/boot_config.8 7 Sep 2021 16:12:45 -0000 @@ -60,6 +60,12 @@ UKC> .Pp Changes made can be saved for the next reboot, by using .Xr config 8 . +However, those would not be persisted across system upgrades and would +prevent kernel relinking. +To ensure these changes are carried over to upgraded kernels, they can +be save to the +.Xr bsd.re-config 5 +configuration file. .Sh COMMANDS .Bl -tag -width "disable devno | dev" .It Ic add Ar dev @@ -189,6 +195,7 @@ Continuing... mainbus0 (root) .Ed .Sh SEE ALSO +.Xr bsd.re-config 5 .Xr config 8 .Sh AUTHORS .An Mats O Jansson Aq Mt m...@stacken.kth.se Index: usr.sbin/config/config.8 =================================================================== RCS file: /home/OpenBSD/cvs/src/usr.sbin/config/config.8,v retrieving revision 1.71 diff -u -p -r1.71 config.8 --- usr.sbin/config/config.8 8 Mar 2021 02:47:29 -0000 1.71 +++ usr.sbin/config/config.8 7 Sep 2021 16:13:19 -0000 @@ -65,6 +65,11 @@ Similarly, the same editing can be done using the in-kernel editor, as described in .Xr boot_config 8 . +Note that any such edits will be lost during upgrades and prevent a newly +linked kernel from being installed at boot time. +For such cases, this process can also be automated during boot using the +.Xr bsd.re-config 5 +configuration file. .Pp For kernel building, the options are as follows: .Bl -tag -width Ds @@ -436,6 +441,7 @@ was given, else ignore changes). .Sh SEE ALSO .Xr options 4 , .Xr files.conf 5 , +.Xr bsd.re-config 5, .Xr boot.conf 8 , .Xr boot_config 8 .Pp -- >++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+ +++++++++++>-]<.>++[<------------>-]<+.--------------.[-] http://www.weirdnet.nl/