Digi 9P 9360/9750 Network Card User Manual


 
Writing kernel modules
40 
LxNETES User’s Guide
Add the module to the build environment
You have to edit "my_kmodule/Makefile.in" so that the build environment knows what files to build.
To include them for the target build, append them to obj-m like "obj-m += my_module.o". The modules
must be named like their C-source files. Usable object modules will have the extension ".ko".
Then you have to add the module to the list of available modules. Edit the configure.ac and modify the
line adding the module minimal to add your module to the list.
Building and loading of kernel modules
For building the new kernel module, just rebuild your project by issuing make in the build directory.
If you reboot your target with the newly created rootfs (or if you mount your rootfs via
nfs), The
modules can be loaded in the target with "modprobe my_kmodule"
There is an example "minimal.c" for the most minimalist kernel module. Try it with
"modprobe/minimal"
Included Kernel modules
minimal
This is a minimalist kernel module which actually does nothing. It is only a module to test the
functionality of the load and unload functions of the kernel.
# Add your kernel modules here
obj-m += my_module.o
LXNETES_KMODULES([minimal my_kmodule])
# modprobe /minimal
Minimal driver $Revision: 1.1 $ loaded
# cat /proc/modules
minimal 1536 0 - Live 0xbf000000
# rmmod minimal
Minimal driver unloaded
# cat /proc/modules