summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorPiotr Gorski2020-06-25 23:57:58 +0200
committerPiotr Gorski2020-06-25 23:57:58 +0200
commita420f2cf2787863a165ebfc8c764652d31ab737d (patch)
tree23b94e0c88f908bd400275674067023e828e356c /PKGBUILD
downloadaur-a420f2cf2787863a165ebfc8c764652d31ab737d.tar.gz
Init
Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD359
1 files changed, 359 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..eca0635d50b5
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,359 @@
+# Maintainer: Piotr Gorski <lucjan.lucjanov@gmail.com>
+# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
+# Contributor: Tobias Powalowski <tpowa@archlinux.org>
+# Contributor: Thomas Baechler <thomas@archlinux.org>
+
+### BUILD OPTIONS
+# Set these variables to ANYTHING that is not null to enable them
+
+### Tweak kernel options prior to a build via nconfig
+_makenconfig=
+
+### Tweak kernel options prior to a build via menuconfig
+_makemenuconfig=
+
+### Tweak kernel options prior to a build via xconfig
+_makexconfig=
+
+### Tweak kernel options prior to a build via gconfig
+_makegconfig=
+
+### Running with a 1000 HZ tick rate
+_1k_HZ_ticks=y
+
+# NUMA is optimized for multi-socket motherboards.
+# A single multi-core CPU actually runs slower with NUMA enabled.
+# See, https://bugs.archlinux.org/task/31187
+_NUMAdisable=y
+
+# Compile ONLY used modules to VASTLYreduce the number of modules built
+# and the build time.
+#
+# To keep track of which modules are needed for your specific system/hardware,
+# give module_db script a try: https://aur.archlinux.org/packages/modprobed-db
+# This PKGBUILD read the database kept if it exists
+#
+# More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db
+_localmodcfg=
+
+# Use the current kernel's .config file
+# Enabling this option will use the .config of the RUNNING kernel rather than
+# the ARCH defaults. Useful when the package gets updated and you already went
+# through the trouble of customizing your config options. NOT recommended when
+# a new kernel is released, but again, convenient for package bumps.
+_use_current=
+
+### Do not edit below this line unless you know what you're doing
+
+pkgbase=linux-rt-bfq-dev
+# pkgname=('linux-rt-bfq-dev' 'linux-rt-bfq-dev-headers' 'linux-rt-bfq-dev-docs')
+_major=5.6
+_minor=17
+_rtver=10
+_rtpatchver=rt${_rtver}
+pkgver=${_major}.${_minor}.${_rtpatchver}
+_pkgver=${_major}.${_minor}
+_srcname=linux-${_pkgver}
+pkgrel=1
+pkgdesc='Linux RT-BFQ-dev'
+arch=('x86_64')
+url="https://github.com/sirlucjan/bfq-mq-lucjan"
+license=('GPL2')
+options=('!strip')
+makedepends=('kmod' 'bc' 'libelf' 'python-sphinx' 'python-sphinx_rtd_theme'
+ 'graphviz' 'imagemagick')
+#_lucjanpath="https://raw.githubusercontent.com/sirlucjan/kernel-patches/master/${_major}"
+_lucjanpath="https://gitlab.com/sirlucjan/kernel-patches/raw/master/${_major}"
+# Some patches for BFQ conflict with patches for BFQ-dev.
+# To use linux-rt-bfq-dev smoothly apply bfq-reverts before bfq-dev patch.
+# Otherwise the kernel will not compile.
+_bfq_rev_path="bfq-reverts-all-v2"
+_bfq_rev_patch="0001-bfq-reverts.patch"
+_bfq_path="bfq-dev-lucjan"
+_bfq_ver="v11"
+_bfq_rel="r2K200514"
+_bfq_patch="${_major}-${_bfq_path}-${_bfq_ver}-${_bfq_rel}.patch"
+_gcc_path="cpu-patches-v4-sep"
+_gcc_patch="0001-cpu-${_major}-merge-graysky-s-patchset.patch"
+
+source=("https://www.kernel.org/pub/linux/kernel/v5.x/${_srcname}.tar.xz"
+ "https://www.kernel.org/pub/linux/kernel/v5.x/${_srcname}.tar.sign"
+ "http://www.kernel.org/pub/linux/kernel/projects/rt/${_major}/patch-${_pkgver}-${_rtpatchver}.patch.xz"
+ "http://www.kernel.org/pub/linux/kernel/projects/rt/${_major}/patch-${_pkgver}-${_rtpatchver}.patch.sign"
+ "${_lucjanpath}/${_bfq_rev_path}/${_bfq_rev_patch}"
+ "${_lucjanpath}/${_bfq_path}/${_bfq_patch}"
+ "${_lucjanpath}/${_gcc_path}/${_gcc_patch}"
+ "${_lucjanpath}/arch-patches-v16-sep/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch"
+ "${_lucjanpath}/arch-patches-v16-sep/0002-gcc-plugins-drop-support-for-GCC-4.7.patch"
+ 'sphinx-workaround.patch'
+ # the main kernel config files
+ 'config')
+
+export KBUILD_BUILD_HOST=archlinux
+export KBUILD_BUILD_USER=$pkgbase
+export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
+
+prepare() {
+ cd $_srcname
+
+ ### Add rt patch
+ echo "Add rt patch"
+ patch -Np1 -i ../patch-${_pkgver}-${_rtpatchver}.patch
+
+ ### Setting version
+ echo "Setting version..."
+ scripts/setlocalversion --save-scmversion
+ echo "-$pkgrel" > localversion.10-pkgrel
+ echo "${pkgbase#linux}" > localversion.20-pkgname
+
+ ### Patching sources
+ local src
+ for src in "${source[@]}"; do
+ src="${src%%::*}"
+ src="${src##*/}"
+ [[ $src = *.patch ]] || continue
+ echo "Applying patch $src..."
+ patch -Np1 < "../$src"
+ done
+
+ ### Setting config
+ echo "Setting config..."
+ cp ../config .config
+ make olddefconfig
+
+ ### Prepared version
+ make -s kernelrelease > version
+ echo "Prepared $pkgbase version $(<version)"
+
+ ### Optionally use running kernel's config
+ # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
+ if [ -n "$_use_current" ]; then
+ if [[ -s /proc/config.gz ]]; then
+ echo "Extracting config from /proc/config.gz..."
+ # modprobe configs
+ zcat /proc/config.gz > ./.config
+ else
+ warning "Your kernel was not compiled with IKCONFIG_PROC!"
+ warning "You cannot read the current config!"
+ warning "Aborting!"
+ exit
+ fi
+ fi
+
+ ### Optionally set tickrate to 1000
+ if [ -n "$_1k_HZ_ticks" ]; then
+ echo "Setting tick rate to 1k..."
+ sed -i -e 's/^CONFIG_HZ_300=y/# CONFIG_HZ_300 is not set/' \
+ -i -e 's/^# CONFIG_HZ_1000 is not set/CONFIG_HZ_1000=y/' \
+ -i -e 's/^CONFIG_HZ=300/CONFIG_HZ=1000/' ./.config
+ fi
+
+ ### Optionally disable NUMA for 64-bit kernels only
+ # (x86 kernels do not support NUMA)
+ if [ -n "$_NUMAdisable" ]; then
+ echo "Disabling NUMA from kernel config..."
+ sed -i -e 's/CONFIG_NUMA=y/# CONFIG_NUMA is not set/' \
+ -i -e '/CONFIG_AMD_NUMA=y/d' \
+ -i -e '/CONFIG_X86_64_ACPI_NUMA=y/d' \
+ -i -e '/CONFIG_NODES_SPAN_OTHER_NODES=y/d' \
+ -i -e '/# CONFIG_NUMA_EMU is not set/d' \
+ -i -e '/CONFIG_NODES_SHIFT=6/d' \
+ -i -e '/CONFIG_NEED_MULTIPLE_NODES=y/d' \
+ -i -e '/# CONFIG_MOVABLE_NODE is not set/d' \
+ -i -e '/CONFIG_USE_PERCPU_NUMA_NODE_ID=y/d' \
+ -i -e '/CONFIG_ACPI_NUMA=y/d' ./.config
+ fi
+
+ ### Optionally load needed modules for the make localmodconfig
+ # See https://aur.archlinux.org/packages/modprobed-db
+ if [ -n "$_localmodcfg" ]; then
+ if [ -f $HOME/.config/modprobed.db ]; then
+ echo "Running Steven Rostedt's make localmodconfig now"
+ make LSMOD=$HOME/.config/modprobed.db localmodconfig
+ else
+ echo "No modprobed.db data found"
+ exit
+ fi
+ fi
+
+ ### Running make nconfig
+ [[ -z "$_makenconfig" ]] || make nconfig
+
+ ### Running make menuconfig
+ [[ -z "$_makemenuconfig" ]] || make menuconfig
+
+ ### Running make xconfig
+ [[ -z "$_makexconfig" ]] || make xconfig
+
+ ### Running make gconfig
+ [[ -z "$_makegconfig" ]] || make gconfig
+
+ ### Save configuration for later reuse
+ cat .config > "${startdir}/config.last"
+}
+
+build() {
+ cd $_srcname
+
+ make all
+ make htmldocs
+}
+
+_package() {
+ pkgdesc="The $pkgdesc kernel and modules"
+ depends=('coreutils' 'kmod' 'initramfs')
+ optdepends=('crda: to set the correct wireless channels of your country'
+ 'linux-firmware: firmware images needed for some devices'
+ 'modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig')
+ provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE linux-rt-bfq)
+ replaces=('linux-rt-bfq')
+ conflicts=('linux-rt-bfq')
+
+ 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" modules_install
+
+ # remove build and source links
+ rm "$modulesdir"/{source,build}
+}
+
+_package-headers() {
+ pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
+ depends=('linux-rt-bfq-dev')
+ replaces=('linux-rt-bfq-headers')
+ conflicts=('linux-rt-bfq-headers')
+ provides=('linux-rt-bfq-headers')
+
+ 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
+
+ # http://bugs.archlinux.org/task/13146
+ install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
+
+ # http://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
+
+ 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 "Adding symlink..."
+ mkdir -p "$pkgdir/usr/src"
+ ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
+}
+
+_package-docs() {
+ pkgdesc="Documentation for the $pkgdesc kernel"
+ depends=('linux-rt-bfq-dev')
+ replaces=('linux-rt-bfq-docs')
+ conflicts=('linux-rt-bfq-docs')
+ provides=('linux-rt-bfq-docs')
+
+ 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
+
+sha512sums=('7d42eb0327997df85b4c5c7c0babab738f0dd85ef3e739cbc7ce6a21e19821acb72ca6f0beb7636f988b95c29e61b9bf79175ecbdb309835a517f5f538cbc2b3'
+ 'SKIP'
+ '5d5c7ff8da7a06aba70de38a03cfd25a4f3913c79d6723fd44a88fd7a5e9478a925587fda278b8552d14868c1c9c460105eb96fd2d80c3ce2043309e9cdedbad'
+ 'SKIP'
+ '31141f3afa388dbfc7a0a1c0a7b7fc58a6824befea1fc044eb76fc0e6d4c55f249e3e0f7e63c0697ba736dc902d85128c0d78eeffe8eca3c207a573664c74514'
+ '1962d021d48236f287736383acac9176e6f992cf980b5c66c1ba006288b1f2039c02caa81ebf44e99edc0dcaf09160a3fe8e4aece7541b09ec5f30cd8d834dc5'
+ 'd33662ee0009bfec94c66e18a7ba545d777741fd7b2e5bf7663eaf1b9f1ab8e093769c5f2aeafe7f3eb590e49c6f36f504030ea1c0e265d1842927165fbe4206'
+ '8c0ca7ab292e6f1a75fd4ae0de797259bf68a5f1512b9f0c905250446ebb924531589d4b8d4d9d7fb1cdd65658b32a8528a7fb7056947d7b31bdc87b4e424752'
+ '4ef82534e202188bec24232a60af73d48870c7f0b3403ec821b132c38cdccc9917037d74dd94cbcbc6be70cf45006e7ace928c32623cecb5289251c2eb4ea1d8'
+ '98e97155f86bbe837d43f27ec1018b5b6fdc6c372d6f7f2a0fe29da117d53979d9f9c262f886850d92002898682781029b80d4ee923633fc068f979e6c8254be'
+ 'efbb7005a81c86abfd19d070d683ecbc185e7015780cbbd77a32838a5cc953b7f4e0ee3944807e7b4631d326db50945a0838be7b7cdd945cf657a61fc39fad00')
+
+validpgpkeys=(
+ 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
+ '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
+ '64254695FFF0AA4466CC19E67B96E8162A8CF5D1' # Sebastian Andrzej Siewior
+ '5ED9A48FC54C0A22D1D0804CEBC26CDB5A56DE73' # Steven Rostedt
+ 'E644E2F1D45FA0B2EAA02F33109F098506FF0B14' # Thomas Gleixner
+ )