# 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 with bdver2 fix # 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=6 _minver=17 _hardenedver=a _gccpatchver='20200527' _gccpatchger='10.1' _gccpatchker='v5.5-v5.6' 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} graysky_bdver2-hotfix.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=('921a3836ffbd5ababb897b8d923ab3e97c10c39b8d01060fe41742005f8111b5c2c9e76c9b7bcf4fe59a056454a364eca5df8006ca8a174205df152007e18dff' 'SKIP' '4acb1ce1bee1ef1d3357467dfc66df469b7bb2b7026b3ae5f94787f7d8fec3f94ecba6ea61cc051e4f5c01dddeb2de5b217e99ae7583a8eb475bd3ff23acbd59' 'SKIP' '76137504bd6eb54b9aa1eb3f3d78ec60b80d607d0554ba5ec60431db2b62963354e1461b57a8de4f89d4399ef7f66041c6b2366b5d9fd53d5f9857a9dabd4188' 'c8a52c056ecaeba55bee0b17c6a264d460792694e883b5654b8c1694b376a25be4aff1e6b86b5e3486c6e3adfc2062f805e91a9cac1156d0104d7e781028bec6' '2e58bb89b247b1678355368956e67c1de51fcde97a227b2162f6771e30f17fa5520faafe7be4b6816a542e7ae10d05f64c6b6354f352c12746d4b8da632936dd' 'fde132f3705d908e6f2147c78a2193289916d72304ca5efa2229d79fc3e57a857314ce94e71425caef2f7f7b6cf87f05ef86335dc8bd4be78e7035afe608005a' 'be6ce87746752a05eec4c8b62453ebbb5be304ea92e76b8f33f6dd2610bd5dc11adc4b9458784fb4ff712e7c17b3c4dd0751d54f07e6f23caccacb685f3496b6' 'b4e1377d97ad7e8144d6e55b6d43731e3271a5aec65b65ca6d81026a95f15f549b9303fb3c6f492099ca691e3f65f4cf7f0c3aa742df03b396d7f6d81813aa95' 'ca235ac9245831646631a38a37247cfa59889258bfb6f3eaa9ce4cbc610f31cbe8ff14eb79ce1b489db4bc1ea6d675fdfd6825473dcd4b2e500c7c983de0808c' '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 ../sphinx-workaround.patch # linux hardened patch echo "Applying hardened patch" patch -Np1 < ../linux-hardened-${pkgver}.patch # graysky gcc hotfixes echo "Applying graysky gcc patch hotfixes" patch -p1 -i ../graysky_bdver2-hotfix.patch "$srcdir/kernel_gcc_patch-${_gccpatchver}/enable_additional_cpu_optimizations_for_gcc_v${_gccpatchger}+_kernel_${_gccpatchker}.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_${_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 $(