Linux kernel module does not autoload

I am learning linux kernel and starting with hello world module at this point everything is fine, but after compilation

$ make

      

and install

$ insmod akmod.ko

      

a module that does not show the "hello world" message on KERN_DEBUG

$ dmesg
nothing here
$

      

just show on rmmod

$ rmmod akmod
[4543.3423432] hello world
[5462.5323452] goodbye

      

The code is the same as here: http://www.makelinux.net/ldd3/chp-2-sect-2

I just changed KERN_ALERT for KERN_DEBUG

I am using Debian 8.

I think this is because the module is not auto-loaded on insmod

When I ran

$ make menuconfig

      

I cannot find the parameter Loading the kernel kernel module

Loadable module support  --->
  [*] Enable loadable module support
  [*]   Module unloading
  [ ]   Module versioning support (EXPERIMENTAL)
  [*]   Automatic kernel module loading **(My menu config donΒ΄t show this option)**

      

Any advice would be appreciated

+3


source to share


2 answers


What you are describing looks like you did not include a newline ("\ n") at the end of your printk.



Since you didn't share your actual code and your insmod is obviously not from the example. (insmod akmod.ko? Why akmod? akmod is another matter.) Debugging is a complete guess.

+1


source


Sometimes there is some delay between issuing printk

and displaying a message in dmesg. You can see that from the output of dmesg: the timestamp for "hello world" is 80 seconds less than one for "goodbye".



Not sure why, but the higher the level of the message, the lower the latency. You can try KERN_INFO or even KERN_ALERT.

+1


source







All Articles