adding preprocessor defines in module makefiles

Dave Hylands dhylands at gmail.com
Fri Sep 9 01:01:38 EDT 2011


Hi Christopher,

On Thu, Sep 8, 2011 at 7:29 AM, Christopher Harvey
<chris at basementcode.com> wrote:
> Hi,
>
> I'm trying to build a kernel module for fun, and I can't figure out a
> clean way to add preprocessor defines that correspond to Kconfig values.
> I'm trying to set CONFIG_SND_DEBUG specifically. My module has only one
> file, and I've tried adding #define CONFIG_SND_DEBUG as the first line
> in the .c file, but now I'm getting the following warning:
> WARNING: "__snd_printk" [/home/chris/snd/snd-foo.ko] undefined!
>
> I haven't compiled the kernel running on my system with the
> CONFIG_SND_DEBUG option but I haven't been able to see a reason why that
> should change anything for my module.

You need to set this in your config file (using make menuconfig or one
of the other variants) and quite probably rebuild the kernel with that
option set in order to ensure that snd_xxx functions are compiled into
the kernel.

Trying to defined CONFIG_xxx options will generally not work properly.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com



More information about the Kernelnewbies mailing list