Reputation: 5211
I am building an out-of-tree kernel module for a device driver. Overall, things are going well, but I had a few questions about using kbuild and the build system:
ccflags-y := -O2 -Wall -Wextra -I $(DRIVER_INC_DIR)
, where $(DRIVER_INC_DIR)
is various header files for my driver. Note that my driver is made up of several .o files that get merged into a single .ko. I want to show warnings generated by the compiler for my own code, but not code in Linux (e.g., linux/module.h). How can I accomplish that? I know in user space applications there is the -isystem
option, but I'm wondering how that would apply here (if at all).modules_install
versus just doing a copy of the .ko file after it has been compiled? The reason I ask is because I think its easier for me to follow doing a manual copy, since I also need to support a "make uninstall" target (and there is no modules_uninstall
, just a clean
, which does not appear to remove the .ko from where it was installed). Thanks in advance for the help.
Upvotes: 1
Views: 783
Reputation: 5211
I have been able to answer #1. Basically, inside of kbuild, the LINUXINCLUDE
variable is using -I
to pull in all the source code from the Linux headers. As a result, I added this line to my Makefile:
LINUXINCLUDE := $(subst -I, -isystem, $(LINUXINCLUDE))
This replaces all the -I
flags with -isystem
and therefore, the warnings are ignored.
Upvotes: 2