linux-clear-cjktty-zfs
maintainer neko_ayaya
· 2 votes
· scanned 2026-08-03 00:08:14.047287
LOW
View on AUR ↗
Why flagged
The source from a non-standard host (git.staropensource.de) is a git checkout of the project's own patchset, used for building the kernel from official sources; this is normal AUR packaging behavior and not inherently dangerous.
Triggered rules
LOW
AI review downgraded a static finding
llm_review
The static rules flagged this MEDIUM, but an AI model (qwen/qwen3-235b-a22b-07-25) reviewed the full PKGBUILD and judged it LOW (confidence 95%): The source from a non-standard host (git.staropensource.de) is a git checkout of the project's own patchset, used for building the kernel from official sources; this is normal AUR packaging behavior and not inherently dangerous.
1 higher static finding superseded - not the current verdict (shown for transparency)
MEDIUM
source=() URL on a non-standard host
source_untrusted_domain
One or more source=() URLs point to a host outside the trusted allowlist (github.com, gitlab.com, codeberg.org, pypi.org, …).
-
PKGBUILD:148
"tachyon::git+https://git.staropensource.de/StarOpenSource/Linux-Tachyon.git"
PKGBUILD
1 offending line(s) highlighted
1
# Maintainer: ayaya_neko <a15355447898a@outlook.com>
2
3
### BUILD OPTIONS
4
# You can modify these settings by executing "env _<setting>=<value> makepkg"
5
# instead of modifying the PKGBUILD file. Here's an example:
6
# env _makemenuconfig=y _copyfinalconfig=y makepkg
7
8
# Toggles colorful log messages.
9
#
10
# We unfortunately have no way of checking whether the
11
# terminal supports colors because 'makepkg' unsets
12
# the 'CI' and 'COLORTERM' variables before we can read them.
13
#
14
# Set to anything but null to deactivate.
15
: "${_disable_colorful_logging:=""}"
16
17
# Specifies a list of additional patches to apply.
18
#
19
# All values must be prefixed with a plus sign (+)
20
# and be separated by spaces. Any invalid values
21
# will be silently ignored.
22
#
23
# Available patch categories:
24
# - experimental: Experimental patches that should not be enabled on production kernels
25
: "${_additionalpatches:=""}"
26
27
# Tweak kernel options prior to a build via menuconfig.
28
#
29
# Set to anything but null to activate.
30
: "${_makemenuconfig:=""}"
31
32
# Tweak kernel options prior to a build via nconfig.
33
#
34
# Set to anything but null to activate.
35
: "${_makenconfig:=""}"
36
37
# Tweak kernel options prior to a build via xconfig.
38
#
39
# Set to anything but null to activate.
40
: "${_makexconfig:=""}"
41
42
# Use the current kernel's .config file
43
# Enabling this option will use the .config of the currently
44
# running kernel rather than the Arch Linux defaults. Useful
45
# when the package gets updated and you already went through
46
# the trouble of customizing your config options. NOT recommended
47
# when a new kernel is released, but again, convenient
48
# for package bumps.
49
#
50
# Set to anything but null to activate.
51
: "${_use_current:=""}"
52
53
# Apply selected optimizations chosen by
54
# the package maintainers to the config.
55
#
56
# Only takes effect if '_use_current'
57
# is enabled. Keep disabled if you want
58
# to reuse your existing kernel configuration
59
# without any changes being applied to it.
60
#
61
# Set to anything but null to activate.
62
: "${_optimize_defconfig:=""}"
63
64
# Determines whether the kernel configuration should be
65
# copied into the source tree before compilation starts.
66
#
67
# Set to anything but null to activate.
68
: "${_copyfinalconfig:=""}"
69
70
# Only compile active modules to VASTLY reduce the number
71
# of modules built and the build time.
72
#
73
# To keep track of which modules are needed for your specific system/hardware,
74
# give modprobed-db a try: https://aur.archlinux.org/packages/modprobed-db
75
#
76
# More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db
77
# Set to anything but null to activate.
78
: "${_localmodcfg:=""}"
79
80
# Enable compilation with LLVM
81
# Be warned, this is largely untested by me (im_zerou). It *should* work,
82
# but if it doesn't, write a comment and I'll fix it.
83
#
84
# Set to anything but null to activate.
85
: "${_use_llvm_lto:=""}"
86
87
# Debug options
88
# This allows you to enable or disable debug options.
89
# Set to 'y' to force enable, 'n' to force disable or '' to ignore debug options.
90
# Leaving the setting empty will use the kernel configuration setting to determine
91
# if debug options shall be enabled/disabled.
92
#
93
# Set to anything but null to activate.
94
: "${_debug:=""}"
95
96
### BUILD OPTIONS END
97
98
### DEPRECATED BUILD OPTIONS START
99
100
# See '_use_current'
101
: "${_reuse_current:=""}"
102
103
# See '_optimize_defconfig'
104
: "${_update_kconfig_on_reuse:=""}"
105
106
# Show full compilation output
107
# This used to control whether normal build
108
# or some magic pv output should be
109
# displayed while the kernel is compiling.
110
: "${_show_compile:=""}"
111
112
# x86_64 microarchitecture to optimize for.
113
#
114
# Support has been removed in the kernel 7.0 update, as we threw out
115
# the kernel compiler patch for multiple microarchitectures out the
116
# window in the process.
117
: "${_subarch:=""}"
118
119
# See '_subarch'
120
: "${_subarch_microarch:=""}"
121
122
### DEPRECATED BUILD OPTIONS END
123
124
125
# Kernel version
126
_kernel_major=7.0
127
_kernel_minor=6
128
# Clear Linux patches version
129
_clr=7.0.6-1602
130
# Source directory names
131
_src_linux=linux-${_kernel_major}
132
133
134
# Package information
135
pkgbase=linux-clear-cjktty-zfs
136
pkgver=${_kernel_major}.${_kernel_minor}
137
pkgrel=1
138
pkgdesc="Clear Linux内核,带有zfs和cjktty并开启kexec"
139
arch=("x86_64")
140
url="https://git.staropensource.de/StarOpenSource/Linux-Tachyon"
141
license=("GPL-2.0-only")
142
makedepends=("bc" "cpio" "gettext" "git" "libelf" "pahole" "perl" "python" "tar" "xz" "zstd")
143
options=("!strip" "!debug")
144
source=(
145
"https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-${_kernel_major}.tar.xz"
146
"https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-${_kernel_major}.tar.sign"
147
"https://cdn.kernel.org/pub/linux/kernel/v7.x/patch-${_kernel_major}.${_kernel_minor}.xz"
148
"tachyon::git+https://git.staropensource.de/StarOpenSource/Linux-Tachyon.git"
149
"git+https://github.com/openzfs/zfs.git#tag=zfs-2.4.2"
150
"0001-cjktty.patch::https://github.com/bigshans/cjktty-patches/raw/master/v7.x/cjktty-7.0.patch"
151
"0002-cjktty-32.patch::https://github.com/bigshans/cjktty-patches/raw/master/cjktty-add-cjk32x32-font-data.patch"
152
)
153
154
155
# Integrity & signature verification
156
# -> SHA-256 checksums of the package's sources
157
# These need to be updated each release; see the 'source' array
158
sha256sums=(
159
"bb7f6d80b387c757b7d14bb93028fcb90f793c5c0d367736ee815a100b3891f0"
160
"SKIP"
161
"abd193ca459744d3af3f875d649d01d84dc5e810083e5f1c67eba551c86c4404"
162
"SKIP"
163
'SKIP'
164
'SKIP'
165
'SKIP'
166
)
167
168
# -> Kernel PGP signer fingerprints
169
# Taken from https://www.kernel.org/signature.html
170
validpgpkeys=(
171
"ABAF11C65A2970B130ABE3C479BE3E4300411886" # Linus Torvalds (torvalds@kernel.org)
172
"647F28654894E3BD457199BE38DBBDC86092693E" # Greg Kroah-Hartman (gregkh@kernel.org)
173
"E27E5D8A3403A2EF66873BBCDEA66FF797772CDC" # Sasha Levin (sashal@kernel.org)
174
"AC2B29BD34A6AFDDB3F68F35E7BFC8EC95861109" # Ben Hutchings (benh@debian.org)
175
)
176
177
178
# Update package information and build flags based on build settings
179
[ -n "${_use_llvm_lto}" ] && makedepends+=("clang" "llvm" "lld")
180
[ "${_debug}" == "y" ] && options=("!strip")
181
[ -n "${_use_llvm_lto}" ] && BUILD_FLAGS=("LLVM=1" "LLVM_IAS=1")
182
183
184
# Set kernel build properties
185
export "KBUILD_BUILD_HOST=archlinux"
186
export "KBUILD_BUILD_USER=${pkgbase}"
187
export "KBUILD_BUILD_TIMESTAMP=$(date -Ru${SOURCE_DATE_EPOCH:+d @${SOURCE_DATE_EPOCH}})"
188
189
190
## Logs a message.
191
##
192
## This method is internal and should not be used directly.
193
##
194
## Arguments: <str:ANSI color code> <str:level name> <str:message...>
195
_log() {
196
COLOR_CODE="${1}"
197
LEVEL_NAME="${2}"
198
shift 2
199
200
if [ -z "${_disable_colorful_logging}" ]; then
201
echo -en "\e[1;${COLOR_CODE}m:: ${LEVEL_NAME}: \e[0m\e[0;${COLOR_CODE}m"
202
echo -n "${*}"
203
echo -e "\e[0m"
204
else
205
echo -en ":: ${LEVEL_NAME}: "
206
echo "${*}"
207
fi
208
}
209
210
## Logs an informational message.
211
##
212
## Arguments: <str:message...>
213
_info() { _log "37" "INFO" "${*}"; }
214
215
## Logs a warning message.
216
##
217
## Arguments: <str:message...>
218
_warning() { _log "33" "WARN" "${*}"; }
219
220
## Logs an error message.
221
##
222
## Arguments: <str:message...>
223
_error() { _log "31" "ERR!" "${*}"; }
224
225
226
## Checks for deprecated settings.
227
_check_deprecated_settings() {
228
if [ -n "${_update_kconfig_on_reuse}" ]; then
229
_warning "Please switch to using '_optimize_defconfig' flag instead of '_update_kconfig_on_reuse'"
230
_optimize_defconfig="y"
231
fi
232
if [ -n "${_reuse_current}" ]; then
233
_warning "Please switch to using '_use_current' flag instead of '_reuse_current'"
234
_use_current="y"
235
fi
236
[ -n "${_show_compile}" ] && _warning "'_show_compile' is no longer supported"
237
238
if [ -n "${_subarch}" ] || [ -n "${_subarch_microarch}" ]; then
239
_warning "'_subarch' and '_subarch_microarch' are no longer supported"
240
fi
241
242
# To avoid an error
243
true
244
}
245
246
## Parses the linux.spec file for patches to apply
247
_get_patches() {
248
# Get the list of patches from the file, ignore the comments
249
grep -Ev '^\s*#' ${srcdir}/tachyon/patch_list.txt
250
# Experimental patches
251
if [[ "${_additionalpatches,,}" == *"+experimental"* ]]; then
252
grep -Ev '^\s*#' ${srcdir}/tachyon/patch_list_exp.txt
253
grep -Ev '^\s*#' ${srcdir}/tachyon/patch_list_exp_mm.txt
254
grep -Ev '^\s*#' ${srcdir}/tachyon/patch_list_exp_sched.txt
255
fi
256
}
257
258
259
## Invokes '_get_patches' and applies them as well as KCC
260
_apply_patches() {
261
_info "Applying patches"
262
263
# Patch with kernel update patch
264
_info "Applying kernel update patch"
265
patch -sNp1 -i ../patch-${_kernel_major}.${_kernel_minor} || true
266
267
# Set version
268
echo "-${pkgrel}" > localversion.10-pkgrel
269
echo "${pkgbase#linux}" > localversion.20-pkgname
270
271
# Patch with Tachyon patches
272
for __patch in $(_get_patches); do
273
_info "Applying '${__patch}'"
274
if [ -n "${_use_llvm_lto}" ]; then
275
[ "${__patch}" == "0133-novector.patch" ] && continue
276
fi
277
278
patch -sNp1 -i "${srcdir}/tachyon/patches/${__patch}" || true
279
done
280
}
281
282
283
## Runs *config based on the user's wishes.
284
_modify_defconfig() {
285
[ -n "${_makemenuconfig}" ] && make ${BUILD_FLAGS[*]} menuconfig
286
[ -n "${_makexconfig}" ] && make ${BUILD_FLAGS[*]} xconfig
287
[ -n "${_makenconfig}" ] && make ${BUILD_FLAGS[*]} nconfig
288
289
# Don't crash if all three are false
290
true
291
}
292
293
294
## Verifies the kernel configuration version
295
## and copies the current kernel configuration, if wanted.
296
_copy_defconfig() {
297
# Check if running kernel is compatible with the new kernel
298
local __current_major_version
299
__current_major_version="$(uname -r | grep -o '[0-9]*[0-9]\.[0-9]*[0-9]')"
300
[ "${__current_major_version}" != "${_kernel_major}" ] &&
301
_warning "Major version was updated, you should regen the defconfig"
302
303
# Copy running kernel configuration
304
if [ -s /proc/config.gz ]; then
305
_info "Copying configuration from running kernel"
306
# modprobe configs
307
zcat /proc/config.gz > ./.config
308
make ${BUILD_FLAGS[*]} olddefconfig
309
else
310
_error "Your kernel was not compiled with IKCONFIG_PROC."
311
_error "Unable to read kernel configuration, aborting."
312
return 1
313
fi
314
}
315
316
317
## When reusing current config, also apply local patches, integrate ZFS,
318
## apply extra kernel options, then sync with olddefconfig (non-interactive).
319
_apply_overrides_on_current_config() {
320
# Apply any local patches shipped via source array (e.g., cjktty)
321
local src
322
for src in "${source[@]}"; do
323
src="${src%%::*}"
324
src="${src##*/}"
325
src="${src%.zst}"
326
[[ $src = *.patch ]] || continue
327
echo "Applying patch $src..."
328
patch -Np1 <"../$src"
329
done
330
331
# Sync config after local patch changes before prepare steps touch Kconfig.
332
_info "Executing 'make olddefconfig' before ZFS integration (current config reuse)"
333
make ${BUILD_FLAGS[*]} olddefconfig
334
335
# Prepare kernel tree for external integration
336
make ${BUILD_FLAGS[*]} prepare -j$(nproc)
337
make ${BUILD_FLAGS[*]} modules_prepare -j$(nproc)
338
339
# Integrate ZFS as builtin
340
cd ${srcdir}/"zfs"
341
./autogen.sh
342
sed -i "s|\$(uname -r)|${pkgver}-clear-cjktty-zfs|g" configure
343
./configure CC=gcc --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --libdir=/usr/lib \
344
--datadir=/usr/share --includedir=/usr/include --with-udevdir=/lib/udev \
345
--libexecdir=/usr/lib/zfs --with-config=kernel \
346
--enable-linux-builtin=yes \
347
--with-linux=${srcdir}/${_src_linux} \
348
--with-linux-obj=${srcdir}/${_src_linux}
349
./copy-builtin ${srcdir}/${_src_linux}
350
351
# Back to kernel tree
352
cd ${srcdir}/${_src_linux}
353
354
_apply_always_on_overrides
355
356
# Finally, sync config without interaction
357
_info "Executing 'make olddefconfig' (current config reuse)"
358
make ${BUILD_FLAGS[*]} olddefconfig
359
}
360
361
## Applies custom features that must remain enabled regardless of config strategy.
362
_apply_always_on_overrides() {
363
364
# Enable ZFS and other custom options
365
scripts/config -e CONFIG_ZFS
366
367
# cjktty fonts
368
scripts/config -e CONFIG_FONT_CJK_16x16 \
369
-e CONFIG_FONT_CJK_32x32
370
371
# kexec related options
372
scripts/config -e CONFIG_ARCH_SUPPORTS_KEXEC \
373
-e CONFIG_ARCH_SUPPORTS_KEXEC_FILE \
374
-e CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY \
375
-e CONFIG_ARCH_SUPPORTS_KEXEC_SIG \
376
-e CONFIG_ARCH_SUPPORTS_KEXEC_SIG_FORCE \
377
-e CONFIG_ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG \
378
-e CONFIG_ARCH_SUPPORTS_KEXEC_JUMP \
379
-e CONFIG_ARCH_SUPPORTS_CRASH_DUMP \
380
-e CONFIG_ARCH_SUPPORTS_CRASH_HOTPLUG
381
382
# Virtual USB for specific use-cases
383
scripts/config -m CONFIG_USB_DUMMY_HCD \
384
-m CONFIG_USB_MASS_STORAGE
385
}
386
387
## Applies optional maintainer defaults on top of the selected base config.
388
_apply_optional_defconfig_overrides() {
389
# Extra configuration
390
_info "Updating kernel configuration"
391
# General setup
392
scripts/config --set-str DEFAULT_HOSTNAME archlinux \
393
-e IKCONFIG \
394
-e IKCONFIG_PROC \
395
-u RT_GROUP_SCHED
396
# Power management and ACPI options
397
scripts/config -e ACPI_REV_OVERRIDE_POSSIBLE \
398
-e ACPI_TABLE_UPGRADE
399
# Virtualization
400
scripts/config -e KVM_SMM
401
# General architecture-dependent options
402
scripts/config -e KPROBES
403
# Enable loadable module support
404
scripts/config -u MODULE_SIG_FORCE
405
# Networking support
406
scripts/config -e NETFILTER_INGRESS
407
# OpenVPN data channel offload (OVPN-DCO)
408
scripts/config -e OVPN
409
# Device Drivers
410
scripts/config -e FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER \
411
-e DELL_SMBIOS_SMM \
412
-m PATA_JMICRON \
413
-E SOUND SOUND_OSS_CORE \
414
-e SND_OSSEMUL \
415
-M SND_OSSEMUL SND_MIXER_OSS \
416
-M SND_MIXER_OSS SND_PCM_OSS \
417
-E SND_PCM_OSS SND_PCM_OSS_PLUGINS \
418
-m AGP -M AGP AGP_INTEL -M AGP_INTEL AGP_VIA
419
# Kernel hacking -> Compile-time checks and compiler options -> Make section mismatch errors non-fatal
420
scripts/config -e SECTION_MISMATCH_WARN_ONLY
421
# File systems
422
scripts/config -m NTFS3_FS \
423
-e NTFS3_LZX_XPRESS \
424
-e NTFS3_FS_POSIX_ACL
425
scripts/config -m SMB_SERVER \
426
-e SMB_SERVER_SMBDIRECT \
427
-e SMB_SERVER_CHECK_CAP_NET_ADMIN \
428
-e SMB_SERVER_KERBEROS5
429
# Security options
430
scripts/config -e SECURITY_SELINUX \
431
-e SECURITY_SELINUX_BOOTPARAM \
432
-e SECURITY_SMACK \
433
-e SECURITY_SMACK_BRINGUP \
434
-e SECURITY_SMACK_NETFILTER \
435
-e SECURITY_SMACK_APPEND_SIGNALS \
436
-e SECURITY_TOMOYO \
437
-e SECURITY_APPARMOR \
438
-e SECURITY_YAMA
439
# Security options -> Landlock options
440
scripts/config -e SECURITY_LANDLOCK
441
# Library routines
442
scripts/config -k -e FONT_TER16x32
443
444
# EDAC enablement for modern CPUs
445
scripts/config -e EDAC_AMD64 \
446
-e EDAC_IGEN6
447
448
# Google's BBRv3 TCP algo
449
scripts/config -e TCP_CONG_BBR \
450
-e NET_SCH_FQ \
451
--set-str DEFAULT_TCP_CONG bbr \
452
--set-str DEFAULT_NET_SCH fq
453
454
# Enable LLVM compilation
455
[ -n "${_use_llvm_lto}" ] && scripts/config -d LTO_NONE \
456
-e LTO \
457
-e LTO_CLANG \
458
-e ARCH_SUPPORTS_LTO_CLANG \
459
-e ARCH_SUPPORTS_LTO_CLANG_THIN \
460
-e HAS_LTO_CLANG \
461
-e LTO_CLANG_THIN \
462
-e HAVE_GCC_PLUGINS
463
464
# Enable or disable debug settings
465
[ "${_debug}" == "y" ] && scripts/config -e DEBUG_INFO \
466
-e DEBUG_INFO_BTF \
467
-e DEBUG_INFO_DWARF4 \
468
-e PAHOLE_HAS_SPLIT_BTF \
469
-e DEBUG_INFO_BTF_MODULES
470
[ "${_debug}" == "n" ] && scripts/config -d DEBUG_INFO \
471
-d DEBUG_INFO_BTF \
472
-d DEBUG_INFO_DWARF4 \
473
-d PAHOLE_HAS_SPLIT_BTF \
474
-d DEBUG_INFO_BTF_MODULES
475
476
# Keep the helper non-fatal when optional branches are skipped.
477
true
478
}
479
480
481
## Modifies the kernel configuration and displays a
482
## selection of subarches (if left unspecified by the user).
483
_update_defconfig() {
484
# Copy configuration file (if found)
485
if [ -f "${startdir}/kconfig" ]; then
486
_info "Using configuration file \"${startdir}/kconfig\""
487
cp -Tf "${startdir}/kconfig" ./.config
488
else
489
_info "Using configuration file \"${srcdir}/${pkgbase}/config\""
490
cp -Tf $srcdir/tachyon/config ./.config
491
fi
492
493
# 添加cjktty补丁
494
local src
495
for src in "${source[@]}"; do
496
src="${src%%::*}"
497
src="${src##*/}"
498
src="${src%.zst}"
499
[[ $src = *.patch ]] || continue
500
echo "Applying patch $src..."
501
patch -Np1 <"../$src"
502
done
503
504
# Sync config before prepare steps so new/changed symbols take defaults.
505
_info "Executing 'make olddefconfig' before ZFS integration"
506
make ${BUILD_FLAGS[*]} olddefconfig
507
508
# 编译zfs前面的准备
509
make ${BUILD_FLAGS[*]} prepare -j$(nproc)
510
make ${BUILD_FLAGS[*]} modules_prepare -j$(nproc)
511
512
# 添加zfs补丁
513
cd ${srcdir}/"zfs"
514
./autogen.sh
515
sed -i "s|\$(uname -r)|${pkgver}-clear-cjktty-zfs|g" configure
516
./configure CC=gcc --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --libdir=/usr/lib \
517
--datadir=/usr/share --includedir=/usr/include --with-udevdir=/lib/udev \
518
--libexecdir=/usr/lib/zfs --with-config=kernel \
519
--enable-linux-builtin=yes \
520
--with-linux=${srcdir}/${_src_linux} \
521
--with-linux-obj=${srcdir}/${_src_linux}
522
./copy-builtin ${srcdir}/${_src_linux}
523
524
# 开启zfs选项
525
cd ${srcdir}/${_src_linux}
526
_apply_always_on_overrides
527
_apply_optional_defconfig_overrides
528
529
# Enable LLVM compilation
530
# Run olddefconfig
531
_info "Executing 'make olddefconfig'"
532
make ${BUILD_FLAGS[*]} olddefconfig
533
}
534
535
536
## makepkg method; see https://wiki.archlinux.org/title/Creating_packages#prepare()
537
prepare() {
538
cd "${_src_linux}" || exit 1
539
540
_check_deprecated_settings
541
_apply_patches
542
543
# Config strategy:
544
# - If reusing current config, only apply maintainer defaults when requested.
545
# - Otherwise, prepare a fresh defconfig with maintainer defaults.
546
if [ -n "${_use_current}" ]; then
547
_copy_defconfig
548
_apply_overrides_on_current_config
549
[ -n "${_optimize_defconfig}" ] && _apply_optional_defconfig_overrides && make ${BUILD_FLAGS[*]} olddefconfig
550
else
551
_update_defconfig
552
fi
553
554
# Read and apply modprobed database
555
# See https://aur.archlinux.org/packages/modprobed-db
556
if [ -n "${_localmodcfg}" ]; then
557
if [ -e "${HOME}/.config/modprobed.db" ]; then
558
_info "Applying the modprobed database"
559
make ${BUILD_FLAGS[*]} LSMOD=${HOME}/.config/modprobed.db localmodconfig
560
else
561
_info "No modprobed.db file was found at ${HOME}/.config, skipping"
562
fi
563
fi
564
565
# Open configuration editors
566
_modify_defconfig
567
568
# Save configuration
569
# shellcheck disable=SC2015
570
[ -n "${_copyfinalconfig}" ] && cp -Tf ./.config "${startdir}/kconfig-new" || true
571
572
# Write kernel version
573
make -s kernelrelease > version
574
}
575
576
577
## makepkg method; see https://wiki.archlinux.org/title/Creating_packages#build()
578
build() {
579
cd "${_src_linux}" || exit 1
580
make ${BUILD_FLAGS[*]} all
581
}
582
583
584
## makepkg method; see https://wiki.archlinux.org/title/Creating_packages#package()
585
_package() {
586
pkgdesc="${pkgdesc} 此包包括内核和已编译的模块"
587
depends=("coreutils" "kmod" "initramfs")
588
optdepends=("wireless-regdb: to set the correct wireless channels of your country"
589
"linux-firmware: firmware images needed for some devices")
590
provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE)
591
install=linux.install
592
593
cd "${_src_linux}" || exit 1
594
local "__modulesdir=${pkgdir}/usr/lib/modules/$(<version)"
595
596
# Create boot image
597
# systemd expects to find the kernel there to allow hibernation
598
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
599
install -Dm644 "$(make -s image_name)" "${__modulesdir}/vmlinuz"
600
601
# Used by mkinitcpio to name the kernel
602
echo "${pkgbase}" | install -Dm644 /dev/stdin "${__modulesdir}/pkgbase"
603
604
# Install modules
605
# We specify DEPMOD=/doesnt/exist here to suppress depmod
606
# Silence this make call as it's just a compress + move operation
607
ZSTD_CLEVEL=3 make -s ${BUILD_FLAGS[*]} INSTALL_MOD_PATH="${pkgdir}/usr" \
608
INSTALL_MOD_STRIP=1 DEPMOD=/doesnt/exist modules_install
609
610
# Remove build directory
611
rm -vrf "${__modulesdir}"/build
612
}
613
614
## makepkg method; see https://wiki.archlinux.org/title/Creating_packages#package()
615
_package-headers() {
616
pkgdesc="${pkgdesc} 此包包括用于构建内核模块的头文件和脚本"
617
depends=("pahole")
618
619
cd "${_src_linux}" || exit 1
620
local "__builddir=${pkgdir}/usr/lib/modules/$(<version)/build"
621
622
install -Dt "${__builddir}" -m644 .config Makefile Module.symvers System.map \
623
localversion.* version vmlinux
624
install -Dt "${__builddir}/kernel" -m644 kernel/Makefile
625
install -Dt "${__builddir}/arch/x86" -m644 arch/x86/Makefile
626
cp -t "${__builddir}" -a scripts
627
628
# Required when STACK_VALIDATION is enabled
629
install -Dt "${__builddir}/tools/objtool" tools/objtool/objtool
630
631
# Required when DEBUG_INFO_BTF_MODULES is enabled
632
[ -f tools/bpf/resolve_btfids/resolve_btfids ] && install -Dt "${__builddir}/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
633
634
cp -t "${__builddir}" -a include
635
cp -t "${__builddir}/arch/x86" -a arch/x86/include
636
install -Dt "${__builddir}/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
637
638
install -Dt "${__builddir}/drivers/md" -m644 drivers/md/*.h
639
install -Dt "${__builddir}/net/mac80211" -m644 net/mac80211/*.h
640
641
# https://bugs.archlinux.org/task/13146
642
install -Dt "${__builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
643
644
# https://bugs.archlinux.org/task/20402
645
install -Dt "${__builddir}/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
646
install -Dt "${__builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
647
install -Dt "${__builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h
648
649
# https://bugs.archlinux.org/task/71392
650
install -Dt "${__builddir}/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
651
652
find . -name 'Kconfig*' -exec install -Dm644 {} "${__builddir}/{}" \;
653
654
# Remove redundant architectures
655
local __arch
656
for __arch in "${__builddir}/arch/"*/; do
657
[[ ${__arch} = */x86/ ]] && continue
658
_info "Removing '$(basename "${__arch}")'"
659
rm -r "${__arch}"
660
done
661
662
# Remove documentation
663
rm -r "${__builddir}/Documentation"
664
665
# Remove broken symlinks
666
find -L "${__builddir}" -type l -printf "Removing %P\n" -delete
667
668
# Remove loose objects
669
find "${__builddir}" -type f -name '*.o' -printf "Removing %P\n" -delete
670
671
# Strip build tools
672
local __file
673
while read -rd "" __file; do
674
case "$(file -Sib "${__file}")" in
675
application/x-sharedlib\;*) # Libraries (.so)
676
strip -v ${STRIP_SHARED} "${__file}" ;;
677
application/x-archive\;*) # Libraries (.a)
678
strip -v ${STRIP_STATIC} "${__file}" ;;
679
application/x-executable\;*) # Binaries
680
strip -v ${STRIP_BINARIEreS} "${__file}" ;;
681
application/x-pie-executable\;*) # Relocatable binaries
682
strip -v ${STRIP_SHARED} "${__file}" ;;
683
esac
684
done < <(find "${__builddir}" -type f -perm -u+x ! -name vmlinux -print0)
685
686
# Strip vmlinux
687
strip -v ${STRIP_STATIC} "${__builddir}/vmlinux"
688
689
# Add symlink to build directory
690
mkdir -p "${pkgdir}/usr/src"
691
ln -sr "${__builddir}" "${pkgdir}/usr/src/${pkgbase}"
692
}
693
694
pkgname=("${pkgbase}" "${pkgbase}-headers")
695
for _package in "${pkgname[@]}"; do
696
eval "package_${_package}() {
697
$(declare -f "_package${_package#"${pkgbase}"}")
698
_package${_package#"${pkgbase}"}
699
}"
700
done
701
Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-08-03 00:08:14 | LOW | 2 |
| 2026-08-02 00:16:08 | LOW | 2 |
| 2026-08-01 00:11:18 | LOW | 2 |
| 2026-07-31 00:14:10 | LOW | 2 |
| 2026-07-30 00:17:23 | LOW | 2 |
| 2026-07-29 00:25:53 | LOW | 2 |
| 2026-07-28 00:07:28 | LOW | 2 |
| 2026-07-27 00:24:32 | LOW | 2 |
| 2026-07-26 00:07:32 | LOW | 2 |
| 2026-07-25 00:13:44 | LOW | 2 |
| 2026-07-24 00:02:28 | LOW | 2 |
| 2026-07-23 00:14:47 | LOW | 2 |
| 2026-07-22 00:29:32 | LOW | 2 |
| 2026-07-21 00:24:15 | LOW | 2 |
| 2026-07-20 00:19:49 | LOW | 2 |
| 2026-07-19 00:17:08 | LOW | 2 |
| 2026-07-18 00:14:48 | LOW | 2 |
| 2026-07-17 00:06:16 | LOW | 2 |
| 2026-07-16 00:05:41 | LOW | 2 |
| 2026-07-15 00:09:25 | LOW | 2 |