# 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 does not disable hdcp # Parabola version does not disable IME/PSP # Parabola version does not disable VMware and HyperV # Parabola version does not disable insecure filesystems _pkgbase=linux-hardened pkgbase=linux-libre-hardened _supver=5 _majver=9 _minver=6 _hardenedver=a _gccpatchver='20200615' _gccpatchger='10.1' _gccpatchker='5.8' if [ "$_minver" == "0" ]; then _pkgver=${_supver}.${_majver} else _pkgver=${_supver}.${_majver}.${_minver} fi pkgver=${_pkgver}.${_hardenedver} pkgrel=1 pkgdesc='Security-Hardened Linux-libre' 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-mac80211-fix-regression-where-EAPOL-frames-were-sent.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=('30280a22cba46ea899ad6dcd8093630f51684a111759e87db1bf857398cb861c37581734a8ac8b2b083ea477429e47e8b47b0d5a1cb648b9a9f17ec4abf91e17' 'SKIP' '915e5e972a510de4b668be09430eb374d23b862c5589f8019cbfe904f5b7e62db31292e5c702fe3942655feae56b796a80e934cb553524b6c0351fe84a0580c3' 'SKIP' '3006fa726027b57c421c959c4e6c2230cfa871df7a234d4b2061ed1db4784d0c296d90785a2c48f5c059f6e15ad58007773376440054ce6e60a00fc448b939b3' 'c8d0697f99fe6105815217b8ec059d8f587415ea8dd2b88a65e1087feedf697341a64cd56810fde9e7aeada79125fc8235faccc7e7b06492c099e27a8abbe99c' 'b6ef77035611139fa9a6d5b8d30570e2781bb4da483bb569884b0bd0129b62e0b82a5a6776fefe43fee801c70d39de1ea4d4c177f7cedd5ac135e3c64f7b895a' 'fde132f3705d908e6f2147c78a2193289916d72304ca5efa2229d79fc3e57a857314ce94e71425caef2f7f7b6cf87f05ef86335dc8bd4be78e7035afe608005a' '4f2536f2324cc1497500a58a6772b3589094b1d73dc72c85333bd05179fc21b8dde6d9fac8d049514ca8eb57ce72ffb73f17c64e89847f3d86e6c7e13760bc68' 'b4e1377d97ad7e8144d6e55b6d43731e3271a5aec65b65ca6d81026a95f15f549b9303fb3c6f492099ca691e3f65f4cf7f0c3aa742df03b396d7f6d81813aa95' '3871811ccd7528cefaedaa19b799bb0116994282f290684d92ac3f0d9cf6daea42accf6d194ee29554118d68c601237724744a207e83d2c8750ebe8153335276' 'SKIP') export KBUILD_BUILD_HOST=arc4linux 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-mac80211-fix-regression-where-EAPOL-frames-were-sent.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 gcc 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 $(