# Maintainer: Levente Polyak # Contributor: Daniel Micay # Contributor: Tobias Powalowski # Contributor: Thomas Baechler pkgbase=linux-libre-hardened _majver=4.18 _minver=5 _pkgver=${_majver}.${_minver} _gnumajver=${_majver}-gnu _gnupkgver=${_pkgver}-gnu _hardenedver=a _srcname=linux-${_majver} pkgver=${_pkgver}.${_hardenedver} pkgrel=1 url='https://github.com/anthraxx/linux-hardened' arch=('x86_64') license=('GPL2') makedepends=('xmlto' 'kmod' 'inetutils' 'bc' 'libelf') options=('!strip') source=(https://linux-libre.fsfla.org/pub/linux-libre/releases/${_gnumajver}/linux-libre-${_gnumajver}.tar.xz{,.sign} https://linux-libre.fsfla.org/pub/linux-libre/releases/${_gnupkgver}/patch-${_gnumajver}-${_gnupkgver}.xz{,.sign} https://github.com/anthraxx/linux-hardened/releases/download/${_pkgver}.${_hardenedver}/linux-hardened-${_pkgver}.${_hardenedver}.patch{,.sig} https://github.com/graysky2/kernel_gcc_patch/raw/master/enable_additional_cpu_optimizations_for_gcc_v8.1+_kernel_v4.13+.patch ath9k-regdom-hack.patch config.x86_64 # the main kernel config files 60-linux.hook # pacman hook for depmod 90-linux.hook # pacman hook for initramfs regeneration linux.preset # standard config files for mkinitcpio ramdisk increase-timeout-in-lspcon_wait_mode.patch ) sha256sums=('55ddf20702311cf3e32127135a38cb272313679962e8a798c108b01cadaeca4f' 'SKIP' 'ad530ad0158e96bd18da455b6d08193ac7ae5d025787a2b2aa0c09a9927b360b' 'SKIP' 'a06238ea0ce66d090fa899d6951c9d40fa993c7b4975088dded2c1e660c1ff69' 'SKIP' '9f7177679c8d3f8d699ef0566a51349d828436dba04603bc2223f98c60d2d178' 'e7ebf050c22bcec0028c0b3c79fd6d3913b0370ecc6a23dfe78ce475630cf503' 'd035f14f91f802a35d81b917759ab444baf528b683fd1e07464ad2c5ac8b75cc' 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21' '75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919' 'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65' '0fa6899b57d32988b70050f1a67f435936273ce1aa98575271d564ccfaf45f77') validpgpkeys=( '474402C8C582DAFBE389C427BCB7CF877E7D47A7' # Alexandre Oliva '65EEFE022108E2B708CBFCF7F9E712E59AF5F22A' # Daniel Micay 'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak ) _kernelname=${pkgbase#linux-libre} : ${_kernelname:=-hardened} prepare() { cd $_srcname # add upstream patch msg2 "Applying upstream patch" patch -Np1 < ../patch-${_gnumajver}-${_gnupkgver} # Hotfixes msg2 "Applying hotfixes" patch -p1 -i ../increase-timeout-in-lspcon_wait_mode.patch # linux hardened patch msg2 "Applying hardened patch" patch -Np1 < ../linux-hardened-${pkgver}.patch # graysky2 gcc patch msg2 "Applying graysky2 cpu patch" patch -p1 -i ../enable_additional_cpu_optimizations_for_gcc_v8.1+_kernel_v4.13+.patch # Ignore ath9k eeprom patch msg2 "Applying ath9k patch" patch -p1 -i ../ath9k-regdom-hack.patch msg2 "Setting version..." sed -e "/^EXTRAVERSION =/s/=.*/= .${_hardenedver}/" -i Makefile scripts/setlocalversion --save-scmversion echo "-$pkgrel" > localversion.10-pkgrel echo "$_kernelname" > localversion.20-pkgname msg2 "Setting config..." cp ../config.x86_64 .config make olddefconfig make menuconfig make -s kernelrelease > ../version msg2 "Prepared %s version %s" "$pkgbase" "$(<../version)" } build() { cd $_srcname make bzImage modules } _package() { pkgdesc="The ${pkgbase/linux/Linux} kernel and modules" [[ ${pkgbase} = linux-libre ]] && groups=(base) depends=(coreutils linux-libre-firmware kmod mkinitcpio) optdepends=('crda: to set the correct wireless channels of your country' 'usbctl: deny_new_usb control') backup=("etc/mkinitcpio.d/$pkgbase.preset") install=linux.install local kernver="$( "$startdir/$install.pkg" true && install=$install.pkg # fill in mkinitcpio preset and pacman hooks sed "$subst" ../linux.preset | install -Dm644 /dev/stdin \ "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset" 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" msg2 "Fixing permissions..." chmod -Rc u=rwX,go=rX "$pkgdir" } _package-headers() { pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel" local builddir="$pkgdir/usr/lib/modules/$(