Re: WITHOUT_MODULES, does it actually work?

From: Ben Kelly <ben_at_wanderview.com>
Date: Tue, 17 Nov 2009 20:47:40 -0500
On Nov 17, 2009, at 7:14 PM, Gonzalo Nemmi wrote:

> On Tue, Nov 17, 2009 at 8:14 PM, Ben Kelly <ben_at_wanderview.com> wrote:
> 
>> 
>> On Nov 17, 2009, at 5:21 PM, Gonzalo Nemmi wrote:
>> 
>>> I've been playing around with it (RC3, i386) and got it to look like
>>> this (/etc/make.conf):
>>> 
>>> WITHOUT_MODULES= dev/firewire dev/bwi dev/bce dev/bfe dev/iwi dev/iwn
>>> zfs sound/driver/ad1816 sound/driver/ai2s sound/driver/als4000
>>> sound/driver/atiixp sound/driver/audiocs sound/driver/cmi
>>> sound/driver/cs4281 sound/driver/cs4281 sound/driver/csa
>>> sound/driver/davbus sound/driver/ds1 sound/driver/emu10k1
>>> sound/driver/emu10kx sound/driver/envy24 sound/driver/envy24ht
>>> sound/driver/es137x sound/driver/ess sound/driver/fm801
>>> sound/driver/ich sound/driver/maestro3 sound/driver/mss
>>> sound/driver/neomagic sound/driver/sb16 sound/driver/sb8
>>> sound/driver/sbc sound/driver/solo sound/driver/spicds
>>> sound/driver/t4dwave sound/driver/uaudio sound/driver/via8233
>>> sound/driver/via82c686 sound/driver/vibes
>>> 
>>> Well .. I don't know what's wrong but no matter what, all of those
>>> modules and stuff still get built and end up under /boot/kernel ... I
>>> just need "sound" and "snd_hda"...
>>> 
>>> What am I doing wrong?
>>> Any hint will help
>> 
>> I think the contents of WITHOUT_MODULES should be the short names of the
>> directories in /usrc/src/sys/modules.  So iwn instead of dev/iwn.  Also, it
>> looks like you can only exclude modules at this top level directory
>> granularity.  So you can exclude sound, but not a particular device under
>> sound.
>> 
>> Anyway, thats based on a quick read of the Makefile.  I could be wrong,
>> though.  I've never actually used this feature.
>> 
>> Hope that helps.
>> 
>> - Ben
> 
> 
> Hi Ben!
> It could be that .. will try as soon as I can .. I didn't try before because
> most examples I found on google use it like that .. even the FreeBSD
> handbook:
> http://www.freebsd.org/doc/en/books/handbook/kernelconfig-building.html(take
> a look at the second "tip" in point 8.5).

I've just verified on my machine that WITHOUT_MODULES will only strip out top level module directories.  You cannot pick and choose subdirectories like the handbook suggests.  I'm guessing someone cut & paste the MODULES_OVERRIDE line to add the WITHOUT_MODULES entry.  Selecting subdirectories works in the MODULES_OVERRIDE case, though, because you can add a subdirectory even if the original list you are replacing only contains the top level module directories.

Also, the current implementation of WITHOUT_MODULES does not support being set in your kernel config using makeoptions.  This patch fixes that for me:

Index: sys/conf/kern.pre.mk
===================================================================
--- sys/conf/kern.pre.mk        (revision 254)
+++ sys/conf/kern.pre.mk        (working copy)
_at__at_ -163,6 +163,9 _at__at_
 .if defined(MODULES_OVERRIDE)
 MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
 .endif
+.if defined(WITHOUT_MODULES)
+MKMODULESENV+= WITHOUT_MODULES="${WITHOUT_MODULES}"
+.endif
 .if defined(DEBUG)
 MKMODULESENV+= DEBUG_FLAGS="${DEBUG}"
 .endif

Hope that helps.

- Ben
Received on Wed Nov 18 2009 - 00:47:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:58 UTC