Ah yes, pr_debug() turns out to be a bit of a special case: unless the DEBUG symbol is defined for the kernel module, a printk instance at log level KERN_DEBUG does not show up. We edit the kernel module's Makefile to enable this. There are (at least) two ways to set this up:
- Insert this line into the Makefile:
CFLAGS_printk_loglvl.o := -DDEBUG
Generically, it's CFLAGS_<filename>.o := -DDEBUG.
- We could also just insert this statement into the Makefile:
EXTRA_CFLAGS += -DDEBUG
In our Makefile, we have deliberately kept the -DDEBUG commented out, to begin with. Now, to try it out, un-comment one of the following commented-out lines:
# Enable the pr_debug() as well (rm the comment from one of the lines below)
#EXTRA_CFLAGS += -DDEBUG
#CFLAGS_printk_loglvl.o := -DDEBUG
Once done, we remove the old stale kernel module from memory, rebuild it, and...