From nobody Fri Jun 26 00:46:20 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gmcS14wRMz6jfHk for ; Fri, 26 Jun 2026 00:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gmcS11rcqz3yn9 for ; Fri, 26 Jun 2026 00:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782434785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6t5Q6kFkMb4FyH+zdVEwcHgZsiik2RQirk3e+PtQN9o=; b=x9fynmVgHkIcTrI7zg89b3/QGyjNG4nLRWImEJXiPOfoouyWkGo7ypYu8C6JHRBr7fLJhQ X4aKgvCO7gQlGj9Xvyu9qaxjhIO1MyXKP7gtbKCtGaZPvvAEKNskgwi44uB8y8TsOljkNj fFL9GwLCI4Q9rlifoM0L1iLmnV9TarLirmYQWZ17+1gYBpzHCVBq3m6KLGzy2aIQXYwilB VInYRhjfQmeLRiVyakGrY4gsLmhUJWfixGA28FQ5hHz3nvdHG0RmbKjnjS4TCVOZq0ID7A dgvx+1QiuAz71KUzbyMEbr55gG0tJV399DCzplDW2AKhZjng3ZLr8nz4hU5Pxw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782434785; a=rsa-sha256; cv=none; b=EH3lcsxeG7n5LnykmUr2tn96QLJx4Ujc0EGlaoh06xXs5wRjZw6OJNAc0w3HchHfi0zZgd 7p0V6Km6ULvS/hdLkXwBGSTMTaiSfw+8DqtKTBDPT9e0LqV0aoRVOp4NaZnIo1ZB1iQ+/Q aVeLezuA+7XaPk1TVVplo20tZZn03PtWac7rCX5VqukOWwAsx3uFt8iH6ea+ZKnWTjYPBb BBryGQqIRGjLY3Y30dr8KAkr8lhxQvh77eQkEGJaNlM1Qu6XB78emJPhdLk7GRGLsItGY3 iqiDS/O27lA9uZ20xk4AI1dIXxEs1rVE575RPEgJc6UDgLbYcCk3yRRRS+cjJA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782434785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6t5Q6kFkMb4FyH+zdVEwcHgZsiik2RQirk3e+PtQN9o=; b=CY1MP0yC4gmHbI6VJVMzXQcQTpMmorSxu/HS4RVkneuIC3s5IE/GmYGKjxt1lC0VDEopjO MYHAbLutjZEnAjFP5JrGGKSxBwBDgdeK4B1Unfgk685Vo2tFF1DG6hs5DPDTc69RIf3gWH oxCbODVKHjvHzzN8oOjsP3lf8B0KeYB6LoZEDrBYppdD2rJe9ini2VOvRaO/xLRXJa8BrM p2MBaBrfbBI53G14OIX6qnRxy1LzEIVVMPdf9ebirk0tIjkrt/jlsDmqzH8nUB5E9Ly7GE rWUNSMD5GB3RZ2ol9LacZjzEDVHlBleqc4KDHtHObuMj16zLn+xpD84+F2X7ng== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gmcS10dBgz8c for ; Fri, 26 Jun 2026 00:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3dd8f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 26 Jun 2026 00:46:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d946a88e0ce3 - main - build.7: explain how to build KBI-compatible standalone module List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d946a88e0ce347a9a6fdbfdae0b23ef192b9bddc Auto-Submitted: auto-generated Date: Fri, 26 Jun 2026 00:46:20 +0000 Message-Id: <6a3dcbdc.3dd8f.2ca4a8c@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d946a88e0ce347a9a6fdbfdae0b23ef192b9bddc commit d946a88e0ce347a9a6fdbfdae0b23ef192b9bddc Author: Konstantin Belousov AuthorDate: 2026-06-26 00:21:36 +0000 Commit: Konstantin Belousov CommitDate: 2026-06-26 00:44:46 +0000 build.7: explain how to build KBI-compatible standalone module Reviewed by: imp, kevans Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D57859 --- share/man/man7/build.7 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index 9db04f12c15a..0ec12cf33cbc 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -1116,6 +1116,46 @@ Rebuild and reinstall a single loadable kernel module, in this case cd /usr/src/sys/modules/sound make all install clean cleandepend KMODDIR=/boot/kernel .Ed +.Pp +Important detail is that the kernel binary interface is affected +by its configuration. +Modules build outside of the regular kernel build procedure still +must be built against the target kernel configuration, which is +defined by the set of the +.Pa opt_*.h +headers generated by +.Xr config 8 . +Use the +.Va KERNBUILDDIR +variable to point the module build to the configured kernel. +There is no need to actually build the configured kernel in +that directory, module build only consumes the headers from it. +.Pp +Additionally, the +.Va SYSDIR +environment variable may be useful to point to specific kernel source +tree used to build the target kernel, since the kernel headers +define the binary interface for modules. +.Pp +Assuming that the +.Fx +sources are located in the +.Pa /home/user/src +directory, the used kernel config is named +.Vd MY_KERNEL +and that the module sources are in +.Pa my-module +directory, the following sequence of the commands would populate +.Pa /home/user/my-kernel-builddir +directory with the +.Pa opt_*.h +headers and then build the module compatible with +.Vd MY_KERNEL . +.Bd -literal -offset -indent +config -d /home/user/my-kernel-builddir -s /home/user/src/sys/amd64/conf MY-KERNEL +cd my-module +make all KERNBUILDDIR=/home/user/my-kernel-builddir SYSDIR +.Ed .Ss Example 5: Quickly rebuild a kernel in place Quickly rebuild and reinstall the kernel, only recompiling the files changed since last build; note that this will only work if the full