Digi 9P 9360/9750 Add the module to the build environment, Building and loading of kernel modules

Models: 9P 9360/9750

1 75
Download 75 pages 46.92 Kb
Page 40
Image 40

W r i t i n g k e r n e l m o d u l e s

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".

#Add your kernel modules here obj-m += my_module.o

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.

LXNETES_KMODULES([minimal my_kmodule])

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"

#modprobe /minimal

Minimal driver $Revision: 1.1 $ loaded

#cat /proc/modules

minimal 1536 0 - Live 0xbf000000

#rmmod minimal

Minimal driver unloaded

#cat /proc/modules

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.

4 0

L x N E T E S U s e r ’ s G u i d e

Page 40
Image 40
Digi 9P 9360/9750 manual Add the module to the build environment, Building and loading of kernel modules