Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
As a newbie, I just started writing simple loadable kernel modules. I am using ubuntu distribution and "2.6.20-15-generic" is the kernel version.
I get the following error when i try to a modprobe to insert my module.
$ sudo /sbin/modprobe print_number_of_memory_nodes_or_banks.ko
FATAL: Module print_number_of_memory_nodes_or_banks.ko not found.
I am running the modprobe command from the same directory in which my module has been compiled.
if i try to insert the module using insmod, I get the following error:
$ sudo insmod print_number_of_memory_nodes_or_banks.ko
insmod: error inserting 'print_number_of_memory_nodes_or_banks.ko': -1 Unknown symbol in module
The source code of this modules is as follows :--
MODULE_AUTHOR("Naveen Kumar Singh");
MODULE_DESCRIPTION("Print Memory Banks or Nodes Information");
The symbol "for_each_online_pgdat" (line # 10) is definitely not being exported by the kernel as it is not present in the /proc/kallsyms file. How do I go about fetching another kernel module which exports the "for_each_online_pgdat" symbol?
Compiling and using kernel modules is not the same as compiling c or c++ source code for an application.
In the case of kernel modules, first the kernel has to supply the functionality you want to use via lodable module. Then you configure the kernel to provide that functionality (if not already compiled in), followed by 'make', 'make modules_install' (or something like that; haven't messed with kernels for a long time), and finally '/sbin/depmod -a' which writes the /etc/modules.conf file if I remember correctly.
But then, if the kernel has that functionality, and it's compiled in, then you already have a module (or it's in the kernel) to do it. So it seems you are trying to write a module, but not adding to the kernel code to be able to use that module.