jobcore/linux-lts/PKGBUILD

227 lines
7.8 KiB
Bash
Raw Normal View History

2022-03-20 13:19:37 +01:00
#!/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-lts
2023-07-29 00:18:20 +02:00
pkgver=5.10.188
2022-03-20 13:19:37 +01:00
pkgrel=01
2023-07-29 00:18:20 +02:00
pkgdesc='LTS Linux 5.10 w/o zstd & ipv6 + nvme-fix patch'
2022-03-20 13:19:37 +01:00
_url="https://www.kernel.org/"
2023-06-07 01:32:39 +02:00
makedepends=(bc kmod libelf pahole cpio perl tar xz
kmod xmlto python-sphinx python-sphinx_rtd_theme
graphviz imagemagick) # python-six
2022-03-20 13:19:37 +01:00
options=('!strip')
_srcname=linux-$pkgver
url="https://cdn.kernel.org/pub/linux/kernel"
source=($url/v5.x/$_srcname.tar.{xz,sign}
2022-03-20 13:19:37 +01:00
config # the main kernel config file
2022-12-04 04:44:42 +01:00
0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
2023-07-29 00:18:20 +02:00
0002-fix-nvme.patch
sha256sums::https://cdn.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
)
# https://build.opensuse.org/package/show/home:curb:ArchLinux/linux-lts510
2023-06-07 01:32:39 +02:00
2022-03-20 13:19:37 +01:00
export KBUILD_BUILD_HOST=joborun
export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
cd $_srcname
echo "Setting version... $pkgver"
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
2022-12-10 09:57:32 +01:00
echo "Setting joborun config..."
2022-03-20 13:19:37 +01:00
cp ../config .config
make olddefconfig
2023-06-07 01:32:39 +02:00
# diff -u ../config .config || :
2022-09-03 00:50:45 +02:00
2022-03-20 13:19:37 +01:00
make -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
}
build() {
cd $_srcname
make all
2022-03-20 13:19:37 +01:00
}
## make htmldocs
_package() {
2022-06-11 14:01:23 +02:00
pkgdesc="The $pkgdesc kernel and modules w/o zstd ipv6 touchscreen"
2022-03-20 13:19:37 +01:00
depends=(coreutils kmod initramfs)
2022-08-07 13:17:14 +02:00
optdepends=('wireless-regdb: to set the correct wireless channels of your country'
2022-03-20 13:19:37 +01:00
'linux-firmware: firmware images needed for some devices')
2023-02-19 19:14:50 +01:00
provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
2023-07-29 00:18:20 +02:00
replaces=(virtualbox-guest-modules wireguard)
2022-03-20 13:19:37 +01:00
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..."
2022-12-10 09:57:32 +01:00
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
2023-06-07 01:32:39 +02:00
DEPMOD=/doesnt/exist modules_install # Suppress depmod
2022-09-03 00:50:45 +02:00
2022-03-20 13:19:37 +01:00
# 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
2022-12-10 09:57:32 +01:00
# required when STACK_VALIDATION is enabled
2022-03-20 13:19:37 +01:00
# 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}
2023-07-29 00:18:20 +02:00
# required when DEBUG_INFO_BTF_MODULES is enabled
2022-12-10 09:57:32 +01:00
install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
2023-07-08 00:05:51 +02:00
2022-03-20 13:19:37 +01:00
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
2022-12-10 09:57:32 +01:00
case "$(file -Sib "$file")" in
2022-03-20 13:19:37 +01:00
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
2023-03-06 03:02:33 +01:00
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
2022-03-20 13:19:37 +01:00
license=(GPL2)
2023-06-07 01:32:39 +02:00
validpgpkeys=(ABAF11C65A2970B130ABE3C479BE3E4300411886 # Linus Torvalds
647F28654894E3BD457199BE38DBBDC86092693E) # Greg Kroah-Hartman
2022-03-20 13:19:37 +01:00
# https://cdn.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
2023-07-29 00:18:20 +02:00
# sha256sums:c9558bab35e23ae67661bfb3192c609c857f78582a035449ae63e33d04ab6112 linux-5.10.188.tar.xz
2022-12-04 04:44:42 +01:00
2023-07-29 00:18:20 +02:00
sha256sums=(c9558bab35e23ae67661bfb3192c609c857f78582a035449ae63e33d04ab6112 # linux-5.10.188.tar.xz
bd60b595855bb1742fb979e9300e4c1c53689b67697f37d2eafd577940a0ccbd # linux-5.10.188.tar.sign
4076fafd2c0a4fbcf76a41b8db47c75d2d6ca4a791d0ec18621410ae2bc000f3 # config
2022-12-04 04:44:42 +01:00
96a72e1652314215da7140956c3abcf495cafd00811eda3cf4ce03ec5f791f1e # 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
2023-07-29 00:18:20 +02:00
0e14c0d788262a9781d8ba1d6e894f30877f015ccf0b6d768d759eac48bcede9 # 0002-fix-nvme.patch
4d526a76636cc3cf23f9b5b2dd13064d7e885e620f800521158244195e0aff40) # sha256sums
2023-01-28 02:34:27 +01:00
2023-07-29 00:18:20 +02:00
## 59d9b93b44774ef6db169c4fa44b4f77f9758283c5f3f5d34f1be28e88a4a194 linux-lts-5.10.188-01-x86_64.pkg.tar.lz
## f8a4811b4372e04bd5847b54c3757536256506768084e9773a67e8154a389287 linux-lts-headers-5.10.188-01-x86_64.pkg.tar.lz