1
votes

I'm modifiying the kernel source code (/linux/net/mac80211/mesh_hwmp.c) to add some signature authentication to the routing frames. After modifying the source code, do I have to build and install the kernel again for the changes to take effect?

Following are the steps I followed:

  1. Downloaded the kernel from git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git

  2. After downloading, copied the current config from the / boot directory in wireless-testing $ cp /boot/config- `uname-r` ./.config

  3. Ran make menuconfig and selected the following features: Networking -> Wireless -> Generic IEEE 802.11 Networking Stack (mac80211)

  4. Built it using fakeroot make-kpkg - initrd kernel_image kernel_headers

  5. After building the kernel, installed the created .deb packages (the core and its headers) using the command $ sudo dpkg-i linux-*.deb

  6. Did a reboot of the system

It is a time consuming process if I have to undergo this for every change that I make to the code (/net/mac80211/mesh_hwmp.c). I'm not sure if I'm overdoing by building the kernel again. Is it sufficient if I just run the Makefile(s) in mac80211 directory? Or, do I have to go through this process no matter what.

1
How did you configure your kernel? For which distribution? Are you using make-kpkg? Are you load the mac80211 driver as a module?Basile Starynkevitch
I have added some information about what I did to my post. I'm using the existing mac80211 drivers but just making some changes to the source code to add some authentication to the route requests and route replies. I'm using Ubuntu 12.04 (x86).Maximus Decimus Meridius
It's likely that the debian package build is forcing a full rebuild, in a way that invoking the top-level kernel Makefile ordinarily would not. But then you'd have to manually install the result. If you are only modifying a module you can use the make modules target and potentially try the new module without rebooting, but still should be using the top-level Makefile in most cases.Chris Stratton
I'm using the linux kernel source "wireless-testing". I want to see the debug messages so I have enabled the necessary mac80211 debug settings in the menuconfig. After that, I did make-kpkg following by dpkg -i linux-*.deb. However, I'm still not seeing the debug messages. Is there something here that I'm obviously missing?Maximus Decimus Meridius

1 Answers

0
votes

Is the current config from /boot the distro default config? If so, it probably contains hundreds or thousands of modules you will never need. Do that once, install and boot the kernel. Then, make sure you load the modules you're interested in (e.g. enable wifi, plug in USB devices) and run make localmodconfig in your kernel source tree (see make help for details). Enable more configs as needed, and use that for development.

You might also find sudo make INSTALL_MOD_STRIP=1 modules_install install will do the right thing on a lot of distros to install the kernel, and you'll avoid any problems related to creating a package, forcing rebuilds. The downside is you'll have to manually remove the old kernels, configs, initrds from /boot and modules from /lib/modules.