4.14-2: with depmod hook

This commit is contained in:
Jan Alexander Steffens 2017-11-18 22:46:07 +00:00
parent ca748c5be3
commit 5cc2ed8ac7
4 changed files with 48 additions and 42 deletions

12
60-linux.hook Normal file
View File

@ -0,0 +1,12 @@
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Operation = Remove
Target = usr/lib/modules/%KERNVER%/*
Target = usr/lib/modules/%EXTRAMODULES%/*
[Action]
Description = Updating %PKGBASE% module dependencies...
When = PostTransaction
Exec = /usr/bin/depmod %KERNVER%

View File

@ -6,6 +6,6 @@ Target = boot/vmlinuz-%PKGBASE%
Target = usr/lib/initcpio/*
[Action]
Description = Updating %PKGBASE% initcpios
Description = Updating %PKGBASE% initcpios...
When = PostTransaction
Exec = /usr/bin/mkinitcpio -p %PKGBASE%

View File

@ -5,7 +5,7 @@ pkgbase=linux # Build stock -ARCH kernel
#pkgbase=linux-custom # Build kernel with a different name
_srcname=linux-4.14
pkgver=4.14
pkgrel=1
pkgrel=2
arch=('x86_64')
url="https://www.kernel.org/"
license=('GPL2')
@ -17,6 +17,7 @@ source=(
#"https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.xz"
#"https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.sign"
'config' # the main kernel config file
'60-linux.hook' # pacman hook for depmod
'90-linux.hook' # pacman hook for initramfs regeneration
'linux.preset' # standard config files for mkinitcpio ramdisk
'0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch'
@ -28,7 +29,8 @@ validpgpkeys=(
sha256sums=('f81d59477e90a130857ce18dc02f4fbe5725854911db1e7ba770c7cd350f96a7'
'SKIP'
'a68e94064f040d60e8e4c3380efeee085b54d252d527e960dd17ac688505d5b6'
'834bd254b56ab71d73f59b3221f056c72f559553c04718e350ab2a3e2991afe0'
'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
'75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919'
'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65'
'6f1d9b6a119bfab150a0bc1f550609dd9290328df709b67c984f0a6b0abe8afd')
@ -97,22 +99,17 @@ _package() {
_basekernel=${_kernver%%-*}
_basekernel=${_basekernel%.*}
mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
mkdir -p "${pkgdir}"/{boot,lib/{modules,firmware},usr}
make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install
cp arch/x86/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
# set correct depmod command for install
sed -e "s|%PKGBASE%|${pkgbase}|g;s|%KERNVER%|${_kernver}|g" \
"${startdir}/${install}" > "${startdir}/${install}.pkg"
true && install=${install}.pkg
# make room for external modules
local _extramodules="extramodules-${_basekernel}${_kernelname:--ARCH}"
ln -s "../${_extramodules}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
# install mkinitcpio preset file for kernel
sed "s|%PKGBASE%|${pkgbase}|g" ../linux.preset |
install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
# install pacman hook for initramfs regeneration
sed "s|%PKGBASE%|${pkgbase}|g" ../90-linux.hook |
install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
# add real version for building modules and running depmod from hook
echo "${_kernver}" |
install -Dm644 /dev/stdin "${pkgdir}/lib/modules/${_extramodules}/version"
# remove build and source links
rm "${pkgdir}"/lib/modules/${_kernver}/{source,build}
@ -120,21 +117,35 @@ _package() {
# remove the firmware
rm -r "${pkgdir}/lib/firmware"
# make room for external modules
ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
# add real version for building modules and running depmod from post_install/upgrade
echo "${_kernver}" |
install -Dm644 /dev/stdin "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version"
# Now we call depmod...
# now we call depmod...
depmod -b "${pkgdir}" -F System.map "${_kernver}"
# add vmlinux
install -Dt "${pkgdir}/lib/modules/${_kernver}/build" -m644 vmlinux
# move module tree /lib -> /usr/lib
mv -t "${pkgdir}/usr" "${pkgdir}/lib"
# add vmlinux
install -Dm644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux"
# sed expression for following substitutions
local _subst="
s|%PKGBASE%|${pkgbase}|g
s|%KERNVER%|${_kernver}|g
s|%EXTRAMODULES%|${_extramodules}|g
"
# hack to allow specifying an initially nonexisting install file
sed "${_subst}" "${startdir}/${install}" > "${startdir}/${install}.pkg"
true && install=${install}.pkg
# install mkinitcpio preset file
sed "${_subst}" ../linux.preset |
install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
# install pacman hooks
sed "${_subst}" ../60-linux.hook |
install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook"
sed "${_subst}" ../90-linux.hook |
install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
}
_package-headers() {

View File

@ -1,27 +1,10 @@
post_install () {
# updating module dependencies
echo ">>> Updating module dependencies. Please wait ..."
depmod %KERNVER%
}
post_upgrade() {
if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then
echo "WARNING: /boot appears to be a separate partition but is not mounted."
fi
# updating module dependencies
echo ">>> Updating module dependencies. Please wait ..."
depmod %KERNVER%
if [ $(vercmp $2 3.13) -lt 0 ]; then
echo ">>> WARNING: AT keyboard support is no longer built into the kernel."
echo ">>> In order to use your keyboard during early init, you MUST"
echo ">>> include the 'keyboard' hook in your mkinitcpio.conf."
fi
}
post_remove() {
# also remove the compat symlinks
rm -f boot/initramfs-%PKGBASE%.img
rm -f boot/initramfs-%PKGBASE%-fallback.img
}