7.4. Kmod-17

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

7.4.1. Installation of Kmod

Tell Kmod to use /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:

PKG_CONFIG= liblzma_CFLAGS="-I/tools/include" \
    liblzma_LIBS="-L/tools/lib64 -llzma" \
    zlib_CFLAGS="-I/tools/include" zlib_LIBS="-L/tools/lib64 -lz" \
    CC="${CC} ${BUILD64}" ./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.77.2, “Contents of Kmod.”