LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-28-2015, 09:20 AM   #1
joenew
Member
 
Registered: Mar 2010
Distribution: slackware 15.0 64bit
Posts: 190

Rep: Reputation: 23
Single module rebuilt: depmod doesn't give priority to new version located in "extra"


I'm trying to modify a kernel module source code to make an usb internet dongle working.
It's useful compiling not all kernel modules but just the one I'm interested in. In my case that is "option" serial driver.
As described in kernel kbuild docs about modules, it is possible to follow this way:

1- install kernel sources
2- configure (mark the "option" module as "M") compile install the new kernel and reboot to have it in use

Now we have the following elements:
1- kernel sources of running kernel
2- ".config" of running kernel
3- Modules.symvers file generated by compiling running kernel

Here we are!
Now it is possible to edit the source code of "option" module located at:

$KERNEL_SOURCES/drivers/usb/serial/option.c

And then we are ready to re-compile it as described there:
https://www.kernel.org/doc/Documenta...ld/modules.txt

1- edit a "Kbuild" file located in the same subdir of "option" driver as follow:
Code:
obj-$(CONFIG_USB_SERIAL_OPTION)                 += option.o
2- Now we can recompile it and then install after have acquired root permissions:
Code:
$ cd /lib/modules/$(uname -r)/build
$ make -C `pwd` M=drivers/usb/serial
# make -C `pwd` M=drivers/usb/serial modules_install
Insatallation process will copy new option.ko module in "extra" directory (this is the "modules_install" default for external modules).
So we'll find new option.ko at:
Code:
/lib/modules/$(uname -r)/extra
And the old one at:
Code:
/lib/modules/$(uname -r)/kernel/drivers/usb/serial/option.ko

3- And now? Well, there's just one last step to allow loading (modprobe) the brand new version of modified option.ko module:
Code:
# depmod -a

Ok, now let's come to the problem...
On my Slackware-14.0 system I've followed the above steps, but depmod still isn't able to give new option.ko high priority over the old "in tree" option.ko file.
So if I look for info about option module, modinfo returns:
Code:
# modinfo -n option
/lib/modules/3.19.4-hb_smp/kernel/drivers/usb/serial/option.ko
And if I try to load it:
Code:
# modprobe -v option
insmod /lib/modules/3.19.4-hb_smp/kernel/drivers/usb/serial/usbserial.ko
insmod /lib/modules/3.19.4-hb_smp/kernel/drivers/usb/serial/usb_wwan.ko
insmod /lib/modules/3.19.4-hb_smp/kernel/drivers/usb/serial/option.ko
If I launch "depmod -a" with some "-v" option I can clearly see that it give priority to "in tree" version of the module instead to the "extra" one:
Code:
# depmod -avvvv `uname -r` 2>/tmp/error-depmod.log 1>/tmp/output-depmod.log
# grep -A6 'option.ko' /tmp/error-depmod.log
Code:
DEBUG: try kernel/drivers/usb/serial/option.ko (option)
DEBUG: add 0x9198348 kmod=0x9198308, path=/lib/modules/3.19.4-hb_smp/kernel/drivers/usb/serial/option.ko
...
DEBUG: try extra/option.ko (option)
DEBUG: comparing priorities of kernel/drivers/usb/serial/option.ko and extra/option.ko
DEBUG: search updates
DEBUG: priorities: built-in: -1, old: -1, new: -1
DEBUG: Ignored lower priority: /lib/modules/3.19.4-hb_smp/extra/option.ko, higher: /lib/modules/3.19.4-hb_smp/kernel/drivers/usb/serial/option.ko
As defualt depmod seems to give high priority to a particular subdir of /lib/modules/`uname -r`.
That directory has to be named "updates".
If I manually make that subdir and put in my new module option.ko, then depmod takes it as high priority chose, over option.ko "in tree" and over the version in "extra".
This behaviour however could be changed by editing depmod.d/*.conf, but I've read about other slackware users for which extra subdir take high priority as default over the "kernel" subdir containing in-tree compiled modules.
And I think this must be the expected behaviour because "modules_install" default is to create "extra" subdir and put external compiled modules in. So I'd expect depmod to follow that too: when it find "extra", gives it high priority over built-in module version.

The question is: why doesn't this expected behaviour happen on my system?


I've solved by creating a config file /etc/depmod.d/extra.conf containing the string "search extra", but I'd like to uderstand why the expected behaviour isn't the default for my system too, like reported by other users.

Thanks in advance!

PS.
System: Slackware-14.0
Kernel in use: 3.19.4
Kernel default version for Slackware-14.0: 3.2.29 (upgraded by distro maintainer for security bugfix, now default distro kernel is 3.2.45.
Kmod version: 9

Last edited by joenew; 04-28-2015 at 09:22 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] module ABI major version (14) doesn't match the server's version (15) dr.s Slackware 2 08-10-2014 11:45 AM
Version requires old depmod, but couldn't run /sbin/depmod.old: No such file or dir jiobo Linux - Software 0 12-04-2008 02:53 AM
Depmod not finding ndiswrapper module ifeatu Linux - Newbie 13 10-10-2008 07:37 AM
Depmod not working for my driver module bhuvanmital Fedora 3 04-24-2006 05:05 AM
Mandrake10.1 official download version doesn't have speedstep-centrino module? cawwt Mandriva 1 12-24-2004 10:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 08:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration