Exporting kernel symbols

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

 While working with the 2.4.10 kernel, I wanted to export a function
that I added. I found that EXPORT_SYMBOL(..) alone does not help if
CONFIG_MODVERSIONS is set. I also didn't  find any document that
explains how to make a kernel symbol available to modules. Below is the
list of steps that I followed  - after some trial and error. Can
someone please verify this?



HOWTO export a kernel symbol to modules
---------------------------------------
Steps to make a symbol 'my_function' (defined in my_obj.c) available to
kernel modules:
 
1. Include the following two files in the source file (my_obj.c) :

 linux/module.h  and  linux/modsetver.h
 
2. Add the following line to the source file:
 
EXPORT_SYMBOL(my_function);
 
 
3. Add the object filename to the 'export-objs' variable in the current
directory's Makefile. If the variable does not exist, add it:
 
export_objs := my_obj.o
 
  3a. If the changes you are making are enabled/disabled by a config
option, you can conditionally modify export-objs : 

#ifdef CONFIG_MY_OPTION
export-objs += my_obj.o
#endif
 
 
IMPORTANT:
Make sure that your file name does not clash with any of the existing
files in include/linux/modules. For example, if a file 'my_obj.ver'
already exists in include/linux/modules, you have to rename your file
(or move only the EXPORT_SYMBOL and related parts to a different file).

---------------------------


-Thanks,
 Ravi.

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux