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:
- I found this excellent post: Is it possible to set CFLAGS to a linux kernel module Makefile?, which shows how to modify the compiler flags. As a result, I am now setting my compiler flags as:
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). - Is there any difference between using
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 nomodules_uninstall
, just aclean
, which does not appear to remove the .ko from where it was installed).
Thanks in advance for the help.