jobcore/linux/PKGBUILD
2022-07-30 22:39:04 +03:00

235 lines
8.8 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=linux
pkgver=5.15.53
pkgrel=02
pkgdesc='Linux 5.15 no zstd no ipv6'
url="https://www.kernel.org/"
arch=(x86_64)
makedepends=( bc kmod libelf pahole cpio perl tar xz
xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick)
options=('!strip')
_srcname=linux-$pkgver
source=(
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.{xz,sign}
config # the main kernel config file
0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
0002-PCI_Add_more_NVIDIA_controllers_to_the_MSI_masking_quirk.patch
0003-iommu_intel_do_deep_dma-unmapping_to_avoid_kernel-flooding.patch
0004-Bluetooth_btintel_Fix_bdaddress_comparison_with_garbage_value.patch
0005-lg-laptop_Recognize_more_models.patch
0006_fix_NFSv4_mount_regression.diff
0100-netfilter-nf_tables-stricter-validation-of-element-data.diff
0101-netfilter-nft_set_pipapo-release-elements-in-clone-from-abort-path.diff
sha256sums
)
export KBUILD_BUILD_HOST=joborunlinux
export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
cd $_srcname
# fix NFSv4 mounting issue regression - FS#73838 / FS#73860
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/patch/?id=6f2836341d8a39e1e000572b10959347d7e61fd9
patch -Rp1 -i ../0006_fix_NFSv4_mount_regression.diff
# FS#75226 - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-34918
patch -Np1 -i ../0100-netfilter-nf_tables-stricter-validation-of-element-data.diff
patch -Np1 -i ../0101-netfilter-nft_set_pipapo-release-elements-in-clone-from-abort-path.diff
echo "Setting version..."
scripts/setlocalversion --save-scmversion
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
local src
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
[[ $src = *.patch ]] || continue
echo "Applying patch $src..."
patch -Np1 < "../$src"
done
echo "Setting config..."
cp ../config .config
make olddefconfig
# diff -u ../config .config || :
#return 1
make -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
}
build() {
cd $_srcname
make all
}
# make htmldocs ## Add this into the build to make docs and uncomment the package section
_package() {
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=(wireguard-lts)
cd $_srcname
local kernver="$(<version)"
local modulesdir="$pkgdir/usr/lib/modules/$kernver"
echo "Installing boot image..."
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
echo "Installing modules..."
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
DEPMOD=/doesnt/exist modules_install # Suppress depmod
# remove build and source links
rm "$modulesdir"/{source,build}
}
_package-headers() {
pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
depends=(pahole)
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo "Installing build files..."
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
localversion.* version vmlinux
install -Dt "$builddir/kernel" -m644 kernel/Makefile
install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
cp -t "$builddir" -a scripts
# add objtool for external module building and enabled VALIDATION_STACK option
install -Dt "$builddir/tools/objtool" tools/objtool/objtool
# add xfs and shmem for aufs building
mkdir -p "$builddir"/{fs/xfs,mm}
echo "Installing headers..."
cp -t "$builddir" -a include
cp -t "$builddir/arch/x86" -a arch/x86/include
install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
# https://bugs.archlinux.org/task/13146
install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# https://bugs.archlinux.org/task/20402
install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
# https://bugs.archlinux.org/task/71392
install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
echo "Installing KConfig files..."
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
echo "Removing unneeded architectures..."
local arch
for arch in "$builddir"/arch/*/; do
[[ $arch = */x86/ ]] && continue
echo "Removing $(basename "$arch")"
rm -r "$arch"
done
echo "Removing documentation..."
rm -r "$builddir/Documentation"
echo "Removing broken symlinks..."
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
echo "Removing loose objects..."
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
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 < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
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="Documentation for the $pkgdesc kernel"
#
# cd $_srcname
# local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
#
# echo "Installing documentation..."
# local src dst
# while read -rd '' src; do
# dst="${src#Documentation/}"
# dst="$builddir/Documentation/${dst#output/}"
# install -Dm644 "$src" "$dst"
# done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
#
# echo "Adding symlink..."
# mkdir -p "$pkgdir/usr/share/doc"
# ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
#}
pkgname=("$pkgbase" "$pkgbase-headers" ) # "$pkgbase-docs")
for _p in "${pkgname[@]}"; do
eval "package_$_p() {
$(declare -f "_package${_p#$pkgbase}")
_package${_p#$pkgbase}
}"
done
#---- license gpg-key sha256sums ----
license=(GPL2)
validpgpkeys=(ABAF11C65A2970B130ABE3C479BE3E4300411886 # Linus Torvalds
647F28654894E3BD457199BE38DBBDC86092693E) # Greg Kroah-Hartman
# https://cdn.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
sha256sums=(f3aa717243051f3fcca90ebfe26fe5c3a596c2f6047846e8d1724ea90df77b07 # linux-5.15.53.tar.xz
8aec9c7aa872464b65dc7082ce647d208069f20518bc0a7fa719c24f600ac643 # linux-5.15.53.tar.sign
9eff0f58d93b27e9a2f61196d947b2e1b1d4676e34f92550b9f930f4bafb1586 # config
99df282c594cc269d9a5d19bb86ea887892d3654cfc53c4ce94a644cf3278423 # 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
c35018601f04ae81e0a2018a8597595db6ae053158c206845399cdebb2d2b706 # 0002-PCI_Add_more_NVIDIA_controllers_to_the_MSI_masking_quirk.patch
7c7707c738983f3683d76295b496f578996b7341fa39ad334ec2833bfe4b966e # 0003-iommu_intel_do_deep_dma-unmapping_to_avoid_kernel-flooding.patch
3fa8a4af66d5a3b99b48ca979a247c61e81c9b2d3bcdffa9d3895a5532a420b4 # 0004-Bluetooth_btintel_Fix_bdaddress_comparison_with_garbage_value.patch
79266c6cc970733fd35881d9a8f0a74c25c00b4d81741b8d4bba6827c48f7c78 # 0005-lg-laptop_Recognize_more_models.patch
e9527ad81d5b1821a7b17c56cb3abaec85785563f51e448cb3c06f1c68e2966f # 0006_fix_NFSv4_mount_regression.diff
b2e03d795a67843b9898367eaf3f2b855487d7e7cbe87b43a0df22b2fb36477c # 0100-netfilter-nf_tables-stricter-validation-of-element-data.diff
08cae506648665a0a2990a690d951dd4432b6eea4ca295dbfc0a836ee63671ea # 0101-netfilter-nft_set_pipapo-release-elements-in-clone-from-abort-path.diff
1d44b2591c8a0c1630e959cc3990fec6858961868e6f407a92d0e7abb0cd7423) # sha256sums