Hardware Reference
In-Depth Information
bone#
ls
Makefile hello.c hello.mod.c hello.o
Module.symvers hello.ko hello.mod.o modules.order
Notice that several files have been created.
hello.ko
is the one you want. Try a couple of
commands with it:
bone#
modinfo hello.ko
filename: /root/hello/hello.ko
srcversion: 87C6AEED7791B4B90C3B50C
depends:
vermagic: 3.8.13-bone67 SMP mod_unload modversions ARMv7
thumb2 p2v8
bone#
insmod hello.ko
bone#
dmesg | tail -4
[419313.320052] bone-iio-helper helper.15: ready
[419313.322776] bone-capemgr bone_capemgr.9: slot #8: Applied #1
overlays.
[491540.999431] Loading hello module...
[491540.999476] Hello world
The first command displays information about the module. The
insmod
command in-
serts the module into the running kernel. If all goes well, nothing is displayed, but the
module does print something in the kernel log. The
dmesg
command displays the mes-
sages in the log, and the
tail -4
command shows the last four messages. The last two
messages are from the module. It worked!