6.10.2-1 (clr 6.10.2-1454) maintainer switch

metak announced that he had orphaned the package due to time constraints and a new pc. I have now took over the maintainership of the package. Nothing would/should change.
In this commit I added some comments in various places, added a few build options and generally ported some stuff from my (formerly) softfork at https://git.staropensource.de/JeremyStarTM/jstm-optimized.

Enjoy :3
This commit is contained in:
JeremyStar™ 2024-08-06 21:07:57 +02:00
parent e6ad9bba1b
commit 660c2a1864
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
3 changed files with 263 additions and 260 deletions

View file

@ -1,6 +1,6 @@
pkgbase = linux-clear pkgbase = linux-clear
pkgdesc = Clear Linux pkgdesc = Linux kernel with patches from Clear Linux to allow for higher performance.
pkgver = 6.9.8 pkgver = 6.10.2+clr6.10.2_1454
pkgrel = 1 pkgrel = 1
url = https://github.com/clearlinux-pkgs/linux url = https://github.com/clearlinux-pkgs/linux
arch = x86_64 arch = x86_64
@ -16,34 +16,33 @@ pkgbase = linux-clear
makedepends = tar makedepends = tar
makedepends = xz makedepends = xz
makedepends = zstd makedepends = zstd
options = !debug
options = !strip options = !strip
source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.9.tar.xz options = !debug
source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.9.tar.sign source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.10.tar.xz
source = https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-6.9.8.xz source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.10.tar.sign
source = linux-clear::git+https://github.com/clearlinux-pkgs/linux.git#tag=6.9.7-1445 source = https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-6.10.2.xz
source = cl-linux::git+https://github.com/clearlinux-pkgs/linux.git#tag=6.10.2-1454
source = more-uarches-20240221.2.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/20240221.2.tar.gz source = more-uarches-20240221.2.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/20240221.2.tar.gz
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
sha256sums = 24fa01fb989c7a3e28453f117799168713766e119c5381dac30115f18f268149 sha256sums = 774698422ee54c5f1e704456f37c65c06b51b4e9a8b0866f34580d86fef8e226
sha256sums = SKIP sha256sums = SKIP
sha256sums = cf7dbb88fa35557195f8cde7fd05ec873db95af91cbcae7472a13d9bc9c5cbaa sha256sums = f3166b9b9f6a7dbae9ed7e92e373c8ddb672c5bd2da3991207aa30f52ceda7fa
sha256sums = SKIP sha256sums = SKIP
sha256sums = 1d3ac3e581cbc5108f882fcdc75d74f7f069654c71bad65febe5ba15a7a3a14f sha256sums = 1d3ac3e581cbc5108f882fcdc75d74f7f069654c71bad65febe5ba15a7a3a14f
pkgname = linux-clear pkgname = linux-clear
pkgdesc = The Clear Linux kernel and modules pkgdesc = Linux kernel with patches from Clear Linux to allow for higher performance. This package includes the kernel and compiled modules.
install = linux.install install = linux.install
depends = coreutils depends = coreutils
depends = kmod depends = kmod
depends = initramfs depends = initramfs
optdepends = wireless-regdb: to set the correct wireless channels of your country optdepends = wireless-regdb: to set the correct wireless channels of your country
optdepends = linux-firmware: firmware images needed for some devices optdepends = linux-firmware: firmware images needed for some devices
optdepends = 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 provides = VIRTUALBOX-GUEST-MODULES
provides = WIREGUARD-MODULE provides = WIREGUARD-MODULE
provides = KSMBD-MODULE provides = KSMBD-MODULE
pkgname = linux-clear-headers pkgname = linux-clear-headers
pkgdesc = Headers and scripts for building modules for the Clear Linux kernel pkgdesc = Linux kernel with patches from Clear Linux to allow for higher performance. This package includes header files and scripts for building kernel modules.
depends = pahole depends = pahole

