Date: Wed, 13 Dec 2023 09:25:25 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 275741] sys/modules: Fix processing of WITHOUT_MODULES Message-ID: <bug-275741-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275741 Bug ID: 275741 Summary: sys/modules: Fix processing of WITHOUT_MODULES Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: freebsd@kumba.dev The handling of WITHOUT_MODULES in the FreeBSD kernel build system is curre= ntly suboptimal. At present, it is only possible to exclude kmods at the top-le= vel of /usr/src/sys/modules from being built with this variable. If a kmod is = in a subdirectory, then it is built regardless if it is listed in WITHOUT_MODULE= S.=20 I have tried several forms of specifying subdirectory kmods in this variabl= e to avoid building them, but none of them work. The crux of the issue is because the only processing of this variable is do= ne in /usr/src/sys/modules/Makefile, and it is a simple loop that iterates over WITHOUT_MODULES and removes any entries from the SUBDIR variable *only* in = that top-level Makefile. For kmods in subdirectories that have their own Makefi= les that define SUBDIR, no processing of WITHOUT_MODULES takes place, so they w= ill always be built. A previous attempt to tackle this issue was found in PR#76225, and the last comment says this was all fixed back in Jan 2005, however, this fix may have been undone at some point, as the current Makefile logic is not capable of excluding kmods in lower-level subdirectories from being built. The issue was again highlighted by PR#210143, but the reporter did not prov= ide a recommended fix or any patches, and the reporter eventually self-closed t= he PR due to feedback timeout (by developers?). I have made an effort to fix this in the attached patch by taking several steps: 1. Move the WITHOUT_MODULES for loop to a new mk file in /usr/src/sys/conf = and call it "kmod.without.mk". The loop is expanded to process kmod names as either a top-level name under /usr/src/sys/modules, or as a path relative to that directory. 2. Include this new mk file in every Makefile that defines a SUBDIR variabl= e in /usr/src/sys/modules. 3. Update the make.conf(5) manpage to specify the way kmods can be excluded from building via this variable. I've made the patch against -CURRENT (git HEAD), but I've only tested again= st one of my 14.0-RELEASE systems, as I don't actively run -CURRENT on any mac= hine at present. My systems use a custom kernel config that inherits from GENER= IC, and install to /boot/kernel.custom. After fixing the processing of WITHOUT_MODULES, I've been able to knock the size of /boot/kernel.custom do= wn to ~47MB, and I can probably get it smaller once I deep dive whether that particular system needs any of the i2c or other ancillary bus drivers. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-275741-227>