linux-cachyos-rt-bore-headers

LOW
maintainer ptr1337 0 votes base linux-cachyos-rt-bore scanned 2026-10-23 15:37:50.087015
View on AUR
Why flagged

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

Triggered rules

Low Few votes, recently uploaded zero_votes_recent

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

PKGBUILD

1# Maintainer: Peter Jung ptr1337 <admin@ptr1337.dev>
2# Maintainer: Piotr Gorski <piotrgorski@cachyos.org>
3# Maintainer: Vasiliy Stelmachenok <ventureo@cachyos.org>
4# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
5# Contributor: Tobias Powalowski <tpowa@archlinux.org>
6# Contributor: Thomas Baechler <thomas@archlinux.org>
7
8### BUILD OPTIONS
9# Set these variables to ANYTHING that is not null or choose proper variable to enable them
10
11### Selecting CachyOS config
12: "${_cachy_config:=yes}"
13
14### Selecting the CPU scheduler
15# ATTENTION - only one of the following values can be selected:
16# 'bore' - select 'Burst-Oriented Response Enhancer'
17# 'bmq' - select 'BMQ Scheduler'
18# 'hardened' - select 'BORE Scheduler hardened' ## kernel with hardened config and hardening patches with the bore scheduler
19# 'cachyos' - select 'CachyOS Default Scheduler (EEVDF)'
20# 'eevdf' - select 'EEVDF Scheduler'
21# 'rt' - select EEVDF, but includes a series of realtime patches
22# 'rt-bore' - select Burst-Oriented Response Enhancer, but includes a series of realtime patches
23: "${_cpusched:=rt-bore}"
24
25### Tweak kernel options prior to a build via nconfig
26: "${_makenconfig:=no}"
27
28### Tweak kernel options prior to a build via xconfig
29: "${_makexconfig:=no}"
30
31# Compile ONLY used modules to VASTLYreduce the number of modules built
32# and the build time.
33#
34# To keep track of which modules are needed for your specific system/hardware,
35# give module_db script a try: https://aur.archlinux.org/packages/modprobed-db
36# This PKGBUILD read the database kept if it exists
37#
38# More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db
39: "${_localmodcfg:=no}"
40
41# Path to the list of used modules
42: "${_localmodcfg_path:="$XDG_DATA_HOME/modprobed-db/modprobed.db"}"
43
44
45# Use the current kernel's .config file
46# Enabling this option will use the .config of the RUNNING kernel rather than
47# the ARCH defaults. Useful when the package gets updated and you already went
48# through the trouble of customizing your config options. NOT recommended when
49# a new kernel is released, but again, convenient for package bumps.
50: "${_use_current:=no}"
51
52### Enable KBUILD_CFLAGS -O3
53: "${_cc_harder:=yes}"
54
55### Set performance governor as default
56: "${_per_gov:=no}"
57
58### Enable TCP_CONG_BBR3
59: "${_tcp_bbr3:=no}"
60
61### Running with a 1000HZ, 750Hz, 600 Hz, 500Hz, 300Hz, 250Hz and 100Hz tick rate
62: "${_HZ_ticks:=1000}"
63
64## Choose between periodic, idle or full
65### Full tickless can give higher performances in various cases but, depending on hardware, lower consistency.
66: "${_tickrate:=full}"
67
68## Choose between full or lazy
69# Full: Makes all non-critical kernel code preemptible to reduce latency
70# Lazy: Same as full but instead of preempting immediately it waits for signals from the scheduler
71# in an attempt to boost throughput.
72# In practice, this doesn't seem to perform well as both throughput and latency suffer
73# compared to full.
74: "${_preempt:=full}"
75
76### Transparent Hugepages
77# ATTENTION - one of two predefined values should be selected!
78# 'always' - always enable THP
79# 'madvise' - madvise, prevent applications from allocating more memory resources than necessary
80# More infos here:
81# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/performance_tuning_guide/sect-red_hat_enterprise_linux-performance_tuning_guide-configuring_transparent_huge_pages
82: "${_hugepage:=always}"
83
84# CPU compiler optimizations - Defaults to native if left empty
85# - "native" (use compiler autodetection)
86# - "zen4" (Use znver4 compiler optimizations)
87# - "generic" (kernel's default - to share the package between machines with different CPU µarch as long as they are x86-64)
88: "${_processor_opt:=}"
89
90# Clang LTO mode, only available with the "llvm" compiler - options are "none", "full" or "thin".
91# ATTENTION - one of three predefined values should be selected!
92# "full: uses 1 thread for Linking, slow and uses more memory, theoretically with the highest performance gains."
93# "thin: uses multiple threads, faster and uses less memory, may have a lower runtime performance than Full."
94# "thin-dist: Similar to thin, but uses a distributed model rather than in-process: https://discourse.llvm.org/t/rfc-distributed-thinlto-build-for-kernel/85934"
95# "none: disable LTO
96: "${_use_llvm_lto:=none}"
97
98# Use suffix -lto only when requested by the user
99# Enabled by default.
100# yes - enable -lto suffix
101# no - disable -lto suffix
102# https://github.com/CachyOS/linux-cachyos/issues/36
103: "${_use_lto_suffix:=yes}"
104
105# Use suffix -gcc when requested by the user
106# This was added to facilitate https://github.com/CachyOS/linux-cachyos/issues/286
107: "${_use_gcc_suffix:=no}"
108
109# KCFI is a proposed forward-edge control-flow integrity scheme for
110# Clang, which is more suitable for kernel use than the existing CFI
111# scheme used by CONFIG_CFI_CLANG. kCFI doesn't require LTO, doesn't
112# alter function references to point to a jump table, and won't break
113# function address equality.
114: "${_use_kcfi:=no}"
115
116# Build the zfs module in to the kernel
117# WARNING: The ZFS module doesn't build with selected RT sched due to licensing issues.
118# If you use ZFS, refrain from building the RT kernel
119: "${_build_zfs:=no}"
120
121# Builds the open nvidia module and package it into a own base
122# This does replace the requirement of nvidia-open-dkms
123# Use this only if you have Turing+ GPU
124: "${_build_nvidia_open:=no}"
125
126# Builds the r8125 module and package it into its own package
127# Replaces requirement for r8125-dkms
128: "${_build_r8125:=no}"
129
130# Build a debug package with non-stripped vmlinux
131: "${_build_debug:=no}"
132
133# ATTENTION: Do not modify after this line
134_is_lto_kernel() {
135 [[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" || "$_use_llvm_lto" = "thin-dist" ]]
136 return $?
137}
138
139_is_ci_build() {
140 [[ -n "$CI" || -n "$GITHUB_RUN_ID" ]]
141 return $?
142}
143
144if _is_lto_kernel && [ "$_use_lto_suffix" = "yes" ]; then
145 _pkgsuffix="cachyos-${_cpusched}-lto"
146elif ! _is_lto_kernel && [ "$_use_gcc_suffix" = "yes" ]; then
147 _pkgsuffix="cachyos-${_cpusched}-gcc"
148else
149 _pkgsuffix="cachyos-${_cpusched}"
150fi
151
152pkgbase="linux-$_pkgsuffix"
153_major=7.3
154_minor=0
155#_minorc=$((_minor+1))
156#_rcver=rc8
157pkgver=${_major}.${_minor}
158_tagrel=4
159pkgrel=3
160#_stable=${_major}.${_minor}
161_stable=${_major}
162#_stablerc=${_major}-${_rcver}
163_srcname=cachyos-${_major}.${_minor}-${_tagrel}
164pkgdesc='Linux BORE-RT + Cachy Sauce Kernel by CachyOS with other patches and improvements'
165_kernver="$pkgver-$pkgrel"
166_kernuname="${pkgver}-${_pkgsuffix}"
167arch=('x86_64')
168url="https://github.com/CachyOS/linux-cachyos"
169license=('GPL-2.0-only')
170options=('!strip' '!debug' '!lto')
171makedepends=(
172 bc
173 binutils
174 cpio
175 gettext
176 glibc
177 libelf
178 libgcc
179 openssl
180 pahole
181 perl
182 python
183 rust
184 rust-bindgen
185 rust-src
186 tar
187 xxhash
188 xz
189 zlib
190 zstd
191)
192
193_patchsource="https://raw.githubusercontent.com/cachyos/kernel-patches/master/${_major}"
194_nv_ver=615.78.08
195_nv_pkg="NVIDIA-Linux-x86_64-${_nv_ver}"
196_nv_open_pkg="NVIDIA-kernel-module-source-${_nv_ver}"
197source=(
198 "https://github.com/CachyOS/linux/releases/download/${_srcname}/${_srcname}.tar.gz"{,.asc}
199 "config"
200)
201validpgpkeys=(
202 E18447AC260021D31F3FF6C4C8A2A4774B8B63C4 # Eric Naim <dnaim@cachyos.org>
203 E8B9AA39F054E30E8290D492C3C4820857F654FE # Peter Jung <admin@ptr1337.dev>
204)
205
206# LLVM makedepends
207if _is_lto_kernel; then
208 makedepends+=(clang llvm lld)
209 source+=("${_patchsource}/misc/dkms-clang.patch")
210 BUILD_FLAGS=(
211 CC=clang
212 LD=ld.lld
213 LLVM=1
214 LLVM_IAS=1
215 )
216fi
217
218# WARNING The ZFS module doesn't build with selected RT sched due to licensing issues.
219if [[ "$_cpusched" = "rt" || "$_cpusched" = "rt-bore" ]]; then
220 unset _build_zfs
221fi
222
223# ZFS support
224if [ "$_build_zfs" = "yes" ]; then
225 makedepends+=(git)
226 source+=("git+https://github.com/cachyos/zfs.git#commit=fb48c76e17d3e0092fbba430a9eec1960e1b9961")
227fi
228
229
230if [ "$_build_nvidia_open" = "yes" ]; then
231 source+=("https://download.nvidia.com/XFree86/${_nv_open_pkg%"-$_nv_ver"}/${_nv_open_pkg}.tar.xz"
232 "${_patchsource}/misc/nvidia/0001-fix-dsc-correct-RC-parameter-tables-to-match-VESA-DS.patch"
233 "${_patchsource}/misc/nvidia/0002-fix-dp-add-Bigscreen-Beyond-VR-headset-to-WAR-databa.patch")
234fi
235
236if [ "$_build_r8125" = "yes" ]; then
237 source+=("git+https://github.com/aravance/r8125.git")
238fi
239
240## List of CachyOS schedulers
241case "$_cpusched" in
242 bore|rt-bore|hardened) # CachyOS Scheduler (BORE)
243 source+=("${_patchsource}/sched/0001-bore-cachy.patch");;&
244 bmq) ## Project C Scheduler
245 source+=("${_patchsource}/sched/0001-prjc-cachy.patch");;
246 hardened) ## Hardened Patches
247 source+=("${_patchsource}/misc/0001-hardened.patch");;
248 rt|rt-bore) ## RT patches
249 source+=("${_patchsource}/misc/0001-rt-i915.patch");;
250esac
251
252export KBUILD_BUILD_HOST=cachyos
253export KBUILD_BUILD_USER="$pkgbase"
254export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
255
256_die() { error "$@" ; exit 1; }
257
258prepare() {
259 cd "$_srcname"
260
261 echo "Setting version..."
262 echo "-$pkgrel" > localversion.10-pkgrel
263 echo "${pkgbase#linux}" > localversion.20-pkgname
264
265 local src
266 for patch in "${source[@]}"; do
267 patch="${patch%%::*}"
268 src="${patch##*/}"
269 src="${src%.zst}"
270 [[ $src = *.patch ]] || continue
271 echo "Applying patch $src..."
272 if [[ "$patch" == "${_patchsource}"/misc/nvidia/* ]]; then
273 patch -Np1 < "../$src" -d "${srcdir}/${_nv_open_pkg}"
274 else
275 patch -Np1 < "../$src"
276 fi
277 done
278
279 echo "Setting config..."
280 cp ../config .config
281
282 ### Select CPU optimization
283 if [ -n "$_processor_opt" ]; then
284 MARCH="${_processor_opt^^}"
285
286 case "$MARCH" in
287 GENERIC_V[1-4]) scripts/config -e GENERIC_CPU -d MZEN4 -d X86_NATIVE_CPU \
288 --set-val X86_64_VERSION "${MARCH//GENERIC_V}";;
289 ZEN4) scripts/config -d GENERIC_CPU -e MZEN4 -d X86_NATIVE_CPU;;
290 NATIVE) scripts/config -d GENERIC_CPU -d MZEN4 -e X86_NATIVE_CPU;;
291 esac
292 else
293 scripts/config -d GENERIC_CPU -d MZEN4 -e X86_NATIVE_CPU
294 fi
295
296 ### Selecting CachyOS config
297 if [ "$_cachy_config" = "yes" ]; then
298 echo "Enabling CachyOS config..."
299 scripts/config -e CACHY
300 fi
301
302 ### Selecting the CPU scheduler
303 case "$_cpusched" in
304 cachyos|bore|hardened) scripts/config -e SCHED_BORE;;
305 bmq) scripts/config -e SCHED_ALT -e SCHED_BMQ;;
306 eevdf) ;;
307 rt) scripts/config -e PREEMPT_RT;;
308 rt-bore) scripts/config -e SCHED_BORE -e PREEMPT_RT;;
309 *) _die "The value $_cpusched is invalid. Choose the correct one again.";;
310 esac
311
312 echo "Selecting ${_cpusched^^} CPU scheduler..."
313
314 ### Enable KCFI
315 if [ "$_use_kcfi" = "yes" ]; then
316 echo "Enabling kCFI"
317 scripts/config -e ARCH_SUPPORTS_CFI_CLANG -e CFI_CLANG -e CFI_AUTO_DEFAULT
318 fi
319
320 ### Select LLVM level
321 case "$_use_llvm_lto" in
322 thin) scripts/config -e LTO_CLANG_THIN;;
323 thin-dist) scripts/config -e LTO_CLANG_THIN_DIST;;
324 full) scripts/config -e LTO_CLANG_FULL;;
325 none) scripts/config -e LTO_NONE;;
326 *) _die "The value '$_use_llvm_lto' is invalid. Choose the correct one again.";;
327 esac
328
329 echo "Selecting '$_use_llvm_lto' LLVM level..."
330
331 if ! _is_lto_kernel; then
332 echo "Enabling QR Code Panic for GCC Kernels"
333 scripts/config --set-str DRM_PANIC_SCREEN qr_code -e DRM_PANIC_SCREEN_QR_CODE \
334 --set-str DRM_PANIC_SCREEN_QR_CODE_URL https://panic.archlinux.org/panic_report# \
335 --set-val CONFIG_DRM_PANIC_SCREEN_QR_VERSION 40
336 fi
337
338 ### Select tick rate
339 case "$_HZ_ticks" in
340 100|250|500|600|750|1000)
341 scripts/config -d HZ_300 -e "HZ_${_HZ_ticks}" --set-val HZ "${_HZ_ticks}";;
342 300)
343 scripts/config -e HZ_300 --set-val HZ 300;;
344 *)
345 _die "The value $_HZ_ticks is invalid. Choose the correct one again."
346 esac
347
348 echo "Setting tick rate to ${_HZ_ticks}Hz..."
349
350 ### Select performance governor
351 if [ "$_per_gov" = "yes" ]; then
352 echo "Setting performance governor..."
353 scripts/config -d CPU_FREQ_DEFAULT_GOV_SCHEDUTIL \
354 -e CPU_FREQ_DEFAULT_GOV_PERFORMANCE
355 fi
356
357 ### Select tick type
358 case "$_tickrate" in
359 periodic) scripts/config -d NO_HZ_IDLE -d NO_HZ_FULL -d NO_HZ -d NO_HZ_COMMON -e HZ_PERIODIC;;
360 idle) scripts/config -d HZ_PERIODIC -d NO_HZ_FULL -e NO_HZ_IDLE -e NO_HZ -e NO_HZ_COMMON;;
361 full) scripts/config -d HZ_PERIODIC -d NO_HZ_IDLE -d CONTEXT_TRACKING_FORCE -e NO_HZ_FULL_NODEF -e NO_HZ_FULL -e NO_HZ -e NO_HZ_COMMON -e CONTEXT_TRACKING;;
362 *) _die "The value '$_tickrate' is invalid. Choose the correct one again.";;
363 esac
364
365 echo "Selecting '$_tickrate' tick type..."
366
367 ### Select preempt type
368
369 # We should not set up the PREEMPT for RT kernels
370 if [[ "$_cpusched" != "rt" && "$_cpusched" != "rt-bore" ]]; then
371 case "$_preempt" in
372 full) scripts/config -e PREEMPT -d PREEMPT_LAZY;;
373 lazy) scripts/config -d PREEMPT -e PREEMPT_LAZY;;
374 *) _die "The value '$_preempt' is invalid. Choose the correct one again.";;
375 esac
376
377 echo "Selecting '$_preempt' preempt type..."
378 fi
379
380 ### Enable O3
381 if [ "$_cc_harder" = "yes" ]; then
382 echo "Enabling KBUILD_CFLAGS -O3..."
383 scripts/config -d CC_OPTIMIZE_FOR_PERFORMANCE \
384 -e CC_OPTIMIZE_FOR_PERFORMANCE_O3
385 fi
386
387 ### CI-only stuff
388 if _is_ci_build; then
389 echo "Detected build inside CI"
390
391 scripts/config \
392 -d CC_OPTIMIZE_FOR_PERFORMANCE_O3 \
393 -e CC_OPTIMIZE_FOR_SIZE \
394 -d DEBUG_KERNEL \
395 -e DEBUG_INFO_REDUCED
396 fi
397
398 ### Enable bbr3
399 if [ "$_tcp_bbr3" = "yes" ]; then
400 echo "Disabling TCP_CONG_CUBIC..."
401 scripts/config -m TCP_CONG_CUBIC \
402 -d DEFAULT_CUBIC \
403 -e TCP_CONG_BBR \
404 -e DEFAULT_BBR \
405 --set-str DEFAULT_TCP_CONG bbr \
406 -m NET_SCH_FQ_CODEL \
407 -e NET_SCH_FQ \
408 -d CONFIG_DEFAULT_FQ_CODEL \
409 -e CONFIG_DEFAULT_FQ
410 fi
411
412 ### Select THP
413 case "$_hugepage" in
414 always) scripts/config -d TRANSPARENT_HUGEPAGE_MADVISE -e TRANSPARENT_HUGEPAGE_ALWAYS;;
415 madvise) scripts/config -d TRANSPARENT_HUGEPAGE_ALWAYS -e TRANSPARENT_HUGEPAGE_MADVISE;;
416 *) _die "The value '$_hugepage' is invalid. Choose the correct one again.";;
417 esac
418
419 echo "Selecting '$_hugepage' TRANSPARENT_HUGEPAGE config..."
420
421 ### Optionally use running kernel's config
422 # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
423 if [ "$_use_current" = "yes" ]; then
424 if [[ -s /proc/config.gz ]]; then
425 echo "Extracting config from /proc/config.gz..."
426 # modprobe configs
427 zcat /proc/config.gz > ./.config
428 else
429 warning "Your kernel was not compiled with IKPROC!"
430 warning "You cannot read the current config!"
431 warning "Aborting!"
432 exit
433 fi
434 fi
435
436 ### Optionally load needed modules for the make localmodconfig
437 # See https://aur.archlinux.org/packages/modprobed-db
438 if [ "$_localmodcfg" = "yes" ]; then
439 if [ -e "$_localmodcfg_path" ]; then
440 echo "Running Steven Rostedt's make localmodconfig now"
441 make "${BUILD_FLAGS[@]}" LSMOD="${_localmodcfg_path}" localmodconfig
442 else
443 _die "No modprobed.db data found"
444 fi
445 fi
446
447 ### Rewrite configuration
448 echo "Rewrite configuration..."
449 make "${BUILD_FLAGS[@]}" prepare
450 yes "" | make "${BUILD_FLAGS[@]}" config >/dev/null
451 diff -u ../config .config || :
452
453 ### Prepared version
454 make -s kernelrelease > version
455 echo "Prepared $pkgbase version $(<version)"
456
457 ### Running make nconfig
458 [ "$_makenconfig" = "yes" ] && make "${BUILD_FLAGS[@]}" nconfig
459
460 ### Running make xconfig
461 [ "$_makexconfig" = "yes" ] && make "${BUILD_FLAGS[@]}" xconfig
462
463 ### Save configuration for later reuse
464 echo "Save configuration for later reuse..."
465 local basedir="$(dirname "$(readlink "${srcdir}/config")")"
466 cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}"
467}
468
469_sign_modules() {
470 msg2 "Signing modules in $1"
471 local sign_script="${srcdir}/${_srcname}/scripts/sign-file"
472 local sign_key="$(grep -Po 'CONFIG_MODULE_SIG_KEY="\K[^"]*' "${srcdir}/${_srcname}/.config")"
473 if [[ ! "$sign_key" =~ ^/ ]]; then
474 sign_key="${srcdir}/${_srcname}/${sign_key}"
475 fi
476 local sign_cert="${srcdir}/${_srcname}/certs/signing_key.x509"
477 local hash_algo="$(grep -Po 'CONFIG_MODULE_SIG_HASH="\K[^"]*' "${srcdir}/${_srcname}/.config")"
478
479 if [ "$_use_llvm_lto" != "none" ]; then
480 local strip_bin="llvm-strip"
481 else
482 local strip_bin="strip"
483 fi
484
485 find "$1" -type f -name '*.ko' -print \
486 -exec "${strip_bin}" --strip-debug '{}' \; \
487 -exec "${sign_script}" "${hash_algo}" "${sign_key}" "${sign_cert}" '{}' \;
488}
489
490build() {
491 cd "$_srcname"
492 make "${BUILD_FLAGS[@]}" -j"$(nproc)" all
493
494 if ! _is_ci_build; then
495 make -C tools/bpf/bpftool vmlinux.h feature-clang-bpf-co-re=1
496 fi
497
498 local MODULE_FLAGS=(
499 KERNEL_UNAME="${_kernuname}"
500 IGNORE_PREEMPT_RT_PRESENCE=1
501 SYSSRC="${srcdir}/${_srcname}"
502 SYSOUT="${srcdir}/${_srcname}"
503 )
504
505 if [ "$_build_nvidia_open" = "yes" ]; then
506 cd "${srcdir}/${_nv_open_pkg}"
507 MODULE_FLAGS+=(IGNORE_CC_MISMATCH=yes)
508 CFLAGS= CXXFLAGS= LDFLAGS= make "${BUILD_FLAGS[@]}" "${MODULE_FLAGS[@]}" -j"$(nproc)" modules
509 fi
510
511 if [ "$_build_zfs" = "yes" ]; then
512 cd ${srcdir}/"zfs"
513
514 local CONFIGURE_FLAGS=()
515 [ "$_use_llvm_lto" != "none" ] && CONFIGURE_FLAGS+=("KERNEL_LLVM=1")
516
517 ./autogen.sh
518 sed -i "s|\$(uname -r)|${_kernuname}|g" configure
519 ./configure "${CONFIGURE_FLAGS[@]}" --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin \
520 --libdir=/usr/lib --datadir=/usr/share --includedir=/usr/include \
521 --with-udevdir=/lib/udev --libexecdir=/usr/lib/zfs --with-config=kernel \
522 --with-linux="${srcdir}/$_srcname"
523 make "${BUILD_FLAGS[@]}"
524 fi
525
526 if [ "$_build_r8125" = "yes" ]; then
527 cd "${srcdir}/r8125"
528 make "${BUILD_FLAGS[@]}" KERNELDIR="$srcdir/$_srcname" modules
529 fi
530
531}
532
533_package() {
534 pkgdesc="The $pkgdesc kernel and modules"
535 depends=('coreutils' 'kmod' 'initramfs')
536 optdepends=('wireless-regdb: to set the correct wireless channels of your country'
537 'linux-firmware: firmware images needed for some devices'
538 'modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig'
539 'scx-scheds: to use sched-ext schedulers')
540 provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE V4L2LOOPBACK-MODULE NTSYNC-MODULE VHBA-MODULE ADIOS-MODULE)
541
542 cd "$_srcname"
543
544 local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
545
546 echo "Installing boot image..."
547 # systemd expects to find the kernel here to allow hibernation
548 # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
549 install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
550
551 # Used by mkinitcpio to name the kernel
552 echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
553
554 echo "Installing modules..."
555 ZSTD_CLEVEL=19 make "${BUILD_FLAGS[@]}" INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
556 DEPMOD=/doesnt/exist modules_install # Suppress depmod
557
558 # remove build links
559 rm "$modulesdir"/build
560}
561
562_package-headers() {
563 pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
564 depends=(binutils
565 glibc
566 libelf
567 libgcc
568 openssl
569 pahole
570 xxhash
571 zlib
572 zstd
573 "${pkgbase}")
574 provides=(LINUX-HEADERS)
575
576 cd "${_srcname}"
577 local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
578
579 echo "Installing build files..."
580 install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
581 localversion.* version vmlinux
582
583 if ! _is_ci_build; then
584 install -Dt "$builddir" -m644 tools/bpf/bpftool/vmlinux.h
585 fi
586
587 install -Dt "$builddir/kernel" -m644 kernel/Makefile
588 install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
589 cp -t "$builddir" -a scripts
590 ln -srt "$builddir" "$builddir/scripts/gdb/vmlinux-gdb.py"
591
592 # required when STACK_VALIDATION is enabled
593 install -Dt "$builddir/tools/objtool" tools/objtool/objtool
594
595 # required when DEBUG_INFO_BTF_MODULES is enabled
596 if [ -f tools/bpf/resolve_btfids/resolve_btfids ]; then
597 install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
598 fi
599
600 echo "Installing headers..."
601 cp -t "$builddir" -a include
602 cp -t "$builddir/arch/x86" -a arch/x86/include
603 install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
604
605 install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
606 install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
607
608 # https://bugs.archlinux.org/task/13146
609 install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
610
611 # https://bugs.archlinux.org/task/20402
612 install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
613 install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
614 install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
615
616 # https://bugs.archlinux.org/task/71392
617 install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
618
619 echo "Installing KConfig files..."
620 find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
621
622 # Install .rmeta files if they exist
623 if compgen -G "rust/*.rmeta" 1>/dev/null; then
624 install -Dt "$builddir/rust" -m644 rust/*.rmeta
625 fi
626
627 # Install .so files if they exist
628 if compgen -G "rust/*.so" 1>/dev/null; then
629 install -Dt "$builddir/rust" rust/*.so
630 fi
631
632 # Install generated Rust files
633 if [ -d rust/kernel ]; then
634 while IFS= read -r -d "" _gen; do
635 install -Dm644 "$_gen" "$builddir/$_gen"
636 done < <(find rust -type f -name 'generated_*.rs' -print0)
637 fi
638
639 echo "Installing unstripped VDSO..."
640 make INSTALL_MOD_PATH="$pkgdir/usr" vdso_install \
641 link= # Suppress build-id symlinks
642
643 echo "Removing unneeded architectures..."
644 local arch
645 for arch in "$builddir"/arch/*/; do
646 [[ $arch = */x86/ ]] && continue
647 echo "Removing $(basename "$arch")"
648 rm -r "$arch"
649 done
650
651 echo "Removing documentation..."
652 rm -r "$builddir/Documentation"
653
654 echo "Removing broken symlinks..."
655 find -L "$builddir" -type l -printf 'Removing %P\n' -delete
656
657 echo "Removing loose objects..."
658 find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
659
660 echo "Stripping build tools..."
661 local file
662 while read -rd '' file; do
663 case "$(file -Sib "$file")" in
664 application/x-sharedlib\;*) # Libraries (.so)
665 strip -v $STRIP_SHARED "$file" ;;
666 application/x-archive\;*) # Libraries (.a)
667 strip -v $STRIP_STATIC "$file" ;;
668 application/x-executable\;*) # Binaries
669 strip -v $STRIP_BINARIES "$file" ;;
670 application/x-pie-executable\;*) # Relocatable binaries
671 strip -v $STRIP_SHARED "$file" ;;
672 esac
673 done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
674
675 echo "Stripping vmlinux..."
676 strip -v $STRIP_STATIC "$builddir/vmlinux"
677
678 echo "Adding symlink..."
679 mkdir -p "$pkgdir/usr/src"
680 ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
681}
682
683_package-dbg(){
684 pkgdesc="Non-stripped vmlinux file for the $pkgdesc kernel"
685 depends=("${pkgbase}-headers")
686
687 cd "${_srcname}"
688 mkdir -p "$pkgdir/usr/src/debug/${pkgbase}"
689 install -Dt "$pkgdir/usr/src/debug/${pkgbase}" -m644 vmlinux
690}
691
692_package-zfs(){
693 pkgdesc="zfs module for the $pkgdesc kernel"
694 depends=('pahole' "${pkgbase}=${_kernver}")
695 provides=('ZFS-MODULE')
696 license=('CDDL')
697
698 cd "$_srcname"
699 local modulesdir="$pkgdir/usr/lib/modules/$(<version)/extramodules"
700
701 cd "${srcdir}/zfs"
702 install -dm755 "${modulesdir}"
703 install -m644 module/*.ko "${modulesdir}"
704
705 _sign_modules "${modulesdir}"
706 find "$pkgdir" -name '*.ko' -exec zstd --rm -19 -T0 {} +
707 # sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${pkgver}-${pkgbase}'/" "$startdir/zfs.install"
708}
709
710_package-nvidia-open(){
711 pkgdesc="nvidia open modules of ${_nv_ver} driver for the ${pkgbase} kernel"
712 depends=("$pkgbase=$_kernver" "nvidia-utils=${_nv_ver}" "libglvnd")
713 provides=('NVIDIA-MODULE')
714 conflicts=("$pkgbase-nvidia")
715 license=('MIT AND GPL-2.0-only')
716
717 cd "$_srcname"
718 local modulesdir="$pkgdir/usr/lib/modules/$(<version)/extramodules"
719
720 cd "${srcdir}/${_nv_open_pkg}"
721 install -dm755 "${modulesdir}"
722 install -m644 kernel-open/*.ko "${modulesdir}"
723 install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 COPYING
724
725 _sign_modules "${modulesdir}"
726 find "$pkgdir" -name '*.ko' -exec zstd --rm -19 -T0 {} +
727}
728
729_package-r8125() {
730 pkgdesc="r8125 modules for the $pkgbase kernel"
731 depends=("$pkgbase=$_kernver")
732 license=('GPL-2.0-only')
733
734 cd "$_srcname"
735 local modulesdir="$pkgdir/usr/lib/modules/$(<version)/extramodules"
736
737 cd "${srcdir}/r8125"
738 install -dm755 "${modulesdir}"
739 install -m644 src/*.ko "${modulesdir}"
740
741 _sign_modules "${modulesdir}"
742 find "$pkgdir" -name '*.ko' -exec zstd --rm -19 -T0 {} +
743
744 # Blacklist r8169 so that r8125 is used instead
745 install -dm755 "${pkgdir}/usr/lib/modprobe.d"
746 echo "install r8169 /usr/bin/modprobe r8125 || /usr/bin/modprobe --ignore-install r8169" > "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
747}
748
749pkgname=("$pkgbase")
750[ "$_build_debug" = "yes" ] && pkgname+=("$pkgbase-dbg")
751pkgname+=("$pkgbase-headers")
752[ "$_build_zfs" = "yes" ] && pkgname+=("$pkgbase-zfs")
753[ "$_build_nvidia_open" = "yes" ] && pkgname+=("$pkgbase-nvidia-open")
754[ "$_build_r8125" = "yes" ] && pkgname+=("$pkgbase-r8125")
755for _p in "${pkgname[@]}"; do
756 eval "package_$_p() {
757 $(declare -f "_package${_p#$pkgbase}")
758 _package${_p#$pkgbase}
759 }"
760done
761
762b2sums=('d90b9a609d930cf596022050014ef75e11f3b9378fb51be7763743bc15b10d31caa8d48c59149ed2aea28853aae1ec6d7e68a8ce441b1bd014c9897cbeb8dba5'
763 'SKIP'
764 'e21485bd3d917be15837eb51ddb9aeb4a0df5fb7b18ccbf1d520aff2340833935e441f634e4ae8482a21ff38a9dec9f320bec3459aedf15087909b6eb2cff7db'
765 '04cca5d4811dce379776c124469cb69f5275e7eaa61401da9e23077d0d60d4d06b85b646292b6db4639541d70b4283f732b102c1168d6d29e16f8cccc695e205'
766 '2d9ccf5217efa1b67e8cfbc4eb0b2f444f768adec03dbfea504f7b30cee87fc8acc74a24e526a0444ca0df0fb9b44ed5ba6638add07dd3e4e425487de2c2486b')
767

Scan history

Scanned at (UTC)SeverityRules
2026-10-23 15:37:50 Low 1

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion