Sunday, May 22, 2016

Rebuilding a kernel module(driver) with debugging



I have been trying for the past day to rebuild my iwlwifi modules with debugging enabled. The way to do this is to build with the .config param CONFIG_IWLWIFI_DEBUG=y. If I was building a new kernel this would be easy, but I want to keep using the installed ubuntu kernel. At the moment I don’t care about installing the modules. I just want to see the .ko files build, insmod them, and check for /sys/modules/iwlwifi/parameters/debug which should exist if the modules are built for debugging. What’s the official ubuntu way of doing this?




So far, this is what I’m doing:



My kernel is 4.15.0-43-generic, headers are already installed in /usr/src/linux-headers-4.15.0-43-generic




  1. Installed /usr/src/linux-source-4.15.0 with apt-get and unpacked it to ~/


  2. Set CONFIG_IWLWIFI_DEBUG=y in ~/linux-4.15.0/.config and /usr/src/linux-headers-4.15.0-43-generic/.config because I’m not sure which would be used.


  3. In ~/linux-4.15.0/drivers/net/.../iwlwifi, I run make -C /lib/modules/$(uname -r)/build M=$(pwd) modules


  4. ko modules build, but they aren’t debug-enabled





Turns out I needed to run make scripts in the headers dir. It exits with failure, but I guess it does whatever it needs to with the build params first.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...