It's time to verify it all works as advertised. Let's get started:
- First, build and insert the kernel module into kernel memory:
Our lkm convenience script makes short work of this; this session was carried out on our familiar x86_64 guest VM running Ubuntu 18.04 LTS and a custom 5.4.0 Linux kernel.
$ cd <booksrc>/ch2/netlink_simple_intf/kernelspace_netlink
$ ../../../lkm netlink_simple_intf
Version info:
Distro: Ubuntu 18.04.4 LTS
Kernel: 5.4.0-llkd01
[...]
make || exit 1
[...] Building for: KREL=5.4.0-llkd01 ARCH=x86 CROSS_COMPILE= EXTRA_CFLAGS= -DDEBUG
CC [M] /home/llkd/booksrc/ch13/netlink_simple_intf/kernelspace_netlink/netlink_simple_intf.o
[...]
sudo insmod ./netlink_simple_intf.ko && lsmod|grep netlink_simple_intf
------------------------------
netlink_simple_intf 16384 0
[...]
[58155.082713] netlink_simple_intf: creating kernel netlink socket
[58155.084445] netlink_simple_intf: inserted
$
- With that, it's loaded...