# Maintainer: jc_gargma # Maintainer (Arch): Levente Polyak # Contributor: Aqua-sama # Contributor (Arch): Daniel Micay # Contributor (Arch): Tobias Powalowski # Contributor (Arch): Thomas Baechler # # I maintain this because: # Parabola version patch script does not apply consistently # Parabola version lacks graysky gcc patch # Parabola version lacks ath9k regdom and raid6 algo patches # Parabola version is 300 Hz # Parabola version does not disable lockdown eee # Parabola version allows insecure filesystems # Parabola version enables ISDN and Infiniband # Parabola version enables VMware and HyperV _pkgbase=linux-hardened pkgbase=linux-libre-hardened _supver=5 _majver=7 _minver=17 _hardenedver=a _gccpatchver='20200615' _gccpatchger='10.1' _gccpatchker='5.7' if [ "$_minver" == "0" ]; then _pkgver=${_supver}.${_majver} else _pkgver=${_supver}.${_majver}.${_minver} fi pkgver=${_pkgver}.${_hardenedver} pkgrel=1 pkgdesc='Linux-libre-hardened' url='https://github.com/anthraxx/linux-hardened' arch=(x86_64) license=(GPL2) makedepends=( bc kmod libelf xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick ) #provides=('linux-libre-hardened') conflicts=('linux-hardened') options=('!strip') _srcname=linux-${_supver}.${_majver} _gnumajver=${_supver}.${_majver}-gnu _gnupkgver=${_pkgver}-gnu source=( https://linux-libre.fsfla.org/pub/linux-libre/releases/${_gnumajver}/linux-libre-${_gnumajver}.tar.xz{,.sign} https://github.com/anthraxx/${_pkgbase}/releases/download/${pkgver}/${_pkgbase}-${pkgver}.patch{,.sig} 0002-PCI-EDR-Log-only-ACPI_NOTIFY_DISCONNECT_RECOVER-even.patch 0003-virt-vbox-Add-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch kernel_gcc_patch-${_gccpatchver}.tar.gz::https://github.com/graysky2/kernel_gcc_patch/archive/${_gccpatchver}.tar.gz ath9k-regdom-hack.patch raid6-default-algo.patch config # the main kernel config file sphinx-workaround.patch ) if [ "$_minver" != "0" ]; then source+=(https://linux-libre.fsfla.org/pub/linux-libre/releases/${_gnupkgver}/patch-${_gnumajver}-${_gnupkgver}.xz{,.sign}) fi validpgpkeys=( '474402C8C582DAFBE389C427BCB7CF877E7D47A7' # Alexandre Oliva 'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak ) b2sums=('bb65e65c69d1c38943327a0859028c843439590e9f1af66705a0fe01aaf006daf14a5a0adfaef6d1de53511e50b2f6b8ee13caa63dd7cf4065253599fe524998' 'SKIP' 'a091bc68794cbf33891bdbfe240517998d194b9dca6d1e93292453a9a6c27f89606d0a729383f895a5c083c4f54fbadaf2cc6f33bfdab3132df17453a9fb8c2e' 'SKIP' '490c7d188215f1d24b5807a744853fa308c2cd17c9eb8668918a50a0c58cab9cbc9ee13ac9abbb614eb010a4a56e9092fea4440d44c80c8e67f2d9abdf19a83f' '00900ec68ad9ebdf5b9103cb8383ee94b97d2b243cb4458f04f877a1b294817e8a140ce2832d424030d039c48f37eaa5bc5fae7a158da495d78e659b8b3006dc' 'c8d0697f99fe6105815217b8ec059d8f587415ea8dd2b88a65e1087feedf697341a64cd56810fde9e7aeada79125fc8235faccc7e7b06492c099e27a8abbe99c' '2e58bb89b247b1678355368956e67c1de51fcde97a227b2162f6771e30f17fa5520faafe7be4b6816a542e7ae10d05f64c6b6354f352c12746d4b8da632936dd' 'fde132f3705d908e6f2147c78a2193289916d72304ca5efa2229d79fc3e57a857314ce94e71425caef2f7f7b6cf87f05ef86335dc8bd4be78e7035afe608005a' '136ee790f239caad23c11faae81c711853b857e8d4d8f2c112695069915363cc67087efb2552a1b351154a088b535af3263a751eb225f5d34955391bb0bc31d7' 'b4e1377d97ad7e8144d6e55b6d43731e3271a5aec65b65ca6d81026a95f15f549b9303fb3c6f492099ca691e3f65f4cf7f0c3aa742df03b396d7f6d81813aa95' '481ef40f302a344b9d84f988b17eca81a7007c06393f2d81baed4fb36cbd2dd76a7d6aa0118807ded2cdae269d36a6c91b09ede0bd293eeda2e3b543d082e9ce' 'SKIP') export KBUILD_BUILD_HOST=$pkgbase export KBUILD_BUILD_USER=$pkgbase export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" prepare() { cd $_srcname # add upstream patch if [ "$_minver" != "0" ]; then echo "Applying upstream patch" patch -Np1 < ../patch-${_gnumajver}-${_gnupkgver} fi # Hotfixes echo "Applying hotfixes" patch -p1 -i ../0002-PCI-EDR-Log-only-ACPI_NOTIFY_DISCONNECT_RECOVER-even.patch patch -p1 -i ../0003-virt-vbox-Add-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch patch -p1 -i ../sphinx-workaround.patch # linux hardened patch echo "Applying hardened patch" patch -Np1 < ../linux-hardened-${pkgver}.patch # graysky gcc patch echo "Applying graysky cpu patch" patch -p1 -i ../kernel_gcc_patch-${_gccpatchver}/enable_additional_cpu_optimizations_for_gcc_v${_gccpatchger}+_kernel_v${_gccpatchker}+.patch # Ignore ath9k eeprom patch echo "Applying ath9k patch" patch -p1 -i ../ath9k-regdom-hack.patch # Set default raid6 algo patch echo " Applying raid6 patch" patch -p1 -i ../raid6-default-algo.patch echo "Setting version..." sed -e "/^EXTRAVERSION =/s/=.*/= .${_hardenedver}/" -i Makefile scripts/setlocalversion --save-scmversion echo "-$pkgrel" > localversion.10-pkgrel echo "${pkgbase#linux}" > localversion.20-pkgname echo "Setting config..." # we are in src/linux-x.yy.zz, looking for a config next to the pkgbuild # if [ -f ${SRCDEST}/config.libre-hardened.previous ]; then # cp ${SRCDEST}/config.libre-hardened.previous .config # else cp ../config .config # fi make olddefconfig make menuconfig # Remove sublevel when no sublevel exists if [ "$_minver" == "0" ]; then sed -i '/SUBLEVEL = 0/d' Makefile fi make -s kernelrelease > version # workaround for make -s kernelrelease not applying # localversion to version when changed using menuconfig grep -Po '(?<=CONFIG_LOCALVERSION=").*(?=")' .config > ../localversion echo "$_pkgver" > ../version.temp echo ".$_hardenedver" >> ../version.temp cat "localversion.10-pkgrel" >> ../version.temp cat "localversion.20-pkgname" >> ../version.temp cat ../localversion >> ../version.temp cat ../version.temp | tr -d "\n" > version # back up the config # echo "Backing up config..." # cp .config ${SRCDEST}/config.libre-hardened.previous echo "Prepared $pkgbase version $(