diff options
-rw-r--r-- | .SRCINFO | 52 | ||||
-rw-r--r-- | 60-linux.hook | 12 | ||||
-rw-r--r-- | 90-linux.hook | 11 | ||||
-rw-r--r-- | 99-linux.hook | 9 | ||||
-rw-r--r-- | PKGBUILD | 508 | ||||
-rw-r--r-- | linux.install | 31 | ||||
-rw-r--r-- | linux.preset | 14 |
7 files changed, 344 insertions, 293 deletions
@@ -1,52 +1,44 @@ pkgbase = linux-clear - pkgver = 5.1.9 + pkgdesc = Clear Linux + pkgver = 6.8.7 pkgrel = 1 url = https://github.com/clearlinux-pkgs/linux arch = x86_64 - license = GPL2 + license = GPL-2.0-only makedepends = bc + makedepends = cpio makedepends = git - makedepends = inetutils - makedepends = kmod makedepends = libelf - makedepends = linux-firmware + makedepends = pahole makedepends = xmlto + options = !debug options = !strip - source = https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.1.tar.xz - source = https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.1.tar.sign - source = https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-5.1.9.xz - source = clearlinux::git+https://github.com/clearlinux-pkgs/linux.git#tag=5.1.8-780 - source = intel-ucode-20190514.tar.gz::https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/microcode-20190514.tar.gz - source = enable_additional_cpu_optimizations-20180509.tar.gz::https://github.com/graysky2/kernel_gcc_patch/archive/20180509.tar.gz - source = 60-linux.hook - source = 90-linux.hook - source = 99-linux.hook - source = linux.preset + source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.8.tar.xz + source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.8.tar.sign + source = https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-6.8.7.xz + source = linux-clear::git+https://github.com/clearlinux-pkgs/linux.git#tag=6.8.6-1426 + source = more-uarches-20240221.2.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/20240221.2.tar.gz validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E - sha256sums = d06a7be6e73f97d1350677ad3bae0ce7daecb79c2c2902aaabe806f7fa94f041 + sha256sums = c969dea4e8bb6be991bbf7c010ba0e0a5643a3a8d8fb0a2aaa053406f1e965f3 sha256sums = SKIP - sha256sums = 34aee04c1af73dbf2f57f953df8032c581a1210952c231c2f1d80d0165ab0e71 + sha256sums = 6ef359c3497d90b0a687d1dc2050d0c662f6a72224c8bf6122847002e145ce11 sha256sums = SKIP - sha256sums = 553858de4315d267d1f259d1146db028eec5112a797379a7a83f5c8a22e626b3 - sha256sums = 226e30068ea0fecdb22f337391385701996bfbdba37cdcf0f1dbf55f1080542d - sha256sums = ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21 - sha256sums = c043f3033bb781e2688794a59f6d1f7ed49ef9b13eb77ff9a425df33a244a636 - sha256sums = ed9d35cb7d7bd829ff6253353efa5e2d119820fe4f4310aea536671f5e4caa37 - sha256sums = ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65 + sha256sums = 1d3ac3e581cbc5108f882fcdc75d74f7f069654c71bad65febe5ba15a7a3a14f pkgname = linux-clear - pkgdesc = Clearlinux kernel and modules + pkgdesc = The Clear Linux kernel and modules install = linux.install depends = coreutils - depends = linux-firmware depends = kmod - depends = mkinitcpio>=0.7 - optdepends = crda: to set the correct wireless channels of your country + 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 - backup = etc/mkinitcpio.d/linux-clear.preset + provides = KSMBD-MODULE pkgname = linux-clear-headers - pkgdesc = Header files and scripts for building modules for linux-clear - + pkgdesc = Headers and scripts for building modules for the Clear Linux kernel + depends = pahole diff --git a/60-linux.hook b/60-linux.hook deleted file mode 100644 index b33873c854fb..000000000000 --- a/60-linux.hook +++ /dev/null @@ -1,12 +0,0 @@ -[Trigger] -Type = File -Operation = Install -Operation = Upgrade -Operation = Remove -Target = usr/lib/modules/%KERNVER%/* -Target = usr/lib/modules/%EXTRAMODULES%/* - -[Action] -Description = Updating %PKGBASE% module dependencies... -When = PostTransaction -Exec = /usr/bin/depmod %KERNVER% diff --git a/90-linux.hook b/90-linux.hook deleted file mode 100644 index fca45abe1a62..000000000000 --- a/90-linux.hook +++ /dev/null @@ -1,11 +0,0 @@ -[Trigger] -Type = File -Operation = Install -Operation = Upgrade -Target = usr/lib/modules/%KERNVER%/vmlinuz -Target = usr/lib/initcpio/* - -[Action] -Description = Updating %PKGBASE% initcpios... -When = PostTransaction -Exec = /usr/bin/mkinitcpio -p %PKGBASE% diff --git a/99-linux.hook b/99-linux.hook deleted file mode 100644 index 416cb9424d0d..000000000000 --- a/99-linux.hook +++ /dev/null @@ -1,9 +0,0 @@ -[Trigger] -Type = File -Operation = Remove -Target = boot/vmlinuz-%PKGBASE% - -[Action] -Description = Remove %PKGBASE% initramfs files... -When = PreTransaction -Exec = /usr/bin/rm -f /boot/initramfs-%PKGBASE%.img /boot/initramfs-%PKGBASE%-fallback.img @@ -2,16 +2,24 @@ # Contributor: ### BUILD OPTIONS -# Set these variables to ANYTHING that is not null to enable them +# Set the next two variables to ANYTHING that is not null to enable them # Tweak kernel options prior to a build via nconfig -_makenconfig= +: "${_makenconfig:=""}" -_enable_gcc_more_v="y" -# Optionally select a sub architecture by number if building in a clean chroot -# Leaving this entry blank will require user interaction during the build -# which will cause a failure to build if using makechrootpkg. Note that the -# generic (default) option is 26. +# 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 +# +# More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db +: "${_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. # # 1. AMD Opteron/Athlon64/Hammer/K8 (MK8) # 2. AMD Opteron/Athlon64/Hammer/K8 with SSE3 (MK8SSE3) @@ -24,250 +32,324 @@ _enable_gcc_more_v="y" # 9. AMD Steamroller (MSTEAMROLLER) # 10. AMD Excavator (MEXCAVATOR) # 11. AMD Zen (MZEN) -# 12. Intel P4 / older Netburst based Xeon (MPSC) -# 13. Intel Atom (MATOM) -# 14. Intel Core 2 (MCORE2) -# 15. Intel Nehalem (MNEHALEM) -# 16. Intel Westmere (MWESTMERE) -# 17. Intel Silvermont (MSILVERMONT) -# 18. Intel Sandy Bridge (MSANDYBRIDGE) -# 19. Intel Ivy Bridge (MIVYBRIDGE) -# 20. Intel Haswell (MHASWELL) -# 21. Intel Broadwell (MBROADWELL) -# 22. Intel Skylake (MSKYLAKE) -# 23. Intel Skylake X (MSKYLAKEX) -# 24. Intel Cannon Lake (MCANNONLAKE) -# 25. Intel Ice Lake (MICELAKE) -# 26. Generic-x86-64 (GENERIC_CPU) -# 27. Native optimizations autodetected by GCC (MNATIVE) -_subarch= - -# Compile ONLY probed modules -# Build in only the modules that you currently have probed in your system VASTLY -# reducing the number of modules built and the build time. -# -# WARNING - ALL modules must be probed BEFORE you begin making the pkg! -# -# 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 will call it directly to probe all the modules you have logged! -# -# More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db -_localmodcfg= - -# If you have laptop with optimus and it hangs on boot one solution might be -# to set acpi_rev_override. Yet for this to happen kernel should be compiled -# with `CONFIG_ACPI_REV_OVERRIDE_POSSIBLE`. Set next variable to `y` to enable. -_rev_override="n" +# 12. AMD Zen 2 (MZEN2) +# 13. AMD Zen 3 (MZEN3) +# 14. AMD Zen 4 (MZEN4) +# 15. Intel P4 / older Netburst based Xeon (MPSC) +# 16. Intel Core 2 (MCORE2) +# 17. Intel Atom (MATOM) +# 18. Intel Nehalem (MNEHALEM) +# 19. Intel Westmere (MWESTMERE) +# 20. Intel Silvermont (MSILVERMONT) +# 21. Intel Goldmont (MGOLDMONT) +# 22. Intel Goldmont Plus (MGOLDMONTPLUS) +# 23. Intel Sandy Bridge (MSANDYBRIDGE) +# 24. Intel Ivy Bridge (MIVYBRIDGE) +# 25. Intel Haswell (MHASWELL) +# 26. Intel Broadwell (MBROADWELL) +# 27. Intel Skylake (MSKYLAKE) +# 28. Intel Skylake X (MSKYLAKEX) +# 29. Intel Cannon Lake (MCANNONLAKE) +# 30. Intel Ice Lake (MICELAKE) +# 31. Intel Cascade Lake (MCASCADELAKE) +# 32. Intel Cooper Lake (MCOOPERLAKE) +# 33. Intel Tiger Lake (MTIGERLAKE) +# 34. Intel Sapphire Rapids (MSAPPHIRERAPIDS) +# 35. Intel Rocket Lake (MROCKETLAKE) +# 36. Intel Alder Lake (MALDERLAKE) +# 37. Intel Raptor Lake (MRAPTORLAKE) +# 38. Intel Meteor Lake (MMETEORLAKE) +# 39. Intel Emerald Rapids (MEMERALDRAPIDS) +# 40. Generic-x86-64 (GENERIC_CPU) +# 41. Generic-x86-64-v2 (GENERIC_CPU2) +# 42. Generic-x86-64-v3 (GENERIC_CPU3) +# 43. Generic-x86-64-v4 (GENERIC_CPU4) +# 44. Intel-Native optimizations autodetected by the compiler (MNATIVE_INTEL) +# 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 +: "${_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:=""}" ### IMPORTANT: Do no edit below this line unless you know what you're doing -_major=5.1 -_minor=9 +_major=6.8 +_minor=7 _srcname=linux-${_major} -_clr=${_major}.8-780 +_clr=${_major}.6-1426 +_gcc_more_v='20240221.2' pkgbase=linux-clear pkgver=${_major}.${_minor} pkgrel=1 +pkgdesc='Clear Linux' arch=('x86_64') url="https://github.com/clearlinux-pkgs/linux" -license=('GPL2') -makedepends=('bc' 'git' 'inetutils' 'kmod' 'libelf' 'linux-firmware' 'xmlto') -options=('!strip') -_ucode='20190514' -_gcc_more_v='20180509' +license=(GPL-2.0-only) +makedepends=('bc' 'cpio' 'git' 'libelf' 'pahole' 'xmlto') +if [ -n "$_use_llvm_lto" ]; then + makedepends+=(clang llvm lld python) +fi +options=(!debug !strip) +if [ "$_debug" == "y" ]; then + options=(!strip) +fi source=( - "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${_major}.tar.xz" - "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${_major}.tar.sign" - "https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-${pkgver}.xz" - "clearlinux::git+https://github.com/clearlinux-pkgs/linux.git#tag=${_clr}" - "intel-ucode-${_ucode}.tar.gz::https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/microcode-${_ucode}.tar.gz" - "enable_additional_cpu_optimizations-$_gcc_more_v.tar.gz::https://github.com/graysky2/kernel_gcc_patch/archive/$_gcc_more_v.tar.gz" - '60-linux.hook' # pacman hook for depmod - '90-linux.hook' # pacman hook for initramfs regeneration - '99-linux.hook' # pacman hook for remove initramfs - 'linux.preset' # standard config files for mkinitcpio ramdisk + "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" ) -_kernelname=${pkgbase#linux} -: ${_kernelname:=-clear} +if [ -n "$_use_llvm_lto" ]; then + BUILD_FLAGS=( + LLVM=1 + LLVM_IAS=1 + ) +fi + +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 upstream patches - msg2 "Add upstream patches" - patch -Np1 -i ../patch-${pkgver} + echo "Add upstream patches" + patch -Np1 -i ../patch-${pkgver} ### Setting version - msg2 "Setting version..." - scripts/setlocalversion --save-scmversion - echo "-$pkgrel" > localversion.10-pkgrel - echo "$_kernelname" > localversion.20-pkgname + echo "Setting version..." + echo "-$pkgrel" > localversion.10-pkgrel + echo "${pkgbase#linux}" > localversion.20-pkgname ### Add Clearlinux patches - for i in $(grep '^Patch' ${srcdir}/clearlinux/linux.spec | grep -Ev '^Patch0126' | sed -n 's/.*: //p'); do - msg2 "Applying patch ${i}..." - patch -Np1 -i "$srcdir/clearlinux/${i}" - done - - ### Setting config - msg2 "Setting config..." - cp -Tf $srcdir/clearlinux/config ./.config - - ### Compress modules - msg2 "Enabling XZ compressed modules..." - sed -i 's|^# CONFIG_MODULE_COMPRESS|\ -CONFIG_MODULE_COMPRESS=y\ -# CONFIG_MODULE_COMPRESS_GZIP is not set\ -CONFIG_MODULE_COMPRESS_XZ=y|' ./.config - - ### Set ACPI_REV_OVERRIDE_POSSIBLE to prevent optimus lockup - if [ "${_rev_override}" = "y" ]; then - msg2 "Enabling ACPI Rev Override Possible..." - sed -i "s|# CONFIG_ACPI_REV_OVERRIDE_POSSIBLE is not set|CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y|g" ./.config - fi - - make olddefconfig - - ### Copying i915 firmware and intel-ucode - msg2 "Copying i915 firmware and intel-ucode-${_ucode}..." - cp -a /usr/lib/firmware/i915 firmware/ - cp -a ${srcdir}/Intel-Linux-Processor-Microcode-Data-Files-microcode-${_ucode}/intel-ucode firmware/ - cp ${srcdir}/Intel-Linux-Processor-Microcode-Data-Files-microcode-${_ucode}/intel-ucode-with-caveats/06* firmware/intel-ucode/ - rm -f firmware/intel-ucode/0f* - - ### Patch source to unlock additional gcc CPU optimizations - # https://github.com/graysky2/kernel_gcc_patch - if [ "${_enable_gcc_more_v}" = "y" ]; then - msg2 "Enabling additional gcc CPU optimizations..." - patch -Np1 -i "$srcdir/kernel_gcc_patch-$_gcc_more_v/enable_additional_cpu_optimizations_for_gcc_v8.1+_kernel_v4.13+.patch" + 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 + if [ "${i}" == "0162-extra-optmization-flags.patch" ] ; then + continue + fi fi + echo "Applying patch ${i}..." + patch -Np1 -i "$srcdir/$pkgbase/${i}" + done - ### Get kernel version - if [ "${_enable_gcc_more_v}" = "y" ] || [ -n "${_subarch}" ]; then - yes "$_subarch" | make oldconfig + ### Setting config + echo "Setting config..." + cp -Tf $srcdir/$pkgbase/config ./.config + + ### Enable extra options + echo "Enable extra options..." + + # 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 \ + -e MODULE_COMPRESS_ZSTD + + # Networking support + scripts/config -e NETFILTER_INGRESS + + # Device Drivers + scripts/config -e FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER \ + -e DELL_SMBIOS_SMM \ + -m PATA_JMICRON \ + -E SOUND SOUND_OSS_CORE \ + -e SND_OSSEMUL \ + -M SND_OSSEMUL SND_MIXER_OSS \ + -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 \ + -e SECURITY_SMACK \ + -e SECURITY_SMACK_BRINGUP \ + -e SECURITY_SMACK_NETFILTER \ + -e SECURITY_SMACK_APPEND_SIGNALS \ + -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 + + 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 + if [[ -s /proc/config.gz ]]; then + echo "Extracting config from /proc/config.gz..." + # modprobe configs + zcat /proc/config.gz > ./.config else - make prepare + warning "Your kernel was not compiled with IKCONFIG_PROC!" + warning "You cannot read the current config!" + warning "Aborting!" + exit fi - - ### Prepared version - make -s kernelrelease > ../version - msg2 "Prepared %s version %s" "$pkgbase" "$(<../version)" + fi ### Optionally load needed modules for the make localmodconfig - # See https://aur.archlinux.org/packages/modprobed-db - if [ -n "$_localmodcfg" ]; then - msg2 "If you have modprobed-db installed, running it in recall mode now" - if [ -e /usr/bin/modprobed-db ]; then - [[ -x /usr/bin/sudo ]] || { - echo "Cannot call modprobe with sudo. Install sudo and configure it to work with this user." - exit 1; } - sudo /usr/bin/modprobed-db recall - make localmodconfig - fi + # 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 + else + echo "No modprobed.db data found" + exit fi + fi - ### do not run `make olddefconfig` as it sets default options - yes "" | make config >/dev/null + make -s kernelrelease > version + echo "Prepared $pkgbase version $(<version)" - ### Running make nconfig - - [[ -z "$_makenconfig" ]] || make nconfig + [[ -z "$_makenconfig" ]] || make ${BUILD_FLAGS[*]} nconfig ### Save configuration for later reuse - - cp -Tf ./.config "${startdir}/config-${pkgver}-${pkgrel}${_kernelname}" + cp -Tf ./.config "${startdir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" } build() { cd ${_srcname} - - make bzImage modules + make ${BUILD_FLAGS[*]} all } _package() { - pkgdesc="Clearlinux kernel and modules" - depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7') - optdepends=('crda: to set the correct wireless channels of your country' 'modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig') - provides=('WIREGUARD-MODULE') - backup=("etc/mkinitcpio.d/${pkgbase}.preset") + pkgdesc="The $pkgdesc kernel and modules" + depends=('coreutils' 'kmod' 'initramfs') + optdepends=('wireless-regdb: 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 KSMBD-MODULE) install=linux.install - local kernver="$(<version)" - local modulesdir="$pkgdir/usr/lib/modules/$kernver" + cd $_srcname - cd ${_srcname} + local modulesdir="$pkgdir/usr/lib/modules/$(<version)" - msg2 "Installing boot image..." + 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" - install -Dm644 "$modulesdir/vmlinuz" "$pkgdir/boot/vmlinuz-$pkgbase" - - msg2 "Installing modules..." - make INSTALL_MOD_PATH="$pkgdir/usr" modules_install - - # a place for external modules, - # with version file for building modules and running depmod from hook - local extramodules="extramodules$_kernelname" - local extradir="$pkgdir/usr/lib/modules/$extramodules" - install -Dt "$extradir" -m644 ../version - ln -sr "$extradir" "$modulesdir/extramodules" - - # remove build and source links - rm "$modulesdir"/{source,build} - - 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 - - # fill in mkinitcpio preset 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" - sed "$subst" ../99-linux.hook | install -Dm644 /dev/stdin \ - "$pkgdir/usr/share/libalpm/hooks/99-${pkgbase}.hook" - - msg2 "Fixing permissions..." - chmod -Rc u=rwX,go=rX "$pkgdir" + + # Used by mkinitcpio to name the kernel + echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase" + + echo "Installing modules..." + ZSTD_CLEVEL=19 make ${BUILD_FLAGS[*]} INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \ + DEPMOD=/doesnt/exist modules_install # Suppress depmod + + # remove build link + rm "$modulesdir"/build } _package-headers() { - pkgdesc="Header files and scripts for building modules for linux-clear" - - local builddir="$pkgdir/usr/lib/modules/$(<version)/build" + pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel" + depends=(pahole) 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 + 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 + # 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} + # required when DEBUG_INFO_BTF_MODULES is enabled + if [ -f tools/bpf/resolve_btfids/resolve_btfids ]; then + install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids + fi - # ??? - mkdir "$builddir/.tmp_versions" - - msg2 "Installing headers..." + 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 @@ -275,18 +357,21 @@ _package-headers() { install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h - # http://bugs.archlinux.org/task/13146 + # https://bugs.archlinux.org/task/13146 install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h - # http://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/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h - msg2 "Installing KConfig files..." + # 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/{}" \; - msg2 "Removing unneeded architectures..." + echo "Removing unneeded architectures..." local arch for arch in "$builddir"/arch/*/; do [[ $arch = */x86/ ]] && continue @@ -294,19 +379,19 @@ _package-headers() { rm -r "$arch" done - msg2 "Removing documentation..." + echo "Removing documentation..." rm -r "$builddir/Documentation" - msg2 "Removing broken symlinks..." + echo "Removing broken symlinks..." find -L "$builddir" -type l -printf 'Removing %P\n' -delete - msg2 "Removing loose objects..." + echo "Removing loose objects..." find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete - msg2 "Stripping build tools..." + echo "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) @@ -318,12 +403,12 @@ _package-headers() { esac done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0) - msg2 "Adding symlink..." - mkdir -p "$pkgdir/usr/src" - ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase-$pkgver" + echo "Stripping vmlinux..." + strip -v $STRIP_STATIC "$builddir/vmlinux" - msg2 "Fixing permissions..." - chmod -Rc u=rwX,go=rX "$pkgdir" + echo "Adding symlink..." + mkdir -p "$pkgdir/usr/src" + ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase" } pkgname=("$pkgbase" "$pkgbase-headers") @@ -334,16 +419,11 @@ for _p in "${pkgname[@]}"; do }" done -sha256sums=('d06a7be6e73f97d1350677ad3bae0ce7daecb79c2c2902aaabe806f7fa94f041' +sha256sums=('c969dea4e8bb6be991bbf7c010ba0e0a5643a3a8d8fb0a2aaa053406f1e965f3' 'SKIP' - '34aee04c1af73dbf2f57f953df8032c581a1210952c231c2f1d80d0165ab0e71' + '6ef359c3497d90b0a687d1dc2050d0c662f6a72224c8bf6122847002e145ce11' 'SKIP' - '553858de4315d267d1f259d1146db028eec5112a797379a7a83f5c8a22e626b3' - '226e30068ea0fecdb22f337391385701996bfbdba37cdcf0f1dbf55f1080542d' - 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21' - 'c043f3033bb781e2688794a59f6d1f7ed49ef9b13eb77ff9a425df33a244a636' - 'ed9d35cb7d7bd829ff6253353efa5e2d119820fe4f4310aea536671f5e4caa37' - 'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65') + '1d3ac3e581cbc5108f882fcdc75d74f7f069654c71bad65febe5ba15a7a3a14f') validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds diff --git a/linux.install b/linux.install index bb2f675cbb05..6d815467c1ca 100644 --- a/linux.install +++ b/linux.install @@ -1,5 +1,30 @@ +#!/bin/bash + +_5_2_2_2_changes() { + echo ':: Kernel command line update: add page_alloc.shuffle=1' +} + +_5_2_9_6_changes() { + echo ':: Microcode is no longer builtin. https://wiki.archlinux.org/index.php/Microcode' +} + +post_install() { + echo ":: Adjust kernel command line in your bootloader to Clear Linux kernel default:" + 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 " page_alloc.shuffle=1 rcupdate.rcu_expedited=1" + echo " rootfstype=ext4,btrfs,xfs,f2fs tsc=reliable rw " +} + post_upgrade() { - if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then - echo "WARNING: /boot appears to be a separate partition but is not mounted." - fi + local v upgrades=( + 5.2.2-2 + 5.2.9-6 + ) + + for v in "${upgrades[@]}"; do + if [[ $(vercmp "$v" "$2") -eq 1 ]]; then + "_${v//[.-]/_}_changes" + fi + done } diff --git a/linux.preset b/linux.preset deleted file mode 100644 index 66709a8c1537..000000000000 --- a/linux.preset +++ /dev/null @@ -1,14 +0,0 @@ -# mkinitcpio preset file for the '%PKGBASE%' package - -ALL_config="/etc/mkinitcpio.conf" -ALL_kver="/boot/vmlinuz-%PKGBASE%" - -PRESETS=('default' 'fallback') - -#default_config="/etc/mkinitcpio.conf" -default_image="/boot/initramfs-%PKGBASE%.img" -#default_options="" - -#fallback_config="/etc/mkinitcpio.conf" -fallback_image="/boot/initramfs-%PKGBASE%-fallback.img" -fallback_options="-S autodetect" |