From: robert Date: Mon, 13 Sep 2021 11:49:21 +0000 (+0000) Subject: introduce /etc/bsd.re-config which can be used to configure the kernel X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ce828c7734ac54dd12c5724600fd65703f1f28be;p=openbsd introduce /etc/bsd.re-config which can be used to configure the kernel using config(8); the contents of this configuration file will be fed to config(8) after kernel relinking is done, so on the next boot the new kernel will have all the configuration changes set by the user this comes handy if you still want to use KARL while making changes to the GENERIC kernel diff from Paul de Weerd with input from several developers --- diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index d369abd0b58..e77191ea7bb 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1177 2021/09/13 05:17:04 robert Exp $ +# $OpenBSD: install.sub,v 1.1178 2021/09/13 11:49:21 robert Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer @@ -2858,7 +2858,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; \ + [ -f /etc/bsd.re-config ] && \ + config -e -c /etc/bsd.re-config -f bsd; \ + make newinstall" ) >/dev/null 2>&1 && echo " done." || echo " failed." fi diff --git a/etc/changelist b/etc/changelist index a13485e5b36..b6a7ec00da8 100644 --- a/etc/changelist +++ b/etc/changelist @@ -1,4 +1,4 @@ -# $OpenBSD: changelist,v 1.128 2021/07/30 07:00:02 bket Exp $ +# $OpenBSD: changelist,v 1.129 2021/09/13 11:49:21 robert Exp $ # # List of files which the security script backs up and checks # for modifications. @@ -14,6 +14,7 @@ /etc/bgpd.conf /etc/boot.conf /etc/bootparams +/etc/bsd.re-config /etc/changelist /etc/chio.conf /etc/crontab diff --git a/libexec/reorder_kernel/Makefile b/libexec/reorder_kernel/Makefile index 27929b291f0..dd0e7651b0e 100644 --- a/libexec/reorder_kernel/Makefile +++ b/libexec/reorder_kernel/Makefile @@ -1,6 +1,7 @@ -# $OpenBSD: Makefile,v 1.1 2017/08/21 21:24:11 rpe Exp $ +# $OpenBSD: Makefile,v 1.2 2021/09/13 11:49:21 robert Exp $ SCRIPT= reorder_kernel.sh +MAN= bsd.re-config.5 realinstall: ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ diff --git a/libexec/reorder_kernel/bsd.re-config.5 b/libexec/reorder_kernel/bsd.re-config.5 new file mode 100644 index 00000000000..58b42e63976 --- /dev/null +++ b/libexec/reorder_kernel/bsd.re-config.5 @@ -0,0 +1,46 @@ +.\" $OpenBSD: bsd.re-config.5,v 1.1 2021/09/13 11:49:21 robert Exp $ +.\" +.\" Copyright (c) 2021 Paul de Weerd +.\" +.\" 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: September 13 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 diff --git a/libexec/reorder_kernel/reorder_kernel.sh b/libexec/reorder_kernel/reorder_kernel.sh index 200edbfe7d3..ded689f095e 100644 --- a/libexec/reorder_kernel/reorder_kernel.sh +++ b/libexec/reorder_kernel/reorder_kernel.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: reorder_kernel.sh,v 1.9 2019/09/28 17:30:07 ajacoutot Exp $ +# $OpenBSD: reorder_kernel.sh,v 1.10 2021/09/13 11:49:21 robert Exp $ # # Copyright (c) 2017 Robert Peichaer # @@ -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 diff --git a/share/man/man8/boot_config.8 b/share/man/man8/boot_config.8 index 3e5d606e573..7816fd38cf0 100644 --- a/share/man/man8/boot_config.8 +++ b/share/man/man8/boot_config.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: boot_config.8,v 1.31 2019/09/06 21:30:32 cheloha Exp $ +.\" $OpenBSD: boot_config.8,v 1.32 2021/09/13 11:49:21 robert Exp $ .\" .\" Copyright (c) 1996 Mats O Jansson .\" All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: September 6 2019 $ +.Dd $Mdocdate: September 13 2021 $ .Dt BOOT_CONFIG 8 .Os .Sh NAME @@ -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 moj@stacken.kth.se diff --git a/usr.sbin/config/config.8 b/usr.sbin/config/config.8 index 8ea736645a9..6e51392a102 100644 --- a/usr.sbin/config/config.8 +++ b/usr.sbin/config/config.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: config.8,v 1.71 2021/03/08 02:47:29 jsg Exp $ +.\" $OpenBSD: config.8,v 1.72 2021/09/13 11:49:22 robert Exp $ .\" $NetBSD: config.8,v 1.10 1996/08/31 20:58:16 mycroft Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" from: @(#)config.8 8.2 (Berkeley) 4/19/94 .\" -.Dd $Mdocdate: March 8 2021 $ +.Dd $Mdocdate: September 13 2021 $ .Dt CONFIG 8 .Os .Sh NAME @@ -65,6 +65,11 @@ Similarly, the same editing can be done at boot-time, 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