简体   繁体   中英

specific macro value in linux kernel module build

How to figure out a specific kernel macro value while building a kernel module.

There are lots of macro options and I wish to know the value assigned to a "specific macro" while building and the line number where it is defined.

I read about this a quite while ago...and I know it is quite possible.

for eg: make modules SUBDIRS=drivers/net/e1000/

Now, in e1000 there is a macro used, HAVE_VLAN_IN_HW.

while building the module, I wish to know where exactly it is coming from (the macro definition and its value).?

I should have googled it with better keywords like preprocessing output :

Here you find all relevant info:

http://kernelnewbies.org/FAQ/KernelCrossCompilation

Yet another facet of kernel compilation is that it helps you to generate preprocessed files. This is extremely useful when you suspect something could be wrong with your macros. In 2.4 days, we could get the command line and add -c option and redirect the result of gcc preprocessor to a file. In 2.6, it is built into the kernel. Here is how.

Say, I want to generate the preprocessor output for kernel/dma.c, #make kernel/dma.i

Done. open kernel/dma.i to see what preprocessor did to dma.c

This is available for a module (not a part of kernel) too.

我们大多数人使用Linux交叉引用来查找函数,宏和变量的声明位置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM