8.67.1. Installation of Kmod
Create the PKGBUILD for the Kmod package with the following
commands:
mkdir /sources/kmod
cd /sources/kmod
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="kmod"
pkgver="34.1"
pkgrel="1"
pkgdesc="The Kmod package contains libraries and utilities for loading kernel modules."
arch=('x86'
'x86_64')
url="https://github.com/kmod-project/kmod"
license=('LGPLv2.1')
groups=('core')
depends=('glibc'
'xz'
'zlib'
'rootfs')
makedepends=('bash'
'binutils'
'bison'
'coreutils'
'flex'
'gcc'
'gettext'
'gzip'
'make'
'pkg-config'
'sed')
source=('https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-34.1.tar.xz')
md5sums=('bdc01ba7d330685af597c16c5f58c0e2')
prepare(){
cd "${pkgname}-${pkgver}"
mkdir -p build
cd build
}
build(){
cd "${pkgname}-${pkgver}/build"
meson setup --prefix=/usr .. \
--sbindir=/usr/sbin \
--buildtype=release \
-D manpages=false
ninja
}
check(){
cd "${pkgname}-${pkgver}/build"
# Do nothing as the test suite depends on raw kernel headers
# A "linux-source" package would make sense here
echo ""
}
package(){
cd "${pkgname}-${pkgver}/build"
DESTDIR="${pkgdir}" ninja install
}
REALEOF
The meaning of the configure options:
-
-D
manpages=false
-
This option disables generating the man pages which requires
an external program.
Prepare the build directory for the pacman user and build the
package:
chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps --nocheck'
Add the newly created package to the central package repository:
cp kmod-34.1-1-$(uname -m).pkg.tar.xz \ /srv/pacman/repos/LFS/ repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \ /srv/pacman/repos/LFS/kmod-34.1-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Kmod package:
pacman -Syu
pacman -S kmod --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean
up the build directory:
mkdir /srv/pacman/source/LFS/kmod
cp PKGBUILD /srv/pacman/source/LFS/kmod
cd /sources
rm -rf kmod