This commit is contained in:
nyyu 2017-12-29 11:03:17 +01:00
parent 52de21eef9
commit 9dce8d8e48
6 changed files with 358 additions and 8892 deletions

12
linux/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/* Target = usr/lib/initcpio/*
[Action] [Action]
Description = Updating %PKGBASE% initcpios Description = Updating %PKGBASE% initcpios...
When = PostTransaction When = PostTransaction
Exec = /usr/bin/mkinitcpio -p %PKGBASE% Exec = /usr/bin/mkinitcpio -p %PKGBASE%

View file

@ -4,52 +4,47 @@
pkgbase=linux # Build stock -ARCH kernel pkgbase=linux # Build stock -ARCH kernel
#pkgbase=linux-custom # Build kernel with a different name #pkgbase=linux-custom # Build kernel with a different name
_srcname=linux-4.13 _srcname=linux
pkgver=4.13.10 pkgver=4.15rc5.r0.g464e1d5f23cc
pkgrel=1 pkgrel=1
arch=('i686' 'x86_64') arch=('x86_64')
url="https://www.kernel.org/" url="https://www.kernel.org/"
license=('GPL2') license=('GPL2')
makedepends=('xmlto' 'kmod' 'inetutils' 'bc' 'libelf') makedepends=('xmlto' 'kmod' 'inetutils' 'bc' 'libelf')
options=('!strip') options=('!strip')
source=("https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz" source=(
"https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.sign" 'git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git'
"https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.xz" 'config' # the main kernel config file
"https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.sign" '60-linux.hook' # pacman hook for depmod
# the main kernel config files '90-linux.hook' # pacman hook for initramfs regeneration
'config.i686' 'config.x86_64' 'linux.preset' # standard config files for mkinitcpio ramdisk
# pacman hook for initramfs regeneration )
'90-linux.hook' sha256sums=('SKIP'
# standard config files for mkinitcpio ramdisk 'bfde21c325d39013463c38e9fa23d6d6481238b8509eea4ae38906127017e47d'
'linux.preset') 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
'75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919'
sha256sums=('2db3d6066c3ad93eb25b973a3d2951e022a7e975ee2fa7cbe5bddf84d9a49a2c'
'SKIP'
'b9efa9c6375f79f6a041a5f0666d4ced1a49bfe8c4662d26517a6b4cfd9bf2f6'
'SKIP'
'9b1d9fcb55782e6149aca4dc2d3b250dd4cedf1bf4bd8c6f0968acab0e2e0ee4'
'9c6c4d27d59638d0569ea09a97138bfcfb219f17cdf1138be141380e6654f302'
'834bd254b56ab71d73f59b3221f056c72f559553c04718e350ab2a3e2991afe0'
'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65') 'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65')
validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
)
_kernelname=${pkgbase#linux} _kernelname=${pkgbase#linux}
pkgver() {
cd "${_srcname}"
git describe --long | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g;s/\.rc/rc/'
}
prepare() { prepare() {
cd ${_srcname} cd ${_srcname}
# add upstream patch # add upstream patch
patch -p1 -i ../patch-${pkgver} #patch -p1 -i ../patch-${pkgver}
# security patches # security patches
# add latest fixes from stable queue, if needed # add latest fixes from stable queue, if needed
# http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
cp -Tf ../config.${CARCH} .config cp -Tf ../config .config
if [ "${_kernelname}" != "" ]; then if [ "${_kernelname}" != "" ]; then
sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
@ -62,6 +57,9 @@ prepare() {
# don't run depmod on 'make install'. We'll do this ourselves in packaging # don't run depmod on 'make install'. We'll do this ourselves in packaging
sed -i '2iexit 0' scripts/depmod.sh sed -i '2iexit 0' scripts/depmod.sh
# old config
make olddefconfig
# get kernel version # get kernel version
make prepare make prepare
@ -93,29 +91,22 @@ _package() {
cd ${_srcname} cd ${_srcname}
KARCH=x86
# get kernel version # get kernel version
_kernver="$(make LOCALVERSION= kernelrelease)" _kernver="$(make LOCALVERSION= kernelrelease)"
_basekernel=${_kernver%%-*} _basekernel=${_kernver%%-*}
_basekernel=${_basekernel%.*} _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 make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install
cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}" cp arch/x86/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
# set correct depmod command for install # make room for external modules
sed -e "s|%PKGBASE%|${pkgbase}|g;s|%KERNVER%|${_kernver}|g" \ local _extramodules="extramodules-${_basekernel}${_kernelname:--ARCH}"
"${startdir}/${install}" > "${startdir}/${install}.pkg" ln -s "../${_extramodules}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
true && install=${install}.pkg
# install mkinitcpio preset file for kernel # add real version for building modules and running depmod from hook
sed "s|%PKGBASE%|${pkgbase}|g" ../linux.preset | echo "${_kernver}" |
install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" install -Dm644 /dev/stdin "${pkgdir}/lib/modules/${_extramodules}/version"
# 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"
# remove build and source links # remove build and source links
rm "${pkgdir}"/lib/modules/${_kernver}/{source,build} rm "${pkgdir}"/lib/modules/${_kernver}/{source,build}
@ -123,21 +114,35 @@ _package() {
# remove the firmware # remove the firmware
rm -r "${pkgdir}/lib/firmware" rm -r "${pkgdir}/lib/firmware"
# make room for external modules # now we call depmod...
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...
depmod -b "${pkgdir}" -F System.map "${_kernver}" depmod -b "${pkgdir}" -F System.map "${_kernver}"
# add vmlinux
install -Dt "${pkgdir}/lib/modules/${_kernver}/build" -m644 vmlinux
# move module tree /lib -> /usr/lib # move module tree /lib -> /usr/lib
mv -t "${pkgdir}/usr" "${pkgdir}/lib" mv -t "${pkgdir}/usr" "${pkgdir}/lib"
# add vmlinux # sed expression for following substitutions
install -Dm644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux" 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() { _package-headers() {
@ -153,14 +158,10 @@ _package-headers() {
cp -t "${_builddir}" -a include scripts cp -t "${_builddir}" -a include scripts
install -Dt "${_builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile install -Dt "${_builddir}/arch/x86" -m644 arch/x86/Makefile
install -Dt "${_builddir}/arch/${KARCH}/kernel" -m644 arch/${KARCH}/kernel/asm-offsets.s install -Dt "${_builddir}/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
if [[ ${CARCH} = i686 ]]; then cp -t "${_builddir}/arch/x86" -a arch/x86/include
install -t "${_builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile_32.cpu
fi
cp -t "${_builddir}/arch/${KARCH}" -a arch/${KARCH}/include
install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h
install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h
@ -184,16 +185,13 @@ _package-headers() {
find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \; find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \;
# add objtool for external module building and enabled VALIDATION_STACK option # add objtool for external module building and enabled VALIDATION_STACK option
if [[ -e tools/objtool/objtool ]]; then install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool
install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool
fi
# remove unneeded architectures # remove unneeded architectures
local _arch local _arch
for _arch in "${_builddir}"/arch/*/; do for _arch in "${_builddir}"/arch/*/; do
if [[ ${_arch} != */${KARCH}/ ]]; then [[ ${_arch} == */x86/ ]] && continue
rm -r "${_arch}" rm -r "${_arch}"
fi
done done
# remove files already in linux-docs package # remove files already in linux-docs package
@ -215,20 +213,7 @@ _package-headers() {
done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null) done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null)
} }
_package-docs() { pkgname=("${pkgbase}" "${pkgbase}-headers")
pkgdesc="Kernel hackers manual - HTML documentation that comes with the ${pkgbase/linux/Linux} kernel"
cd ${_srcname}
local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
mkdir -p "${_builddir}"
cp -t "${_builddir}" -a Documentation
# Fix permissions
chmod -R u=rwX,go=rX "${_builddir}"
}
pkgname=("${pkgbase}" "${pkgbase}-headers")#"${pkgbase}-docs")
for _p in ${pkgname[@]}; do for _p in ${pkgname[@]}; do
eval "package_${_p}() { eval "package_${_p}() {
$(declare -f "_package${_p#${pkgbase}}") $(declare -f "_package${_p#${pkgbase}}")

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,27 +1,10 @@
post_install () {
# updating module dependencies
echo ">>> Updating module dependencies. Please wait ..."
depmod %KERNVER%
}
post_upgrade() { post_upgrade() {
if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then 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." echo "WARNING: /boot appears to be a separate partition but is not mounted."
fi 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() { post_remove() {
# also remove the compat symlinks
rm -f boot/initramfs-%PKGBASE%.img rm -f boot/initramfs-%PKGBASE%.img
rm -f boot/initramfs-%PKGBASE%-fallback.img rm -f boot/initramfs-%PKGBASE%-fallback.img
} }