From nobody Sun Jun 28 23:59:14 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 4gpRGB554xz6jSk1 for ; Sun, 28 Jun 2026 23:59:14 +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 4gpRGB47yBz3TWG for ; Sun, 28 Jun 2026 23:59:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782691154; 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=+GYQe29acKbdt7YMtqLQ8SpPIgY+BhzFLPq4MwR9/TI=; b=RHNcWgu7Bl6a+AN7vVxBTkiHfEMuU+igKQBmXtzwbzul/k3ncGscgNqOiyY7GTGpSheBJI h9ap9yKwZFzVNN9zM/s+3q6w/VItaSn9/AfOjjTxvom/nIuEu9VyYKaZpVrARYU67ODlzQ qQUwzRItI5aQA2Y1HVsBMCYDPTgFovj7SsvQTmT7OvcouF+hksk+TRRl02DRFHf0cD3bR7 Z2t1dqqTmKN3Hcem+XGUL9JjCBDQPDQh1ZutFOH3DEE3FlnCLjLgnVF41nGh0kvWX/BvGo 8cjLkjmu3uPfVkVnhXH3uAFfJSmqs68PkpdxkFf/I7w5YRXmoNpCTAO9lJkWLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782691154; a=rsa-sha256; cv=none; b=ukK3he4+/MyEBaY5V9aJB5XbbJAJJQBiesLYe+th2By7Sr9j6FGuKxtVpDqNxb2QjVFhkd AwLjM5BSHRzxAWfyzFVydccFnieVJFC/AM5BgOpbkBZy2FO9istuGIydCeFU5LxzXugLXl EaiI9huYrEymmpTKNZA/il2fmX7Qr4AJKfZG6ZtRDkCqHE1mC7g6ukFJ92qFTbCL+cdKCs zq+jHN/1ZurYQoqBnXkPf+C4X3ZbkvHdbENw/IFEIKF2tOgFwjWhOUN0OtE7KQoNB3lQLD dARjtgSaB5NSd0L5OjS1ECfNaqpPud54DnccHl/sZixL2m6eFxCgjRSkx9P9FQ== 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=1782691154; 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=+GYQe29acKbdt7YMtqLQ8SpPIgY+BhzFLPq4MwR9/TI=; b=rDTI3z0R/hJ/a00SPA4xIREYTIQMSTRomZ7XtG9+fnuviy7BD4lay8HsaYKu7N++kxlHoO odBBAJ8y3m6+sQJkF6NLiv3gsZTA7lLbOOBol/dCIrsEOoDWkTyCGw1PX1fctKx9LSO2lv E585Wnw4wIABFz1KtPIyLlZNhsA7XsPY8OSWCgOQPF40yoN3OQHv5Fsu/X+lfq7bkC/Mc7 V3gzO48IncZigSmcHGOUFwUEicCVD3HEaJiWfwc0f73IsR316DWsEWRkI0Dgxo6iS9RQ5k fKEzWZjf3cBUptXtR9UbIgSASG6WmzWsPLD9LZmu21qnmMYeA3U6qqsrE1fKqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gpRGB2mq3zY6D for ; Sun, 28 Jun 2026 23:59:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 45521 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 28 Jun 2026 23:59:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4d8f2d291299 - stable/15 - 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/stable/15 X-Git-Reftype: branch X-Git-Commit: 4d8f2d2912997fc2403c723704888335d2efdb68 Auto-Submitted: auto-generated Date: Sun, 28 Jun 2026 23:59:14 +0000 Message-Id: <6a41b552.45521.57d400b7@gitrepo.freebsd.org> The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4d8f2d2912997fc2403c723704888335d2efdb68 commit 4d8f2d2912997fc2403c723704888335d2efdb68 Author: Konstantin Belousov AuthorDate: 2026-06-26 00:21:36 +0000 Commit: Konstantin Belousov CommitDate: 2026-06-28 21:43:29 +0000 build.7: explain how to build KBI-compatible standalone module (cherry picked from commit d946a88e0ce347a9a6fdbfdae0b23ef192b9bddc) --- 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 4995400f70dc..07f28daa7041 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -1102,6 +1102,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