Request for help: how do teach module building about kernel options?

Warner Losh imp at bsdimp.com
Wed Jan 4 01:32:43 UTC 2012


On Jan 3, 2012, at 5:12 PM, Adrian Chadd wrote:

> On 3 January 2012 15:31, Warner Losh <imp at bsdimp.com> wrote:
> 
>> Please find enclosed a proposed patch.  This will not build, of course, since there's no file in the tree mesh_baby.c, so if you have IEEE80211_SUPPORT_MESH defined, it won't work.  It keys off the actual define.
>> 
>> It even works with devices (which define DEV_xxx), but only if you have it in the options file like isa (eg, you need to tell config to generate it).
>> 
>> Comments?
> 
> I don't strictly need the SRCS line just yet - I can wrap it up in an
> if: (not correct make fu, but you get the idea):
> 
> .if (KERNOPT_IEEE80211_SUPPORT_MESH == 1)
> SRCS+= ieee80211_mesh.c
> .endif
> 
> .if (KERNOPT_IEEE80211_SUPPORT_TDMA == 1)
> SRCS+= ieee80211_tdma.c
> .endif

The problem with this method is the chicken/egg problem.  These defines aren't defined until after kmod.mk has been included.  But the kmod.mk files depend, in some places, on having a full list.  The SRCS_IEE80211_SUPPORT_MESH solves this problem nicely.

> What do you mean about DEV_xxx? Can you give me an example to look at
> in the sys directory?

isa.  Look at sys/conf/options* to see what I'm talking about.

Warner


More information about the freebsd-arch mailing list