summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD595
1 files changed, 293 insertions, 302 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 766c3cbb9c5f..f2e5ee21fda0 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,354 +1,354 @@
-# $Id$
# Maintainer: shmilee <shmilee.zju@gmail.com>
-# Contributor: Tobias Powalowski <tpowa@archlinux.org>
-# Contributor: Thomas Baechler <thomas@archlinux.org>
-# Contributor: Andreas Radke <andyrtr@archlinux.org>
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
-# last/latest "longterm maintenance" kernel releases
+# last/latest/longest "longterm maintenance" kernel releases
# https://www.kernel.org/category/releases.html
-# 5.4 Greg Kroah-Hartman & Sasha Levin 2019-11-24 Dec, 2021
-_LLL_VER=5.4
-_LLL_SUBVER=72
-
-# Bisect debug, v5.4.47 -> v5.4.48
-_Bisect_debug=off # on, test, off
-if [ "$_Bisect_debug" == "on" ]; then
- _burlbase=https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
- _bcommit=f7757368e0f0b3e108088ca7b5b8abda6faa7ebc #Peter, 8 x
-# _bcommit=2e256dd5b05561b051e895121530d2a0062c7a0f #Jann, 10 v
-# _bdiff="$_burlbase/diff/?h=linux-${_LLL_VER}.y&id2=v${_LLL_VER}.${_LLL_SUBVER}&id=$_bcommit"
- _bpatch="$_burlbase/rawdiff/?h=linux-${_LLL_VER}.y&id2=v${_LLL_VER}.${_LLL_SUBVER}&id=$_bcommit"
- msg "Bisect debug on: v${_LLL_VER}.${_LLL_SUBVER} --> $_bcommit"
- msg "Bisect debug patch: $_bpatch"
+# 6.6 Greg Kroah-Hartman & Sasha Levin 2023-10-29 Dec, 2026
+_LLL_VER=6.6
+_LLL_SUBVER=27
+
+#PKGEXT='.pkg.tar'
+
+# Set x86-64 psABI level: https://dl.xanmod.org/check_x86-64_psabi.sh
+# Need XanMod patch
+# Possible values: v1 / v2 / v3 (default) / v4
+# Default v3 which use CONFIG_GENERIC_CPU3:
+# ref: https://github.com/xanmod/linux/tree/6.1/CONFIGS/xanmod/gcc
+# ref: https://xanmod.org/
+if [ -z ${_psABI_level} ]; then
+ _psABI_level=v3
fi
-# NUMA is optimized for multi-socket motherboards.
-# A single multi-core CPU can actually run slower with NUMA enabled.
-# Most users can disable NUMA.
-# see, https://bugs.archlinux.org/task/31187
-_NUMA_disable=y
+# Use HZ ticks 500 instead of Arch default 300
+# Need XanMod patch, 500 get from `CONFIGS/xanmod/gcc/config_x86-64-v*`
+if [ -z ${_use_HZ_500} ]; then
+ _use_HZ_500=y
+fi
+
+# Set CONFIG_KERNEL_{XZ,ZSTD} CONFIG_MODULE_COMPRESS_{XZ,ZSTD}
+# XZ: 122M linux-shmilee-6.1.15-2-x86_64.pkg.tar.xz
+# ZSTD: 164M linux-shmilee-6.1.15-1-x86_64.pkg.tar.xz
+# Set variable "_use_zstd" to: n to use XZ (slower decompress, smaller size)
+# y to use ZSTD (faster decompress, larger size)
+if [ -z ${_use_zstd} ]; then
+ _use_zstd=n
+fi
-# Add ck patch set
-# http://ck.kolivas.org/patches/5.0/
-# https://wiki.archlinux.org/index.php/Linux-ck
-_CK_VER=1
-_CK_PATCH="http://ck.kolivas.org/patches/5.0/${_LLL_VER}/${_LLL_VER}-ck${_CK_VER}/patch-${_LLL_VER}-ck${_CK_VER}.xz"
+# Disable NUMA since most users do not have multiple processors. Breaks CUDA/NvEnc.
+## Archlinux and Xanmod enable it by default.
+# Set variable "_use_numa" to: n to disable (possibly increase performance)
+# y to enable (stock default)
+if [ -z ${_use_numa+x} ]; then
+ _use_numa=n
+fi
-# Ultra Kernel Samepage Merging
-_UKSM_VER=0.1.2.6
-_UKSM_COMMIT=150e27c4e7f66e4519c89573305eca8c42091f4d
-_UKSM_PATCH="https://raw.githubusercontent.com/dolohow/uksm/${_UKSM_COMMIT}/v5.x/uksm-${_LLL_VER}.patch"
+# Compile ONLY used modules to VASTLY reduce 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
+if [ -z ${_localmodcfg} ]; then
+ _localmodcfg=n
+fi
-# CJKTTY patch
-# https://github.com/Gentoo-zh/linux-cjktty
-# https://github.com/torvalds/linux/compare/v5.4...Gentoo-zh:5.4-utf8
-_CJKTTY_LLL_VER=5.4
-_CJKTTY_PATCH_FILE=linux-cjktty-${_CJKTTY_LLL_VER}
-_CJKTTY_PATCH_URL="https://github.com/torvalds/linux/compare/v${_CJKTTY_LLL_VER}...Gentoo-zh:${_CJKTTY_LLL_VER}-utf8.patch"
-_CJKTTY_PATCH="${_CJKTTY_PATCH_FILE}.patch::${_CJKTTY_PATCH_URL}"
+# XanMod Kernel patch
+# https://xanmod.org/
+# https://github.com/xanmod
+_XanMod_VER=1
+_Xanmod_PATCH_SRC="https://master.dl.sourceforge.net/project/xanmod/releases/lts/${_LLL_VER}.${_LLL_SUBVER}-xanmod${_XanMod_VER}/patch-${_LLL_VER}.${_LLL_SUBVER}-xanmod${_XanMod_VER}.xz"
+#_Xanmod_PATCH_PATCH=()
-_PATHSET_DESC="ck${_CK_VER} uksm-${_UKSM_VER} and cjktty"
+# CJKTTY patch
+# https://github.com/Gentoo-zh/linux-cjktty
+#_CJKTTY_PATCH_URL="https://github.com/torvalds/linux/compare/v${_LLL_VER}...Gentoo-zh:${_LLL_VER}-utf8.patch"
+#_CJKTTY_PATCH_SRC="cjktty-${_LLL_VER}.patch::${_CJKTTY_PATCH_URL}"
+# https://github.com/zhmars/cjktty-patches
+_CJKTTY_COMMIT=b43d618da6d6536338761a5fc7c9c377c318fb9e
+_CJKTTY_PATCH_SRC="https://github.com/zhmars/cjktty-patches/raw/${_CJKTTY_COMMIT}/v6.x/cjktty-${_LLL_VER}.patch"
+_CJKTTY_PATCH_PATCH=()
+
+_PATHSET_DESC="Xanmod patches, cjktty"
+
+_MORE_PATCH=(
+ #"0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch" in Xanmod
+ # 11??-*.patch:: online patches
+ #'1101-Add-6.1.19.patch::https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/rawdiff/?h=linux-6.1.y&id=v6.1.19&id2=v6.1.18'
+)
+######## END ########
pkgbase=linux-shmilee
-pkgname=("${pkgbase}" "${pkgbase}-headers")
-if [ "$_Bisect_debug" == "off" ]; then
- pkgname+=("${pkgbase}-docs")
-fi
-_srcname=linux-${_LLL_VER}
+pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
+#pkgver=${_LLL_VER}.$((_LLL_SUBVER+1)) # 6.1.18 -> 6.1.19
pkgver=${_LLL_VER}.${_LLL_SUBVER}
pkgrel=1
-arch=('x86_64')
+pkgdesc="Linux-shmilee x64${_psABI_level}"
url="https://www.kernel.org/"
-license=('GPL2')
-makedepends=('xmlto' 'kmod' 'inetutils' 'bc' 'libelf' 'python-sphinx' 'graphviz')
+arch=(x86_64)
+license=(GPL2)
+makedepends=(
+ bc libelf pahole cpio perl tar xz gettext
+ xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick
+ #texlive-latexextra
+)
+if [ "$_localmodcfg" = "y" ]; then
+ makedepends+=(modprobed-db)
+fi
options=('!strip')
+_srcname=linux-${_LLL_VER}
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"
- "https://www.kernel.org/pub/linux/kernel/v5.x/patch-${pkgver}.xz"
- #"https://www.kernel.org/pub/linux/kernel/v5.x/patch-${pkgver}.sign"
- ${_CK_PATCH}
- ${_UKSM_PATCH}
- ${_CJKTTY_PATCH}
- 'sphinx-workaround.patch'
- 'ck-patch-for-5.4.57+.patch'
- 'ck-patch-for-5.4.62+.patch'
- 'fix-ck-broken-sleep2ram-5.4.48+.patch' # https://github.com/zen-kernel/zen-kernel/commit/fb7e2cfaf61cf5f9c2336331e73296f455bd2d51.patch
- 'uksm-patch-for-5.4.33+.patch'
- 'uksm-patch-for-5.4.69+.patch'
- 'linux-cjktty-patch-for-5.4.36+.patch'
- 'linux-cjktty-patch-for-5.4.54+.patch'
- 'linux-cjktty-patch-for-5.4.62+.patch'
- 'linux-cjktty-patch-for-5.4.66+.patch'
- 'config' # the main kernel config file
- '60-linux.hook' # pacman hook for depmod
- '90-linux.hook' # pacman hook for initramfs regeneration
- 'linux.preset' # standard config files for mkinitcpio ramdisk
+ https://www.kernel.org/pub/linux/kernel/v6.x/${_srcname}.tar.{xz,sign}
+ #https://www.kernel.org/pub/linux/kernel/v6.x/patch-${pkgver}.{xz,sign} # in Xanmod
+ ${_Xanmod_PATCH_SRC}
+ #${_Xanmod_PATCH_PATCH[@]}
+ ${_CJKTTY_PATCH_SRC}
+ ${_CJKTTY_PATCH_PATCH[@]}
+ ${_MORE_PATCH[@]}
+ config # the main kernel config file
)
validpgpkeys=(
- 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
- '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
+ 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
+ '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
)
-# https://www.kernel.org/pub/linux/kernel/v4.x/sha256sums.asc
-sha256sums=('bf338980b1670bca287f9994b7441c2361907635879169c64ae78364efc5f491'
+# https://www.kernel.org/pub/linux/kernel/v6.x/sha256sums.asc
+sha256sums=('d926a06c63dd8ac7df3f86ee1ffc2ce2a3b81a2d168484e76b5b389aba8e56d0'
'SKIP'
- 'bce941bcb6c8148ac19cd2fa4f1e19c6c75f699a3bcdfd452df7484cff2a2353'
- 'f445eea4d0ec2015a25f1ad625c848f4f2252099795966fa4105e0aa29674c5c'
- '81d34bf02e771a126af5cb382d44a86dcc759c88b7c89fc7e5b7737731b9130e'
- '50213f3270499fceb452946252d61f5471571c77baf3dd510fbb00cfa9831c9a'
- 'b7c814c8183e4645947a6dcc3cbf80431de8a8fd4e895b780f9a5fd92f82cb8e'
- 'a10a4848c7a9842c0c7760b087ea38a4356dc1a2c2e26334cb0106c25785554f'
- '0334391900f31d6aaedaa68e8917f93262ba3e523f2654774b289e9b18c1a923'
- '961ed94b8d905f1e901cacb08d253c4170af0a25828111b7558d9c874e923558'
- '6826624f65276927de012f040e77b02231fe6345b9da7c702deacd9372ea001e'
- 'cdcd0e0ebd24d9b66c216df01b02da23760a44fe2a451137190f89d18a4c7f59'
- '573f1c40951a6ee4cf6b07a6a8a1123b00fcd8bff29843905cf191e08f1d87f2'
- '2c9faabb5e09b1f818b051ced3eb90b6c04aa08616952d99eedf328c7c8dda2f'
- '4d511fb62966549b9ea4a1d97769f79e4d66fc141cd0b001e7d286367a038a09'
- '1f0af2c1044cf177b84fea8bb49aaa5cf9282c5588a7995798d63177565b0727'
- '7ce388e429d8df479a721285e445e116c5ee41e3126a702862e59056460b655e'
- 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
- '75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919'
- 'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65')
-
-_kernelname=${pkgbase#linux}
-
-if [ "$_Bisect_debug" != "off" ]; then
- makedepends+=('wget' 'modprobed-db')
- PKGEXT='.pkg.tar'
-fi
+ '7fd321de9a72916a1aedca63c744f6035d71e5176c22a729870adfc674bbd446'
+ '47a008c8b3b684330f2b80beeaca20105ab3afcded9530b28b078821bd062ba6'
+ 'a8162641380b2681622d0f3c40ce130c9fd1cf6e176b5db18b95ba83609fbcf8')
-prepare() {
- cd ${_srcname}
+export KBUILD_BUILD_HOST=archlinux
+export KBUILD_BUILD_USER=$pkgbase
+export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
- # add upstream patch
- patch -p1 -i ../patch-${pkgver}
+prepare() {
+ cd $_srcname
- # Bisect debug
- if [ "$_Bisect_debug" == "on" ]; then
- msg "Patching upstream v$pkgver --> $_bcommit"
- if [ ! -f "${srcdir}/../v${pkgver}-${pkgrel}-$_bcommit" ]; then
- wget "$_bpatch" -O "${srcdir}/../v${pkgver}-${pkgrel}-$_bcommit"
- fi
- patch -p1 -i "${srcdir}/../v${pkgver}-${pkgrel}-$_bcommit"
- fi
+ msg2 "Patching with Xanmod(include upstream kernel patch-$pkgver)..."
+ patch -Np1 -i ../patch-${_LLL_VER}.${_LLL_SUBVER}-xanmod${_XanMod_VER}
- # add latest fixes from stable queue, if needed
- # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
-
- # fix naming schema in EXTRAVERSION of ck patch set
- sed -i -re "s/^(.EXTRAVERSION).*$/\1 = /" "../patch-${_LLL_VER}-ck${_CK_VER}"
- # Patch source with ck patch set
- msg "Patching source with ck${_CK_VER} including BFS"
- cp "../patch-${_LLL_VER}-ck${_CK_VER}" "../patch-${_LLL_VER}.${_LLL_SUBVER}-ck${_CK_VER}"
- patch -i ../ck-patch-for-5.4.57+.patch "../patch-${_LLL_VER}.${_LLL_SUBVER}-ck${_CK_VER}"
- patch -i ../ck-patch-for-5.4.62+.patch "../patch-${_LLL_VER}.${_LLL_SUBVER}-ck${_CK_VER}"
- patch -Np1 -i "../patch-${_LLL_VER}.${_LLL_SUBVER}-ck${_CK_VER}"
- # Bisect debug result about ck
- if [ "$_Bisect_debug" != "on" ]; then
- #see https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/patch/?id=f7757368e0f0b3e108088ca7b5b8abda6faa7ebc
- patch -p1 -i "../fix-ck-broken-sleep2ram-5.4.48+.patch"
- fi
+ msg2 "Patching with Gentoo-zh/linux-cjktty patches..."
+ cp "../cjktty-${_LLL_VER}.patch" "../cjktty-${_LLL_VER}.${_LLL_SUBVER}.patch"
+ for p in ${_CJKTTY_PATCH_PATCH[@]}; do
+ patch -Ni ../$p "../cjktty-${_LLL_VER}.${_LLL_SUBVER}.patch"
+ done
+ patch -Np1 -i "../cjktty-${_LLL_VER}.${_LLL_SUBVER}.patch"
+
+ local src
+ for src in "${_MORE_PATCH[@]}"; do
+ src="${src%%::*}"
+ src="${src##*/}"
+ msg2 "Applying patch $src..."
+ patch -Np1 < "../$src"
+ done
- msg "Patching source with uksm ${_UKSM_VER} patches"
- cp "../uksm-${_LLL_VER}.patch" "../uksm-${_LLL_VER}.${_LLL_SUBVER}.patch"
- patch -i ../uksm-patch-for-5.4.33+.patch "../uksm-${_LLL_VER}.${_LLL_SUBVER}.patch"
- patch -i ../uksm-patch-for-5.4.69+.patch "../uksm-${_LLL_VER}.${_LLL_SUBVER}.patch"
- patch -Np1 -i "../uksm-${_LLL_VER}.${_LLL_SUBVER}.patch"
+ msg2 "Setting config..."
+ cp ../config .config
- msg "Patching source with Gentoo-zh/linux-cjktty patches"
- cp "../${_CJKTTY_PATCH_FILE}.patch" "../${_CJKTTY_PATCH_FILE}.${_LLL_SUBVER}.patch"
- patch -i ../linux-cjktty-patch-for-5.4.36+.patch "../${_CJKTTY_PATCH_FILE}.${_LLL_SUBVER}.patch"
- patch -i ../linux-cjktty-patch-for-5.4.54+.patch "../${_CJKTTY_PATCH_FILE}.${_LLL_SUBVER}.patch"
- patch -i ../linux-cjktty-patch-for-5.4.62+.patch "../${_CJKTTY_PATCH_FILE}.${_LLL_SUBVER}.patch"
- patch -i ../linux-cjktty-patch-for-5.4.66+.patch "../${_CJKTTY_PATCH_FILE}.${_LLL_SUBVER}.patch"
- patch -Np1 -i "../${_CJKTTY_PATCH_FILE}.${_LLL_SUBVER}.patch"
+ # CONFIG_STACK_VALIDATION gives better stack traces. Also is enabled in all official kernel packages by Archlinux team
+ scripts/config --enable CONFIG_STACK_VALIDATION
- msg "Patching sphinx extensions for htmldocs"
- patch -Np1 -i ../sphinx-workaround.patch
+ # Enable IKCONFIG following Arch's philosophy
+ scripts/config --enable CONFIG_IKCONFIG \
+ --enable CONFIG_IKCONFIG_PROC
- cp -Tf ../config .config
+ # Set CONFIG_GENERIC_CPU?
+ scripts/config --disable CONFIG_GENERIC_CPU
+ scripts/config --disable CONFIG_GENERIC_CPU2
+ scripts/config --disable CONFIG_GENERIC_CPU3
+ scripts/config --disable CONFIG_GENERIC_CPU4
+ if [ "${_psABI_level}" = 'v1' ]; then
+ scripts/config --enable CONFIG_GENERIC_CPU
+ else
+ msg2 "Setting 'CONFIG_GENERIC_CPU${_psABI_level/v/}' for x86-64-${_psABI_level} ..."
+ scripts/config --enable CONFIG_GENERIC_CPU${_psABI_level/v/}
+ fi
- if [ "${_kernelname}" != "" ]; then
- sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
- sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config
+ # set CONFIG_HZ=500 instead of 300
+ if [ "$_use_HZ_500" = 'y' ]; then
+ msg2 "Setting ticks HZ to 500 ..."
+ scripts/config --enable CONFIG_HZ_500
+ scripts/config --disable CONFIG_HZ_300
+ scripts/config --set-val CONFIG_HZ 500
fi
- # set extraversion to pkgrel
- sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
+ # set KERNEL/MODULE compression mode (ZSTD/XZ)
+ if [ "$_use_zstd" = "n" ]; then
+ msg2 "Setting XZ compression mode for modules..."
+ scripts/config --enable CONFIG_KERNEL_XZ
+ scripts/config --enable CONFIG_MODULE_COMPRESS_XZ
+ scripts/config --disable CONFIG_KERNEL_ZSTD
+ scripts/config --disable CONFIG_MODULE_COMPRESS_ZSTD
+ else
+ msg2 "Setting ZSTD compression mode for modules..."
+ scripts/config --enable CONFIG_KERNEL_ZSTD
+ scripts/config --enable CONFIG_MODULE_COMPRESS_ZSTD
+ scripts/config --disable CONFIG_KERNEL_XZ
+ scripts/config --disable CONFIG_MODULE_COMPRESS_XZ
+ fi
# Optionally disable NUMA for 64-bit kernels only
- if [ -n "$_NUMA_disable" ] && [ "${CARCH}" = "x86_64" ]; then
- msg "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
+ if [ "$_use_numa" = "n" ] && [ "${CARCH}" = "x86_64" ]; then
+ msg2 "Disabling NUMA..."
+ scripts/config --disable CONFIG_NUMA
+ scripts/config --disable CONFIG_AMD_NUMA
+ scripts/config --disable CONFIG_X86_64_ACPI_NUMA
+ scripts/config --disable CONFIG_NODES_SPAN_OTHER_NODES
+ scripts/config --disable CONFIG_NUMA_EMU
+ scripts/config --disable CONFIG_NODES_SHIFT
+ scripts/config --disable CONFIG_NEED_MULTIPLE_NODES
+ scripts/config --disable CONFIG_USE_PERCPU_NUMA_NODE_ID
+ scripts/config --disable CONFIG_ACPI_NUMA
+ scripts/config --disable CONFIG_ARCH_SUPPORTS_NUMA_BALANCING
fi
- # don't run depmod on 'make install'. We'll do this ourselves in packaging
- sed -i '2iexit 0' scripts/depmod.sh
-
- # get kernel version
- make prepare
+ msg2 "Add anbox support..."
+ scripts/config --enable CONFIG_ASHMEM
+ # CONFIG_ION is not set
+ scripts/config --enable CONFIG_ANDROID
+ scripts/config --enable CONFIG_ANDROID_BINDER_IPC
+ scripts/config --enable CONFIG_ANDROID_BINDERFS
+ scripts/config --set-str CONFIG_ANDROID_BINDER_DEVICES "binder,hwbinder,vndbinder,binderfs"
+ scripts/config --enable CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
+ # CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set
+
+ ### Optionally load needed modules for the make localmodconfig
+ # See https://aur.archlinux.org/packages/modprobed-db
+ if [ "$_localmodcfg" = "y" ]; then
+ if [ ! -f $HOME/.config/modprobed.db ]; then
+ if [ x"$USER" == x"builduser" ]; then
+ SUDO_USER=builduser modprobed-db
+ SUDO_USER=builduser modprobed-db store # for makechrootpkg
+ else
+ modprobed-db
+ modprobed-db store
+ fi
+ fi
+ if [ -f $HOME/.config/modprobed.db ]; then
+ msg2 "Running Steven Rostedt's make localmodconfig now"
+ yes "" | make LSMOD=$HOME/.config/modprobed.db localmodconfig
+ else
+ msg2 "No modprobed.db data found"
+ exit 1
+ fi
+ fi
- # load configuration
- # Configure the kernel. Replace the line below with one of your choice.
- #make menuconfig # CLI menu for configuration
- #make nconfig # new CLI menu for configuration
- #make xconfig # X-based configuration
- #make oldconfig # using old config from previous kernel version
- # ... or manually edit .config
+ # rewrite configuration
+ yes "" | make olddefconfig
+ diff -u ../config .config || :
- if [ "$_Bisect_debug" != "off" ]; then
- make LSMOD=$HOME/.config/modprobed.db localmodconfig
+ msg2 "Setting version..."
+ if [ "${_psABI_level}" = 'v1' ]; then
+ echo "" > localversion
+ else
+ msg2 "Add localversion '-x64${_psABI_level}'"
+ #scripts/config --set-str CONFIG_LOCALVERSION "-x64${_psABI_level}"
+ echo "-x64${_psABI_level}" > localversion
fi
+ echo "-$pkgrel" > localversion.10-pkgrel
+ echo "${pkgbase#linux}" > localversion.20-pkgname
- # rewrite configuration
- yes "" | make config >/dev/null
+ make -s kernelrelease > version
+ msg2 "Prepared $pkgbase version $(<version)"
}
build() {
- cd ${_srcname}
-
- if [ "$_Bisect_debug" == "off" ]; then
- make ${MAKEFLAGS} LOCALVERSION= bzImage modules htmldocs
- else
- make ${MAKEFLAGS} LOCALVERSION= bzImage modules
- fi
+ cd $_srcname
+ make htmldocs all
}
_package() {
- pkgdesc="The ${pkgbase/linux/Linux} kernel and modules with the ${_PATHSET_DESC} patchsets"
- [ "${pkgbase}" = "linux" ] && groups=('base')
- depends=('coreutils' 'kmod' 'mkinitcpio')
- optdepends=('crda: to set the correct wireless channels of your country'
+ pkgdesc="The $pkgdesc kernel and modules with ${_PATHSET_DESC} and ashmem, binder enabled"
+ depends=(coreutils kmod mkinitcpio)
+ optdepends=('wireless-regdb: to set the correct wireless channels of your country'
'linux-firmware: firmware images needed for some devices')
- backup=("etc/mkinitcpio.d/${pkgbase}.preset")
- install=linux.install
-
- cd ${_srcname}
+ provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE)
+ #replaces=(virtualbox-guest-modules-arch wireguard-arch)
- # get kernel version
- _kernver="$(make LOCALVERSION= kernelrelease)"
- _basekernel=${_kernver%%-*}
- _basekernel=${_basekernel%.*}
-
- mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
+ cd $_srcname
+ local kernver="$(<version)"
+ local modulesdir="$pkgdir/usr/lib/modules/$kernver"
msg2 "Installing boot image..."
- install -Dm644 "$(make -s image_name)" "${pkgdir}/boot/vmlinuz-${pkgbase}"
+ # 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"
msg2 "Installing modules..."
- make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
-
- # make room for external modules
- local _extramodules="extramodules-${_basekernel}${_kernelname:--ARCH}"
- ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules"
-
- # add real version for building modules and running depmod from hook
- echo "${_kernver}" |
- install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version"
-
- # remove build and source links
- rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build}
-
- # remove the firmware
- rm -rf "${pkgdir}/usr/lib/firmware"
-
- # now we call depmod...
- depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"
-
- msg2 "Installing hooks..."
- # sed expression for following substitutions
- local _subst="
- s|%PKGBASE%|${pkgbase}|g
- s|%KERNVER%|${_kernver}|g
- s|%EXTRAMODULES%|${_extramodules}|g
- "
-
- # hack to allow specifying an initially nonexisting install file
- sed "${_subst}" "${startdir}/${install}" > "${startdir}/${install}.pkg"
- true && install=${install}.pkg
-
- # install mkinitcpio preset file and pacman hooks
- sed "${_subst}" ../linux.preset | install -Dm644 /dev/stdin \
- "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
- sed "${_subst}" ../60-linux.hook | install -Dm644 /dev/stdin \
- "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook"
- sed "${_subst}" ../90-linux.hook | install -Dm644 /dev/stdin \
- "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
-
- msg2 "Fixing permissions..."
- chmod -Rc u=rwX,go=rX "$pkgdir"
+ make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
+ DEPMOD=/doesnt/exist modules_install # Suppress depmod
+ # https://github.com/archlinux/svntogit-packages/commit/a65a47973b7676de60add0f40277900a91c115f1
+
+ # remove build link
+ rm "$modulesdir"/build
}
_package-headers() {
- pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel"
+ pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
+ depends=(pahole)
- cd ${_srcname}
- local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
+ cd $_srcname
+ local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
msg2 "Installing build files..."
- install -Dt "${_builddir}" -m644 Makefile .config Module.symvers System.map vmlinux
- install -Dt "${_builddir}/kernel" -m644 kernel/Makefile
- install -Dt "${_builddir}/arch/x86" -m644 arch/x86/Makefile
- cp -t "${_builddir}" -a scripts
+ 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
+ # required when STACK_VALIDATION is enabled
+ install -Dt "$builddir/tools/objtool" tools/objtool/objtool
- # add xfs and shmem for aufs building
- mkdir -p "${_builddir}"/{fs/xfs,mm}
-
- # ???
- mkdir "${_builddir}/.tmp_versions"
+ # required when DEBUG_INFO_BTF_MODULES is enabled
+ install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
msg2 "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
+ 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
- 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
- # http://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
- # 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
+ # https://bugs.archlinux.org/task/71392
+ install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
msg2 "Installing KConfig files..."
- find . -name 'Kconfig*' -exec install -Dm644 {} "${_builddir}/{}" \;
+ find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
msg2 "Removing unneeded architectures..."
- local _arch
- for _arch in "${_builddir}"/arch/*/; do
- [[ ${_arch} == */x86/ ]] && continue
- rm -r "${_arch}"
+ local arch
+ for arch in "$builddir"/arch/*/; do
+ [[ $arch = */x86/ ]] && continue
+ msg2 "Removing $(basename "$arch")"
+ rm -r "$arch"
done
- msg2 "Removing files already in linux-docs package..."
- rm -r "${_builddir}/Documentation"
+ msg2 "Removing documentation..."
+ rm -r "$builddir/Documentation"
msg2 "Removing broken symlinks..."
- find -L "${_builddir}" -type l -printf 'Removing %P\n' -delete
+ find -L "$builddir" -type l -printf 'Removing %P\n' -delete
msg2 "Removing loose objects..."
- find "${_builddir}" -type f -name '*.o' -printf 'Removing %P\n' -delete
+ find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
msg2 "Stripping build tools..."
local file
while read -rd '' file; do
- case "$(file -bi "$file")" in
+ case "$(file -Sib "$file")" in
application/x-sharedlib\;*) # Libraries (.so)
strip -v $STRIP_SHARED "$file" ;;
application/x-archive\;*) # Libraries (.a)
@@ -358,49 +358,40 @@ _package-headers() {
application/x-pie-executable\;*) # Relocatable binaries
strip -v $STRIP_SHARED "$file" ;;
esac
- done < <(find "${_builddir}" -type f -perm -u+x ! -name vmlinux -print0)
+ done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
+
+ msg2 "Stripping vmlinux..."
+ strip -v $STRIP_STATIC "$builddir/vmlinux"
msg2 "Adding symlink..."
mkdir -p "$pkgdir/usr/src"
- ln -sr "${_builddir}" "$pkgdir/usr/src/$pkgbase-$pkgver"
-
- msg2 "Fixing permissions..."
- chmod -Rc u=rwX,go=rX "$pkgdir"
+ ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
}
_package-docs() {
- pkgdesc="Kernel hackers manual - HTML documentation that comes with the ${pkgbase/linux/Linux} kernel"
+ pkgdesc="Documentation for the $pkgdesc kernel"
- cd ${_srcname}
- local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
+ cd $_srcname
+ local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
msg2 "Installing documentation..."
- mkdir -p "${_builddir}"
- cp -t "${_builddir}" -a Documentation
-
- msg2 "Removing doctrees..."
- rm -r "${_builddir}/Documentation/output/.doctrees"
-
- msg2 "Moving HTML docs..."
local src dst
while read -rd '' src; do
- dst="${_builddir}/Documentation/${src#${_builddir}/Documentation/output/}"
- mkdir -p "${dst%/*}"
- mv "$src" "$dst"
- rmdir -p --ignore-fail-on-non-empty "${src%/*}"
- done < <(find "${_builddir}/Documentation/output" -type f -print0)
+ dst="${src#Documentation/}"
+ dst="$builddir/Documentation/${dst#output/}"
+ install -Dm644 "$src" "$dst"
+ done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
msg2 "Adding symlink..."
- mkdir -p "${pkgdir}/usr/share/doc"
- ln -sr "${_builddir}/Documentation" "${pkgdir}/usr/share/doc/${pkgbase}"
-
- msg2 "Fixing permissions..."
- chmod -Rc u=rwX,go=rX "${pkgdir}"
+ mkdir -p "$pkgdir/usr/share/doc"
+ ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
}
-for _p in ${pkgname[@]}; do
- eval "package_${_p}() {
- $(declare -f "_package${_p#${pkgbase}}")
- _package${_p#${pkgbase}}
+for _p in "${pkgname[@]}"; do
+ eval "package_$_p() {
+ $(declare -f "_package${_p#$pkgbase}")
+ _package${_p#$pkgbase}
}"
done
+
+# vim:set ts=8 sts=2 sw=2 et: