(For details on configuring and building the kernel, look back to Chapter 2, Building the 5.x Linux Kernel from Source - Part 1, and Chapter 3, Building the 5.x Linux Kernel from Source - Part 2).
Running your code on a debug kernel can help you uncover hard-to-spot bugs and issues. I highly recommend doing so, typically during development and testing! Here, I minimally expect you to configure your custom 5.4 kernel to have the following kernel debug config options turned on (within the make menuconfig UI, you will find most of them under the Kernel Hacking sub-menu; the following list is with respect to Linux 5.4.0):
- CONFIG_DEBUG_INFO
- CONFIG_DEBUG_FS (the debugfs pseudo filesystem)
- CONFIG_MAGIC_SYSRQ (the Magic SysRq hotkeys feature)
- CONFIG_DEBUG_KERNEL
- CONFIG_DEBUG_MISC
- Memory debugging:
- CONFIG_SLUB_DEBUG.
- CONFIG_DEBUG_MEMORY_INIT.
- CONFIG_KASAN: this is the Kernel Address Sanitizer port; however, as of the time of writing...