489
PKGBUILD
View file

@ -1,25 +1,56 @@
# Maintainer: JeremyStarTM <jeremystartm@staropensource.de>
# Maintainer: Josip Ponjavic <josipponjavic at gmail dot com> # Maintainer: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor:
### BUILD OPTIONS ### BUILD OPTIONS
# Set the next two variables to ANYTHING that is not null to enable them # You can modify these settings by executing "env _<setting>=<value> makepkg"
# instead of modifying the PKGBUILD file. Here's an example:
# env _makemenuconfig=y _copyfinalconfig=y _subarch=42 makepkg
# Tweak kernel options prior to a build via nconfig # Tweak kernel options prior to a build via menuconfig.
#
# Set to anything but null to activate.
: "${_makemenuconfig:=""}"
# Tweak kernel options prior to a build via nconfig.
#
# Set to anything but null to activate.
: "${_makenconfig:=""}" : "${_makenconfig:=""}"
# Only compile active modules to VASTLY reduce the number of modules built and # Tweak kernel options prior to a build via xconfig.
# the build time. #
# Set to anything but null to activate.
: "${_makexconfig:=""}"
# Use the current kernel's .config file
# Enabling this option will use the .config of the currently
# running kernel rather than the Arch Linux 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.
# #
# Set to anything but null to activate.
: "${_use_current:=""}"
# Determines whether the kernel configuration should be
# copied into the source tree before compilation starts.
#
# Set to anything but null to activate.
: "${_copyfinalconfig:=""}"
# Only compile active 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, # To keep track of which modules are needed for your specific system/hardware,
# give module_db a try: https://aur.archlinux.org/packages/modprobed-db # give modprobed-db a try: https://aur.archlinux.org/packages/modprobed-db
# This PKGBUILD reads the database kept if it exists #
#
# More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db # More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db
# Set to anything but null to activate.
: "${_localmodcfg:=""}" : "${_localmodcfg:=""}"
# Optionally select a sub architecture by number or leave blank which will # Optionally select a sub architecture by number or
# require user interaction during the build. Note that the generic (default) # leave blank, which will require user interaction during the build.
# option is 40. # Note that the default option is 40.
# #
# 1. AMD Opteron/Athlon64/Hammer/K8 (MK8) # 1. AMD Opteron/Athlon64/Hammer/K8 (MK8)
# 2. AMD Opteron/Athlon64/Hammer/K8 with SSE3 (MK8SSE3) # 2. AMD Opteron/Athlon64/Hammer/K8 with SSE3 (MK8SSE3)
@ -68,115 +99,108 @@
# 45. AMD-Native optimizations autodetected by the compiler (MNATIVE_AMD) # 45. AMD-Native optimizations autodetected by the compiler (MNATIVE_AMD)
: "${_subarch:=""}" : "${_subarch:=""}"
# Use the current kernel's .config file # Enable compilation with LLVM
# Enabling this option will use the .config of the RUNNING kernel rather than # Be warned, this is largely untested by me (JeremyStarTM). It *should* work,
# the ARCH defaults. Useful when the package gets updated and you already went # but if it doesn't, write a comment and I'll fix it.
# through the trouble of customizing your config options. NOT recommended when #
# a new kernel is released, but again, convenient for package bumps. # Set to anything but null to activate.
: "${_use_current:=""}"
# Enable compiling with LLVM
: "${_use_llvm_lto:=""}" : "${_use_llvm_lto:=""}"
# Enable/Disable debug options # Debug options
# Set 'y' to enable, 'n' to force disable debug options if already enabled in your # This allows you to enable or disable debug options.
# .config file or leave empty to ignore debug options. # Set to 'y' to force enable, 'n' to force disable or '' to ignore debug options.
# Leaving the setting empty will use the kernel configuration setting to determine
# if debug options shall be enabled/disabled.
#
# Set to anything but null to activate.
: "${_debug:=""}" : "${_debug:=""}"
### IMPORTANT: Do no edit below this line unless you know what you're doing ### BUILD OPTIONS END
_major=6.9 # Kernel version
_minor=8 _kernel_major=6.10
_srcname=linux-${_major} _kernel_minor=2
_clr=${_major}.7-1445 # Clear Linux patches version
_gcc_more_v='20240221.2' _clr=2-1454
# kernel_compiler_patch version
_kernelcompilerpatch="20240221.2"
# Source directory names
_src_linux=linux-${_kernel_major}
_src_clr=${_kernel_major}.${_clr}
# Package information
pkgbase=linux-clear pkgbase=linux-clear
pkgver=${_major}.${_minor} pkgver=${_kernel_major}.${_kernel_minor}+clr${_src_clr//-/_}
pkgrel=1 pkgrel=1
pkgdesc='Clear Linux' pkgdesc="Linux kernel with patches from Clear Linux to allow for higher performance."
arch=('x86_64') arch=("x86_64")
url="https://github.com/clearlinux-pkgs/linux" url="https://github.com/clearlinux-pkgs/linux"
license=(GPL-2.0-only) license=(GPL-2.0-only)
makedepends=(bc cpio gettext git libelf pahole perl python tar xz zstd) makedepends=("bc" "cpio" "gettext" "git" "libelf" "pahole" "perl" "python" "tar" "xz" "zstd")
if [ -n "$_use_llvm_lto" ]; then [[ -n "${_use_llvm_to}" ]] && makedepends+=("clang" "llvm" "lld")
makedepends+=(clang llvm lld) options=("!strip" "!debug")
fi [[ "${_debug}" == "y" ]] && options=("!strip")
options=(!debug !strip)
if [ "$_debug" == "y" ]; then
options=(!strip)
fi
source=( source=(
"https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_major}.tar.xz" "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_kernel_major}.tar.xz"
"https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_major}.tar.sign" "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_kernel_major}.tar.sign"
"https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-${pkgver}.xz" "https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-${_kernel_major}.${_kernel_minor}.xz"
"$pkgbase::git+https://github.com/clearlinux-pkgs/linux.git#tag=${_clr}" "cl-linux::git+https://github.com/clearlinux-pkgs/linux.git#tag=${_src_clr}"
"more-uarches-$_gcc_more_v.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/$_gcc_more_v.tar.gz" "more-uarches-${_kernelcompilerpatch}.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/${_kernelcompilerpatch}.tar.gz"
) )
if [ -n "$_use_llvm_lto" ]; then [[ -n "${_use_llvm_lto}" ]] && BUILD_FLAGS=("LLVM=1" "LLVM_IAS=1")
BUILD_FLAGS=(
LLVM=1
LLVM_IAS=1
)
fi
export KBUILD_BUILD_HOST=archlinux export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase export KBUILD_BUILD_USER=${pkgbase}
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() { prepare() {
cd ${_srcname} cd "${_src_linux}" || exit 1
### Add upstream patches # Patch with kernel version patches
echo "Add upstream patches" patch -Np1 -i ../patch-${_kernel_major}.${_kernel_minor} || true
patch -Np1 -i ../patch-${pkgver}
# Set version
### Setting version echo "-${pkgrel}" > localversion.10-pkgrel
echo "Setting version..."
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname echo "${pkgbase#linux}" > localversion.20-pkgname
### Add Clearlinux patches # Patch with Clear Linux patches
for i in $(grep '^Patch' ${srcdir}/$pkgbase/linux.spec |\ for i in $(grep '^Patch' "${srcdir}"/cl-linux/linux.spec|grep -Ev '^Patch0132|^Patch0109|^Patch0118|^Patch0113|^Patch0138|^Patch0139|^Patch0147' | sed -n 's/.*: //p'); do
grep -Ev '^Patch0132|^Patch0109|^Patch0118|^Patch0113|^Patch0138|^Patch0139|^Patch0147' | sed -n 's/.*: //p'); do if [ -n "${_use_llvm_lto}" ]; then
if [ -n "$_use_llvm_lto" ]; then
if [ "${i}" == "0133-novector.patch" ] ; then if [ "${i}" == "0133-novector.patch" ] ; then
continue continue
fi fi
fi fi
echo "Applying patch ${i}..."
patch -Np1 -i "$srcdir/$pkgbase/${i}" patch -Np1 -i "${srcdir}/cl-linux/${i}" || true
done done
### Setting config # Copy configuration file (if found)
echo "Setting config..." if [ -f "${startdir}/kconfig" ]; then
cp -Tf $srcdir/$pkgbase/config ./.config echo ":: Using configuration file \"${startdir}/kconfig\""
cp -Tf "${startdir}/kconfig" ./.config
### Enable extra options else
echo "Enable extra options..." echo ":: Using configuration file \"${srcdir}/${pkgbase}/config\""
cp -Tf $srcdir/cl-linux/config ./.config
fi
# Extra configuration
# General setup # General setup
scripts/config --set-str DEFAULT_HOSTNAME archlinux \ scripts/config --set-str DEFAULT_HOSTNAME archlinux \
-e IKCONFIG \ -e IKCONFIG \
-e IKCONFIG_PROC \ -e IKCONFIG_PROC \
-u RT_GROUP_SCHED -u RT_GROUP_SCHED
# Power management and ACPI options # Power management and ACPI options
scripts/config -e ACPI_REV_OVERRIDE_POSSIBLE \ scripts/config -e ACPI_REV_OVERRIDE_POSSIBLE \
-e ACPI_TABLE_UPGRADE -e ACPI_TABLE_UPGRADE
# Virtualization # Virtualization
scripts/config -e KVM_SMM scripts/config -e KVM_SMM
# General architecture-dependent options # General architecture-dependent options
scripts/config -e KPROBES scripts/config -e KPROBES
# Enable loadable module support # Enable loadable module support
scripts/config -u MODULE_SIG_FORCE scripts/config -u MODULE_SIG_FORCE
# Networking support # Networking support
scripts/config -e NETFILTER_INGRESS scripts/config -e NETFILTER_INGRESS
# Device Drivers # Device Drivers
scripts/config -e FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER \ scripts/config -e FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER \
-e DELL_SMBIOS_SMM \ -e DELL_SMBIOS_SMM \
@ -187,20 +211,16 @@ prepare() {
-M SND_MIXER_OSS SND_PCM_OSS \ -M SND_MIXER_OSS SND_PCM_OSS \
-E SND_PCM_OSS SND_PCM_OSS_PLUGINS \ -E SND_PCM_OSS SND_PCM_OSS_PLUGINS \
-m AGP -M AGP AGP_INTEL -M AGP_INTEL AGP_VIA -m AGP -M AGP AGP_INTEL -M AGP_INTEL AGP_VIA
# Kernel hacking -> Compile-time checks and compiler options -> Make section mismatch errors non-fatal # Kernel hacking -> Compile-time checks and compiler options -> Make section mismatch errors non-fatal
scripts/config -e SECTION_MISMATCH_WARN_ONLY scripts/config -e SECTION_MISMATCH_WARN_ONLY
# File systems # File systems
scripts/config -m NTFS3_FS \ scripts/config -m NTFS3_FS \
-e NTFS3_LZX_XPRESS \ -e NTFS3_LZX_XPRESS \
-e NTFS3_FS_POSIX_ACL -e NTFS3_FS_POSIX_ACL
scripts/config -m SMB_SERVER \ scripts/config -m SMB_SERVER \
-e SMB_SERVER_SMBDIRECT \ -e SMB_SERVER_SMBDIRECT \
-e SMB_SERVER_CHECK_CAP_NET_ADMIN \ -e SMB_SERVER_CHECK_CAP_NET_ADMIN \
-e SMB_SERVER_KERBEROS5 -e SMB_SERVER_KERBEROS5
# Security options # Security options
scripts/config -e SECURITY_SELINUX \ scripts/config -e SECURITY_SELINUX \
-e SECURITY_SELINUX_BOOTPARAM \ -e SECURITY_SELINUX_BOOTPARAM \
@ -211,185 +231,170 @@ prepare() {
-e SECURITY_TOMOYO \ -e SECURITY_TOMOYO \
-e SECURITY_APPARMOR \ -e SECURITY_APPARMOR \
-e SECURITY_YAMA -e SECURITY_YAMA
# Library routines # Library routines
scripts/config -k -e FONT_TER16x32 scripts/config -k -e FONT_TER16x32
if [ -n "$_use_llvm_lto" ]; then # Enable LLVM compilation
scripts/config -d LTO_NONE \ [[ -n "${_use_llvm_lto}" ]] && scripts/config -d LTO_NONE \
-e LTO \ -e LTO \
-e LTO_CLANG \ -e LTO_CLANG \
-e ARCH_SUPPORTS_LTO_CLANG \ -e ARCH_SUPPORTS_LTO_CLANG \
-e ARCH_SUPPORTS_LTO_CLANG_THIN \ -e ARCH_SUPPORTS_LTO_CLANG_THIN \
-e HAS_LTO_CLANG \ -e HAS_LTO_CLANG \
-e LTO_CLANG_THIN \ -e LTO_CLANG_THIN \
-e HAVE_GCC_PLUGINS -e HAVE_GCC_PLUGINS
fi
# Enable or disable debug settings
if [ "$_debug" == "y" ]; then [[ "${_debug}" == "y" ]] && scripts/config -e DEBUG_INFO \
scripts/config -e DEBUG_INFO \ -e DEBUG_INFO_BTF \
-e DEBUG_INFO_BTF \ -e DEBUG_INFO_DWARF4 \
-e DEBUG_INFO_DWARF4 \ -e PAHOLE_HAS_SPLIT_BTF \
-e PAHOLE_HAS_SPLIT_BTF \ -e DEBUG_INFO_BTF_MODULES
-e DEBUG_INFO_BTF_MODULES [[ "${_debug}" == "n" ]] && scripts/config -d DEBUG_INFO \
elif [ "$_debug" == "n" ]; then -d DEBUG_INFO_BTF \
scripts/config -d DEBUG_INFO \ -d DEBUG_INFO_DWARF4 \
-d DEBUG_INFO_BTF \ -d PAHOLE_HAS_SPLIT_BTF \
-d DEBUG_INFO_DWARF4 \ -d DEBUG_INFO_BTF_MODULES
-d PAHOLE_HAS_SPLIT_BTF \
-d DEBUG_INFO_BTF_MODULES # Run olddefconfig
fi
make ${BUILD_FLAGS[*]} olddefconfig make ${BUILD_FLAGS[*]} olddefconfig
diff -u $srcdir/$pkgbase/config .config || : diff -u $srcdir/cl-linux/config .config || :
# https://github.com/graysky2/kernel_compiler_patch # Patch with kernel_compiler_patch patches
# make sure to apply after olddefconfig to allow the next section # This must be executed after olddefconfig
echo "Patching to enable GCC optimization for other uarchs..." # to allow for the next section to run.
patch -Np1 -i "$srcdir/kernel_compiler_patch-$_gcc_more_v/more-uarches-for-kernel-6.8-rc4+.patch" patch -Np1 -i "$srcdir/kernel_compiler_patch-$_kernelcompilerpatch/more-uarches-for-kernel-6.8-rc4+.patch"
if [ -n "$_subarch" ]; then # Set subarch automatically
# user wants a subarch so apply choice defined above interactively via 'yes' [[ -n "${_subarch}" ]] && yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig
yes "$_subarch" | make ${BUILD_FLAGS[*]} oldconfig # Ask for subarch
else [[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig
# no subarch defined so allow user to pick one
make ${BUILD_FLAGS[*]} oldconfig # Optionally use the configuration of the running kernel
fi # Written originally by nous, see
# https://web.archive.org/web/20110711231356/https://aur.archlinux.org/packages.php?ID=40191 (package doesn't exist anymore)
### Optionally use running kernel's config [[ -n "${_use_current}" ]] &&
# code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
if [ -n "$_use_current" ]; then
if [[ -s /proc/config.gz ]]; then if [[ -s /proc/config.gz ]]; then
echo "Extracting config from /proc/config.gz..."
# modprobe configs # modprobe configs
zcat /proc/config.gz > ./.config zcat /proc/config.gz > ./.config
else else
warning "Your kernel was not compiled with IKCONFIG_PROC!" warning "Your kernel was not compiled with IKCONFIG_PROC."
warning "You cannot read the current config!" warning "Unable to read kernel configuration, aborting."
warning "Aborting!"
exit exit
fi fi
fi
# Read and apply modprobed database
### Optionally load needed modules for the make localmodconfig
# See https://aur.archlinux.org/packages/modprobed-db # See https://aur.archlinux.org/packages/modprobed-db
if [ -n "$_localmodcfg" ]; then [[ -n "${_localmodcfg}" ]] &&
if [ -e $HOME/.config/modprobed.db ]; then if [ -e "${HOME}/.config/modprobed.db" ]; then
echo "Running Steven Rostedt's make localmodconfig now" make ${BUILD_FLAGS[*]} LSMOD=${HOME}/.config/modprobed.db localmodconfig
make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
else else
echo "No modprobed.db data found" echo ":: No modprobed.db file was found at ${HOME}/.config, skipping"
exit
fi fi
fi
# Write kernel version
make -s kernelrelease > version make -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
# Open configuration editors
[[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig
[[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig
[[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig
[[ -z "$_makenconfig" ]] || make ${BUILD_FLAGS[*]} nconfig # Save configuration
[[ -n "${_copyfinalconfig}" ]] && cp -Tf ./.config "${startdir}/kconfig-new" || true
### Save configuration for later reuse
cp -Tf ./.config "${startdir}/config-${pkgver}-${pkgrel}${pkgbase#linux}"
} }
build() { build() {
cd ${_srcname} cd "${_src_linux}" || exit 1
make ${BUILD_FLAGS[*]} all make ${BUILD_FLAGS[*]} all
} }
_package() { _package() {
pkgdesc="The $pkgdesc kernel and modules" pkgdesc="${pkgdesc} This package includes the kernel and compiled modules."
depends=('coreutils' 'kmod' 'initramfs') depends=("coreutils" "kmod" "initramfs")
optdepends=('wireless-regdb: to set the correct wireless channels of your country' optdepends=("wireless-regdb: to set the correct wireless channels of your country"
'linux-firmware: firmware images needed for some devices' "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 KSMBD-MODULE) provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE)
install=linux.install install=linux.install
cd $_srcname cd "${_src_linux}" || exit 1
local modulesdir="${pkgdir}/usr/lib/modules/$(<version)"
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
# Create boot image
echo "Installing boot image..." # systemd expects to find the kernel there to allow hibernation
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344 # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz" install -Dm644 "$(make -s image_name)" "${modulesdir}/vmlinuz"
# Used by mkinitcpio to name the kernel # Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase" echo "${pkgbase}" | install -Dm644 /dev/stdin "${modulesdir}/pkgbase"
echo "Installing modules..." # Install modules
ZSTD_CLEVEL=19 make ${BUILD_FLAGS[*]} INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \ ZSTD_CLEVEL=19 make ${BUILD_FLAGS[*]} INSTALL_MOD_PATH="${pkgdir}/usr" INSTALL_MOD_STRIP=1 \
DEPMOD=/doesnt/exist modules_install # Suppress depmod DEPMOD=/doesnt/exist modules_install # Suppress depmod
# remove build link # Remove build directory
rm "$modulesdir"/build rm "${modulesdir}"/build
} }
_package-headers() { _package-headers() {
pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel" pkgdesc="${pkgdesc} This package includes header files and scripts for building kernel modules."
depends=(pahole) depends=("pahole")
cd ${_srcname} cd "${_src_linux}" || exit 1
local builddir="$pkgdir/usr/lib/modules/$(<version)/build" local builddir="${pkgdir}/usr/lib/modules/$(<version)/build"
echo "Installing build files..." install -Dt "${builddir}" -m644 .config Makefile Module.symvers System.map \
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
localversion.* version vmlinux localversion.* version vmlinux
install -Dt "$builddir/kernel" -m644 kernel/Makefile install -Dt "${builddir}/kernel" -m644 kernel/Makefile
install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile install -Dt "${builddir}/arch/x86" -m644 arch/x86/Makefile
cp -t "$builddir" -a scripts cp -t "${builddir}" -a scripts
# required when STACK_VALIDATION is enabled # Required when STACK_VALIDATION is enabled
install -Dt "$builddir/tools/objtool" tools/objtool/objtool install -Dt "${builddir}/tools/objtool" tools/objtool/objtool
# required when DEBUG_INFO_BTF_MODULES is enabled # Required when DEBUG_INFO_BTF_MODULES is enabled
if [ -f tools/bpf/resolve_btfids/resolve_btfids ]; then [[ -f tools/bpf/resolve_btfids/resolve_btfids ]] && install -Dt "${builddir}/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
fi cp -t "${builddir}" -a include
cp -t "${builddir}/arch/x86" -a arch/x86/include
echo "Installing headers..." 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}/drivers/md" -m644 drivers/md/*.h
install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s 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 # https://bugs.archlinux.org/task/13146
install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h install -Dt "${builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# https://bugs.archlinux.org/task/20402 # 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/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/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h install -Dt "${builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h
# https://bugs.archlinux.org/task/71392 # https://bugs.archlinux.org/task/71392
install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h 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}/{}" \;
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
# Remove redundant architectures
echo "Removing unneeded architectures..."
local arch local arch
for arch in "$builddir"/arch/*/; do for arch in "${builddir}"/arch/*/; do
[[ $arch = */x86/ ]] && continue [[ $arch = */x86/ ]] && continue
echo "Removing $(basename "$arch")" echo "Removing $(basename "${arch}")"
rm -r "$arch" rm -r "${arch}"
done done
echo "Removing documentation..." # Remove documentation
rm -r "$builddir/Documentation" rm -r "${builddir}/Documentation"
echo "Removing broken symlinks..." # Remove broken symlinks
find -L "$builddir" -type l -printf 'Removing %P\n' -delete find -L "${builddir}" -type l -printf "Removing %P\n" -delete
echo "Removing loose objects..." # Remove loose objects
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete find "${builddir}" -type f -name '*.o' -printf "Removing %P\n" -delete
echo "Stripping build tools..." # Strip build tools
local file local file
while read -rd '' file; do while read -rd "" file; do
case "$(file -Sib "$file")" in case "$(file -Sib "$file")" in
application/x-sharedlib\;*) # Libraries (.so) application/x-sharedlib\;*) # Libraries (.so)
strip -v $STRIP_SHARED "$file" ;; strip -v $STRIP_SHARED "$file" ;;
@ -400,14 +405,14 @@ _package-headers() {
application/x-pie-executable\;*) # Relocatable binaries application/x-pie-executable\;*) # Relocatable binaries
strip -v $STRIP_SHARED "$file" ;; strip -v $STRIP_SHARED "$file" ;;
esac esac
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0) done < <(find "${builddir}" -type f -perm -u+x ! -name vmlinux -print0)
echo "Stripping vmlinux..." # Strip vmlinux
strip -v $STRIP_STATIC "$builddir/vmlinux" strip -v $STRIP_STATIC "${builddir}/vmlinux"
echo "Adding symlink..." # Add symlink to build directory
mkdir -p "$pkgdir/usr/src" mkdir -p "$pkgdir/usr/src"
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase" ln -sr "${builddir}" "$pkgdir/usr/src/$pkgbase"
} }
pkgname=("$pkgbase" "$pkgbase-headers") pkgname=("$pkgbase" "$pkgbase-headers")
@ -417,14 +422,12 @@ for _p in "${pkgname[@]}"; do
_package${_p#$pkgbase} _package${_p#$pkgbase}
}" }"
done done
sha256sums=('24fa01fb989c7a3e28453f117799168713766e119c5381dac30115f18f268149'
'SKIP'
'cf7dbb88fa35557195f8cde7fd05ec873db95af91cbcae7472a13d9bc9c5cbaa'
'SKIP'
'1d3ac3e581cbc5108f882fcdc75d74f7f069654c71bad65febe5ba15a7a3a14f')
validpgpkeys=( validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds "ABAF11C65A2970B130ABE3C479BE3E4300411886" # Linus Torvalds
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman "647F28654894E3BD457199BE38DBBDC86092693E" # Greg Kroah-Hartman
) )
sha256sums=("774698422ee54c5f1e704456f37c65c06b51b4e9a8b0866f34580d86fef8e226"
"SKIP"
"f3166b9b9f6a7dbae9ed7e92e373c8ddb672c5bd2da3991207aa30f52ceda7fa"
"SKIP"
"1d3ac3e581cbc5108f882fcdc75d74f7f069654c71bad65febe5ba15a7a3a14f")

View file

@ -1,19 +1,20 @@
#!/bin/bash #!/bin/bash
_5_2_2_2_changes() { _5_2_2_2_changes() {
echo ':: Kernel command line update: add page_alloc.shuffle=1' echo ":: A new command line option was added: add page_alloc.shuffle=1"
} }
_5_2_9_6_changes() { _5_2_9_6_changes() {
echo ':: Microcode is no longer builtin. https://wiki.archlinux.org/index.php/Microcode' echo ":: Microcode is no longer builtin. See https://wiki.archlinux.org/index.php/Microcode"
} }
post_install() { post_install() {
echo ":: Adjust kernel command line in your bootloader to Clear Linux kernel default:" echo ":: Clear Linux bundles a custom command line which must be applied manually on other distributions."
echo " This is their default command line:"
echo " quiet console=tty0 console=ttyS0,115200n8 cryptomgr.notests initcall_debug" echo " quiet console=tty0 console=ttyS0,115200n8 cryptomgr.notests initcall_debug"
echo " intel_iommu=igfx_off kvm-intel.nested=1 no_timer_check noreplace-smp" echo " intel_iommu=igfx_off kvm-intel.nested=1 no_timer_check noreplace-smp"
echo " page_alloc.shuffle=1 rcupdate.rcu_expedited=1" echo " page_alloc.shuffle=1 rcupdate.rcu_expedited=1"
echo " rootfstype=ext4,btrfs,xfs,f2fs tsc=reliable rw " echo " rootfstype=ext4,btrfs,xfs,f2fs tsc=reliable rw"
} }
post_upgrade() { post_upgrade() {
@ -23,7 +24,7 @@ post_upgrade() {
) )
for v in "${upgrades[@]}"; do for v in "${upgrades[@]}"; do
if [[ $(vercmp "$v" "$2") -eq 1 ]]; then if [[ $(vercmp "${v}" "$2") -eq 1 ]]; then
"_${v//[.-]/_}_changes" "_${v//[.-]/_}_changes"
fi fi
done done