From 660c2a18647f7413a1d6a6939862b5c3f2f31ed5 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 6 Aug 2024 21:07:57 +0200 Subject: [PATCH] 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 --- .SRCINFO | 23 ++- PKGBUILD | 489 +++++++++++++++++++++++++------------------------- linux.install | 11 +- 3 files changed, 263 insertions(+), 260 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index b3b1157..43a4258 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = linux-clear - pkgdesc = Clear Linux - pkgver = 6.9.8 + pkgdesc = Linux kernel with patches from Clear Linux to allow for higher performance. + pkgver = 6.10.2+clr6.10.2_1454 pkgrel = 1 url = https://github.com/clearlinux-pkgs/linux arch = x86_64 @@ -16,34 +16,33 @@ pkgbase = linux-clear makedepends = tar makedepends = xz makedepends = zstd - options = !debug options = !strip - source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.9.tar.xz - 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/patch-6.9.8.xz - source = linux-clear::git+https://github.com/clearlinux-pkgs/linux.git#tag=6.9.7-1445 + options = !debug + 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/linux-6.10.tar.sign + 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 validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E - sha256sums = 24fa01fb989c7a3e28453f117799168713766e119c5381dac30115f18f268149 + sha256sums = 774698422ee54c5f1e704456f37c65c06b51b4e9a8b0866f34580d86fef8e226 sha256sums = SKIP - sha256sums = cf7dbb88fa35557195f8cde7fd05ec873db95af91cbcae7472a13d9bc9c5cbaa + sha256sums = f3166b9b9f6a7dbae9ed7e92e373c8ddb672c5bd2da3991207aa30f52ceda7fa sha256sums = SKIP sha256sums = 1d3ac3e581cbc5108f882fcdc75d74f7f069654c71bad65febe5ba15a7a3a14f 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 depends = coreutils depends = kmod depends = initramfs optdepends = wireless-regdb: to set the correct wireless channels of your country 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 = WIREGUARD-MODULE provides = KSMBD-MODULE 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 diff --git a/PKGBUILD b/PKGBUILD index 9383a36..4632f26 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,25 +1,56 @@ +# Maintainer: JeremyStarTM # Maintainer: Josip Ponjavic -# Contributor: ### BUILD OPTIONS -# Set the next two variables to ANYTHING that is not null to enable them +# You can modify these settings by executing "env _= 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:=""}" -# Only compile active modules to VASTLY reduce the number of modules built and -# the build time. +# Tweak kernel options prior to a build via xconfig. +# +# 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, -# give module_db a try: https://aur.archlinux.org/packages/modprobed-db -# This PKGBUILD reads the database kept if it exists -# +# give modprobed-db a try: https://aur.archlinux.org/packages/modprobed-db +# # More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db +# Set to anything but null to activate. : "${_localmodcfg:=""}" -# Optionally select a sub architecture by number or leave blank which will -# require user interaction during the build. Note that the generic (default) -# option is 40. +# Optionally select a sub architecture by number or +# leave blank, which will require user interaction during the build. +# Note that the default option is 40. # # 1. AMD Opteron/Athlon64/Hammer/K8 (MK8) # 2. AMD Opteron/Athlon64/Hammer/K8 with SSE3 (MK8SSE3) @@ -68,115 +99,108 @@ # 45. AMD-Native optimizations autodetected by the compiler (MNATIVE_AMD) : "${_subarch:=""}" -# 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:=""}" - -# Enable compiling with LLVM +# Enable compilation with LLVM +# Be warned, this is largely untested by me (JeremyStarTM). It *should* work, +# but if it doesn't, write a comment and I'll fix it. +# +# Set to anything but null to activate. : "${_use_llvm_lto:=""}" -# Enable/Disable debug options -# Set 'y' to enable, 'n' to force disable debug options if already enabled in your -# .config file or leave empty to ignore debug options. +# Debug options +# This allows you to enable or disable 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:=""}" -### IMPORTANT: Do no edit below this line unless you know what you're doing +### BUILD OPTIONS END -_major=6.9 -_minor=8 -_srcname=linux-${_major} -_clr=${_major}.7-1445 -_gcc_more_v='20240221.2' +# Kernel version +_kernel_major=6.10 +_kernel_minor=2 +# Clear Linux patches version +_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 -pkgver=${_major}.${_minor} +pkgver=${_kernel_major}.${_kernel_minor}+clr${_src_clr//-/_} pkgrel=1 -pkgdesc='Clear Linux' -arch=('x86_64') +pkgdesc="Linux kernel with patches from Clear Linux to allow for higher performance." +arch=("x86_64") url="https://github.com/clearlinux-pkgs/linux" license=(GPL-2.0-only) -makedepends=(bc cpio gettext git libelf pahole perl python tar xz zstd) -if [ -n "$_use_llvm_lto" ]; then - makedepends+=(clang llvm lld) -fi -options=(!debug !strip) -if [ "$_debug" == "y" ]; then - options=(!strip) -fi +makedepends=("bc" "cpio" "gettext" "git" "libelf" "pahole" "perl" "python" "tar" "xz" "zstd") +[[ -n "${_use_llvm_to}" ]] && makedepends+=("clang" "llvm" "lld") +options=("!strip" "!debug") +[[ "${_debug}" == "y" ]] && options=("!strip") source=( - "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_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/patch-${pkgver}.xz" - "$pkgbase::git+https://github.com/clearlinux-pkgs/linux.git#tag=${_clr}" - "more-uarches-$_gcc_more_v.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/$_gcc_more_v.tar.gz" + "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_kernel_major}.tar.xz" + "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_kernel_major}.tar.sign" + "https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-${_kernel_major}.${_kernel_minor}.xz" + "cl-linux::git+https://github.com/clearlinux-pkgs/linux.git#tag=${_src_clr}" + "more-uarches-${_kernelcompilerpatch}.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/${_kernelcompilerpatch}.tar.gz" ) -if [ -n "$_use_llvm_lto" ]; then - BUILD_FLAGS=( - LLVM=1 - LLVM_IAS=1 - ) -fi +[[ -n "${_use_llvm_lto}" ]] && BUILD_FLAGS=("LLVM=1" "LLVM_IAS=1") 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})" prepare() { - cd ${_srcname} - - ### Add upstream patches - echo "Add upstream patches" - patch -Np1 -i ../patch-${pkgver} - - ### Setting version - echo "Setting version..." - echo "-$pkgrel" > localversion.10-pkgrel + cd "${_src_linux}" || exit 1 + + # Patch with kernel version patches + patch -Np1 -i ../patch-${_kernel_major}.${_kernel_minor} || true + + # Set version + echo "-${pkgrel}" > localversion.10-pkgrel echo "${pkgbase#linux}" > localversion.20-pkgname - - ### Add Clearlinux patches - for i in $(grep '^Patch' ${srcdir}/$pkgbase/linux.spec |\ - grep -Ev '^Patch0132|^Patch0109|^Patch0118|^Patch0113|^Patch0138|^Patch0139|^Patch0147' | sed -n 's/.*: //p'); do - if [ -n "$_use_llvm_lto" ]; then + + # Patch with Clear Linux patches + for i in $(grep '^Patch' "${srcdir}"/cl-linux/linux.spec|grep -Ev '^Patch0132|^Patch0109|^Patch0118|^Patch0113|^Patch0138|^Patch0139|^Patch0147' | sed -n 's/.*: //p'); do + if [ -n "${_use_llvm_lto}" ]; then if [ "${i}" == "0133-novector.patch" ] ; then continue fi fi - echo "Applying patch ${i}..." - patch -Np1 -i "$srcdir/$pkgbase/${i}" + + patch -Np1 -i "${srcdir}/cl-linux/${i}" || true done - - ### Setting config - echo "Setting config..." - cp -Tf $srcdir/$pkgbase/config ./.config - - ### Enable extra options - echo "Enable extra options..." - + + # Copy configuration file (if found) + if [ -f "${startdir}/kconfig" ]; then + echo ":: Using configuration file \"${startdir}/kconfig\"" + cp -Tf "${startdir}/kconfig" ./.config + else + echo ":: Using configuration file \"${srcdir}/${pkgbase}/config\"" + cp -Tf $srcdir/cl-linux/config ./.config + fi + + # Extra configuration # General setup scripts/config --set-str DEFAULT_HOSTNAME archlinux \ -e IKCONFIG \ -e IKCONFIG_PROC \ -u RT_GROUP_SCHED - # Power management and ACPI options scripts/config -e ACPI_REV_OVERRIDE_POSSIBLE \ -e ACPI_TABLE_UPGRADE - # Virtualization scripts/config -e KVM_SMM - # General architecture-dependent options scripts/config -e KPROBES - # Enable loadable module support scripts/config -u MODULE_SIG_FORCE - # Networking support scripts/config -e NETFILTER_INGRESS - # Device Drivers scripts/config -e FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER \ -e DELL_SMBIOS_SMM \ @@ -187,20 +211,16 @@ prepare() { -M SND_MIXER_OSS SND_PCM_OSS \ -E SND_PCM_OSS SND_PCM_OSS_PLUGINS \ -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 scripts/config -e SECTION_MISMATCH_WARN_ONLY - # File systems scripts/config -m NTFS3_FS \ -e NTFS3_LZX_XPRESS \ -e NTFS3_FS_POSIX_ACL - scripts/config -m SMB_SERVER \ -e SMB_SERVER_SMBDIRECT \ -e SMB_SERVER_CHECK_CAP_NET_ADMIN \ -e SMB_SERVER_KERBEROS5 - # Security options scripts/config -e SECURITY_SELINUX \ -e SECURITY_SELINUX_BOOTPARAM \ @@ -211,185 +231,170 @@ prepare() { -e SECURITY_TOMOYO \ -e SECURITY_APPARMOR \ -e SECURITY_YAMA - # Library routines scripts/config -k -e FONT_TER16x32 - - if [ -n "$_use_llvm_lto" ]; then - scripts/config -d LTO_NONE \ - -e LTO \ - -e LTO_CLANG \ - -e ARCH_SUPPORTS_LTO_CLANG \ - -e ARCH_SUPPORTS_LTO_CLANG_THIN \ - -e HAS_LTO_CLANG \ - -e LTO_CLANG_THIN \ - -e HAVE_GCC_PLUGINS - fi - - if [ "$_debug" == "y" ]; then - scripts/config -e DEBUG_INFO \ - -e DEBUG_INFO_BTF \ - -e DEBUG_INFO_DWARF4 \ - -e PAHOLE_HAS_SPLIT_BTF \ - -e DEBUG_INFO_BTF_MODULES - elif [ "$_debug" == "n" ]; then - scripts/config -d DEBUG_INFO \ - -d DEBUG_INFO_BTF \ - -d DEBUG_INFO_DWARF4 \ - -d PAHOLE_HAS_SPLIT_BTF \ - -d DEBUG_INFO_BTF_MODULES - fi - + + # Enable LLVM compilation + [[ -n "${_use_llvm_lto}" ]] && scripts/config -d LTO_NONE \ + -e LTO \ + -e LTO_CLANG \ + -e ARCH_SUPPORTS_LTO_CLANG \ + -e ARCH_SUPPORTS_LTO_CLANG_THIN \ + -e HAS_LTO_CLANG \ + -e LTO_CLANG_THIN \ + -e HAVE_GCC_PLUGINS + + # Enable or disable debug settings + [[ "${_debug}" == "y" ]] && scripts/config -e DEBUG_INFO \ + -e DEBUG_INFO_BTF \ + -e DEBUG_INFO_DWARF4 \ + -e PAHOLE_HAS_SPLIT_BTF \ + -e DEBUG_INFO_BTF_MODULES + [[ "${_debug}" == "n" ]] && scripts/config -d DEBUG_INFO \ + -d DEBUG_INFO_BTF \ + -d DEBUG_INFO_DWARF4 \ + -d PAHOLE_HAS_SPLIT_BTF \ + -d DEBUG_INFO_BTF_MODULES + + # Run olddefconfig make ${BUILD_FLAGS[*]} olddefconfig - diff -u $srcdir/$pkgbase/config .config || : - - # https://github.com/graysky2/kernel_compiler_patch - # make sure to apply after olddefconfig to allow the next section - echo "Patching to enable GCC optimization for other uarchs..." - patch -Np1 -i "$srcdir/kernel_compiler_patch-$_gcc_more_v/more-uarches-for-kernel-6.8-rc4+.patch" - - if [ -n "$_subarch" ]; then - # user wants a subarch so apply choice defined above interactively via 'yes' - yes "$_subarch" | make ${BUILD_FLAGS[*]} oldconfig - else - # no subarch defined so allow user to pick one - make ${BUILD_FLAGS[*]} oldconfig - fi - - ### Optionally use running kernel's config - # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191 - if [ -n "$_use_current" ]; then + diff -u $srcdir/cl-linux/config .config || : + + # Patch with kernel_compiler_patch patches + # This must be executed after olddefconfig + # to allow for the next section to run. + patch -Np1 -i "$srcdir/kernel_compiler_patch-$_kernelcompilerpatch/more-uarches-for-kernel-6.8-rc4+.patch" + + # Set subarch automatically + [[ -n "${_subarch}" ]] && yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig + # Ask for subarch + [[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig + + # Optionally use the configuration of the running kernel + # Written originally by nous, see + # https://web.archive.org/web/20110711231356/https://aur.archlinux.org/packages.php?ID=40191 (package doesn't exist anymore) + [[ -n "${_use_current}" ]] && 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!" + warning "Your kernel was not compiled with IKCONFIG_PROC." + warning "Unable to read kernel configuration, aborting." exit fi - fi - - ### Optionally load needed modules for the make localmodconfig + + # Read and apply modprobed database # See https://aur.archlinux.org/packages/modprobed-db - if [ -n "$_localmodcfg" ]; 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 + [[ -n "${_localmodcfg}" ]] && + if [ -e "${HOME}/.config/modprobed.db" ]; then + make ${BUILD_FLAGS[*]} LSMOD=${HOME}/.config/modprobed.db localmodconfig else - echo "No modprobed.db data found" - exit + echo ":: No modprobed.db file was found at ${HOME}/.config, skipping" fi - fi - + + # Write kernel version make -s kernelrelease > version - echo "Prepared $pkgbase version $(