diff --git a/PKGBUILD b/PKGBUILD index cbb0bb8..87c3e6a 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,258 +1,203 @@ -# Maintainer: Thomas Kuschel +# Maintainer: Thomas Kuschel (oe3tkt) +# copied from Jan Alexander Steffens (heftig) -pkgbase=linux-tkt -_srcname=linux -_gitver=v5.17.1 -_patchver=20220315 -# patchver=master -_patchname=more-uarches-for-kernel-5.17+.patch -pkgver=5.17.v.1 -pkgrel=3 - -arch=('x86_64') -url="https://www.kernel.org/" -license=('GPL2') -makedepends=('kmod' 'inetutils' 'bc' 'git' 'libelf' 'lzop' 'gcc>=10.3') +pkgbase=linux-tom +pkgver=5.17.3.arch1 +pkgrel=6 +pkgdesc='Linux' +_srctag=v${pkgver%.*}-${pkgver##*.} +url="https://github.com/archlinux/linux/commits/$_srctag" +arch=(x86_64) +license=(GPL2) +makedepends=( + bc libelf pahole cpio perl tar xz + xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick texlive-latexextra + git +) options=('!strip') - -source=("git+https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git#tag=$_gitver" - # the main kernel config files - 'config-tkt.x86_64' - # standard config files for mkinitcpio ramdisk - "${pkgbase}.preset" - # linux package install directives for pacman - 'linux.install' - # patch from our graysky archlinux colleague, at https://github.com/graysky2/kernel_compiler_patch - "https://raw.githubusercontent.com/graysky2/kernel_compiler_patch/$_patchver/$_patchname" +_srcname=archlinux-linux +source=( + "$_srcname::git+https://github.com/archlinux/linux?signed#tag=$_srctag" + config # the main kernel config file +) +validpgpkeys=( + 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds + '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman + 'A2FF3A36AAA56654109064AB19802F8B0D70FC30' # Jan Alexander Steffens (heftig) + 'C7E7849466FE2358343588377258734B41C31549' # David Runge ) sha256sums=('SKIP' - #config-tkt.x86_64 - '6999f8b7fa09f634c43627a75ea8f430cc49b54248f890a3f55e34e4a2619153' - #.preset file linux-tkt.preset - 'f1eaf5f24b251b823ff6991119b4bc80df5ba22065803b7bd2f1f09d1bd06e0e' - #linux install file - 'd590e751ab4cf424b78fd0d57e53d187f07401a68c8b468d17a5f39a337dacf0' - #grayskypatch - 'dea86a521603414a8c7bf9cf1f41090d5d6f8035ce31407449e25964befb1e50' -) + '1c7e7d4fbaa10bc95087776f20367124c66cb39abf09e029d70ef3c8a34422df') -_kernelname=${pkgbase#linux} - -pkgver() { - echo $pkgver -} +export KBUILD_BUILD_HOST=archlinux +export KBUILD_BUILD_USER=$pkgbase +export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" prepare() { - cd "${_srcname}" - if [ "${CARCH}" = "x86_64" ]; then - cat "${srcdir}/config-tkt.x86_64" > ./.config - else - echo "Sorry, non x86_64 arch not supported." - exit 2 - fi + cd $_srcname - # don't run depmod on 'make install'. We'll do this ourselves in packaging - sed -i '2iexit 0' scripts/depmod.sh + echo "Setting version..." + scripts/setlocalversion --save-scmversion + echo "-$pkgrel" > localversion.10-pkgrel + echo "${pkgbase#linux}" > localversion.20-pkgname - # Implement all packaged patches. - msg2 "Implementing custom kernel patches" - while read patch; do - echo "Applying $patch" - git apply $patch || exit 2 - done <<< $(ls ../*.patch) + local src + for src in "${source[@]}"; do + src="${src%%::*}" + src="${src##*/}" + [[ $src = *.patch ]] || continue + echo "Applying patch $src..." + patch -Np1 < "../$src" + done - # get kernel version - msg2 "Preparing kernel" - yes "" | make prepare + echo "Setting config..." + cp ../config .config + make olddefconfig + diff -u ../config .config || : - # load configuration - msg2 "Preparing config" - # Configure the kernel. Replace the line below with one of your choice. - #make menuconfig # CLI menu for configuration - #make nconfig # new CLI menu for configuration - #make xconfig # X-based configuration - #make oldconfig # using old config from previous kernel version - make olddefconfig # old config from previous kernel, defaults for new options - # ... or manually edit .config + make -s kernelrelease > version + echo "Prepared $pkgbase version $(=0.7' 'lzop') - optdepends=('crda: to set the correct wireless channels of your country') - backup=("etc/mkinitcpio.d/${pkgbase}.preset") - install=linux.install + pkgdesc="The $pkgdesc kernel and modules" + depends=(coreutils kmod initramfs) + optdepends=('wireless-regdb: to set the correct wireless channels of your country' + 'linux-firmware: firmware images needed for some devices') + provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE) + replaces=(virtualbox-guest-modules-arch wireguard-arch) - cd "${_srcname}" + cd $_srcname + local kernver="$( "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version" - - # Now we call depmod... - depmod -b "${pkgdir}" -F System.map "${_kernver}" - - # move module tree /lib -> /usr/lib - mkdir -p "${pkgdir}/usr" - mv "${pkgdir}/lib" "${pkgdir}/usr/" - - # add vmlinux - install -D -m644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux" - - # add vmlinuz in /usr/lib/modules/ and info for correct hook triggers - cp arch/$KARCH/boot/bzImage "${pkgdir}/usr/lib/modules/${_kernver}/vmlinuz" - echo ${pkgbase} > "${pkgdir}/usr/lib/modules/${_kernver}/pkgbase" - - # add System.map - install -D -m644 System.map "${pkgdir}/boot/System.map-${_kernver}" + rm "$modulesdir"/{source,build} } _package-headers() { - pkgdesc="Header files and scripts for building modules for Linux kernel aimed at the local CPU based hardware" + pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel" + depends=(pahole) - install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}" + cd $_srcname + local builddir="$pkgdir/usr/lib/modules/$(/dev/null | while read binary ; do - case "$(file -bi "${binary}")" in - *application/x-sharedlib*) # Libraries (.so) - /usr/bin/strip ${STRIP_SHARED} "${binary}";; - *application/x-archive*) # Libraries (.a) - /usr/bin/strip ${STRIP_STATIC} "${binary}";; - *application/x-executable*) # Binaries - /usr/bin/strip ${STRIP_BINARIES} "${binary}";; + echo "Stripping build tools..." + local file + while read -rd '' file; do + case "$(file -bi "$file")" in + application/x-sharedlib\;*) # Libraries (.so) + strip -v $STRIP_SHARED "$file" ;; + application/x-archive\;*) # Libraries (.a) + strip -v $STRIP_STATIC "$file" ;; + application/x-executable\;*) # Binaries + strip -v $STRIP_BINARIES "$file" ;; + application/x-pie-executable\;*) # Relocatable binaries + strip -v $STRIP_SHARED "$file" ;; esac - done + done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0) - # remove unneeded architectures - while read modarch; do - rm -rf $modarch - done <<< $(find "${pkgdir}"/usr/lib/modules/${_kernver}/build/arch/ -maxdepth 1 -mindepth 1 -type d | grep -v /x86$) + echo "Stripping vmlinux..." + strip -v $STRIP_STATIC "$builddir/vmlinux" + echo "Adding symlink..." + mkdir -p "$pkgdir/usr/src" + ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase" } _package-docs() { - pkgdesc="Kernel hackers manual - HTML documentation that comes with the Linux kernel" + pkgdesc="Documentation for the $pkgdesc kernel" - cd "${_srcname}" + cd $_srcname + local builddir="$pkgdir/usr/lib/modules/$(>> Updating module dependencies. Please wait ..." - depmod ${KERNEL_VERSION} - echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..." - mkinitcpio -p linux${KERNEL_NAME} -} - -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 ${KERNEL_VERSION} - echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..." - mkinitcpio -p linux${KERNEL_NAME} - - 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-linux${KERNEL_NAME}.img - rm -f boot/initramfs-linux${KERNEL_NAME}-fallback.img -}