7.5. Kmod-18

The Kmod package contains programs for loading, inserting and removing kernel modules for Linux. Kmod replaces the Module-Init-tools package.

7.5.1. Installation of Kmod

The following sed changes Kmod's default module search location to /tools/lib/modules:

cp -v libkmod/libkmod.c{,.orig}
sed '/dirname_default_prefix /s@/lib/modules@/tools&@' \
    libkmod/libkmod.c.orig > libkmod/libkmod.c

Prepare Kmod for compilation:

./configure --prefix=/tools \
    --build=${CLFS_HOST} --host=${CLFS_TARGET} \
    --libdir=/tools/lib64 --with-xz --with-zlib

The meaning of the new configure options:

--with-zlib --with-xz

These allow the Kmod package to handle zlib and XZ compressed kernel modules.

Compile the package:

make

Install the package:

make install

Create symbolic links for programs that expect Module-Init-Tools:

ln -sfv kmod /tools/bin/lsmod
for tool in depmod insmod modprobe modinfo rmmod; do
    ln -sv ../bin/kmod /tools/sbin/${tool}
done

Details on this package are located in Section 10.118.2, “Contents of Kmod.”