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

Page 40: Minimal

Advertising
background image

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

4 0

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

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

Advertising