GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — kernel-installer/kernel_installer.sh at main · tmiland/kernel-installer Expand file tree/ Copy pathkernel_installer.shMore file actions executable file ·3483 lines (3293 loc) · 132 KB / Copy pathkernel_installer.shFile metadata and controlsexecutable file ·3483 lines (3293 loc) · 132 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 #!/usr/bin/env bash # shellcheck disable=SC2221,SC2222,SC2181,SC2174,SC2086,SC2046,SC2005,SC2317,SC2329 ## Author: Tommy Miland (@tmiland) - Copyright (c) 2025 ###################################################################### #### Kernel Installer.sh #### #### Automatic kernel install script #### #### Maintained by @tmiland #### ###################################################################### VERSION='1.10.1' #------------------------------------------------------------------------------# # # MIT License # # Copyright (c) 2025 Tommy Miland # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # #------------------------------------------------------------------------------# ## Uncomment for debugging purpose #set -o errexit #set -o pipefail #set -o nounset #set -o xtrace # Set update check UPDATE_SCRIPT=0 # Operation mode: install or uninstall mode=install # Get script filename and directory (resolves symlinks). BASH_SOURCE[0] is # empty when the script is piped in (curl | bash); keep $self empty then, # because readlink -f "" prints nothing with GNU coreutils but the current # directory with uutils coreutils (Ubuntu 26.04). self="" if [[ -n ${BASH_SOURCE[0]} ]]; then self=$(readlink -f "${BASH_SOURCE[0]}") fi SCRIPT_FILENAME=$(basename "$self") SCRIPT_DIR=$(dirname "$self") # Bundled kernel.org signing keys (public) and their pinned primary # fingerprints. Checkout runs import the bundle; piped runs fall back to WKD. KERNEL_KEYRING_FILE=src/keys/kernel.org.asc TORVALDS_FPR=ABAF11C65A2970B130ABE3C479BE3E4300411886 GREGKH_FPR=647F28654894E3BD457199BE38DBBDC86092693E AUTOSIGNER_FPR=B8868C80BA62A1FFFAF5FDA9632D3A06589DA6B1 # CachyOS source + BORE pins. The source tree already carries the CachyOS # base patchset (CONFIG_CACHY); the BORE scheduler is an additional patch. # Bump these together with src/keys/cachyos.asc when moving to a new source. CACHYOS_VERSION=7.3.6 CACHYOS_TAGREL=3 CACHYOS_SRCNAME="cachyos-${CACHYOS_VERSION}-${CACHYOS_TAGREL}" CACHYOS_SOURCE_URL="https://github.com/CachyOS/linux/releases/download/${CACHYOS_SRCNAME}/${CACHYOS_SRCNAME}.tar.gz" CACHYOS_PKGBUILD_REV=25259ced6c7c8c68796d2a47d98cafb96ccdd603 CACHYOS_CONFIG_URL="https://raw.githubusercontent.com/CachyOS/linux-cachyos/${CACHYOS_PKGBUILD_REV}/linux-cachyos/config" CACHYOS_CONFIG_SHA256=32b3c2004bf8640a1a280f0ceeab7a434765eb4d246cb81911ecff112dde6f50 CACHYOS_PATCHES_REV=0551280ade71e606d7df08ca56e4af83c0daf9e5 CACHYOS_BORE_PATCH_URL="https://raw.githubusercontent.com/cachyos/kernel-patches/${CACHYOS_PATCHES_REV}/7.3/sched/0001-bore-cachy.patch" CACHYOS_BORE_PATCH_SHA256=d2eaa8e8dbf1f56bfb304f8b437a7dc30a65408f90a93701367baf8adc2173b4 CACHYOS_BMQ_PATCH_URL="https://raw.githubusercontent.com/cachyos/kernel-patches/${CACHYOS_PATCHES_REV}/7.3/sched/0001-prjc-cachy.patch" CACHYOS_BMQ_PATCH_SHA256=0d3c61ecfc84c4b7064e2336ca2b025fa2fa109bfacb37cf370de885db34ce8c CACHYOS_KEYRING_FILE=src/keys/cachyos.asc CACHYOS_KEY_FINGERPRINTS=( E18447AC260021D31F3FF6C4C8A2A4774B8B63C4 E8B9AA39F054E30E8290D492C3C4820857F654FE ) # linux-hardened variant. The patch is generated against exactly this kernel # version and does not apply to newer stable releases (7.3.4 fails), so the # variant is pinned. Bump the version, tag, and SHA together. HARDENED_VERSION=7.3.1 HARDENED_TAG=v7.3.1-hardened1 HARDENED_PATCH_URL="https://github.com/anthraxx/linux-hardened/releases/download/${HARDENED_TAG}/linux-hardened-${HARDENED_TAG}.patch" HARDENED_PATCH_SHA256=c79c8364dfd3e6a4268f1dfc6e9b220c94776d6aace0a6d61dce135dcbfaead8 # Original command-line arguments (diagnostics and the "run as root" hint) SCRIPT_ARGS="$*" # Logfile (the previous install's log is kept as $LOGFILE.1) # /var/log itself is group-writable on Ubuntu/Mint; the log lives in a # root-only subdirectory instead of next to entries the syslog group can # replace (#64). DEFAULT_LOGFILE=/var/log/kernel-installer/kernel_installer.log LOGFILE=${LOGFILE:-$DEFAULT_LOGFILE} # One installer at a time: two runs would share the build folder and log (#70) LOCK_FILE=${LOCK_FILE:-/run/kernel_installer.lock} # Default processing units (all available) NPROC=${NPROC:-$(nproc)} # Console output level; ignore debug level messages. VERBOSE=${VERBOSE:-0} # Disable debug info since it's enabled by default to speed up kernel compilation ENABLE_DEBUG_INFO=${ENABLE_DEBUG_INFO:-0} # Low latency (Default off) LOWLATENCY=${LOWLATENCY:-0} # Optimization profile (empty = no profile) PROFILE=${PROFILE:-} # Base config for profile builds: running, a path, or none (empty = none) BASE_CONFIG=${BASE_CONFIG:-} # get-verified-tarball (Default: yes; set GET_VERIFIED_TARBALL=0 to skip verification) GET_VERIFIED_TARBALL=${GET_VERIFIED_TARBALL:-1} # Show banners (Default: yes) BANNERS=${BANNERS:-1} # List installed kernels and exit (Default: no) LIST_INSTALLED=${LIST_INSTALLED:-0} # Default Install dir (Default: /opt/linux) INSTALL_DIR=${INSTALL_DIR:-/opt/linux-kernel} INSTALL_DIR_MARKER=".kernel_installer" # kernel.org version banner, fetched once for all the lookups below and with # short timeouts: fetching it per lookup (3 x 4 attempts x 20s) made every # run, even --help, hang for over 4 minutes when kernel.org was unreachable. KERNEL_BANNER=$(curl -fsSL --connect-timeout 5 --max-time 10 --retry 1 --retry-delay 1 \ https://www.kernel.org/finger_banner 2>/dev/null) # https://stackoverflow.com/a/51068988 latest_kernel() { printf '%s\n' "$KERNEL_BANNER" | grep -m1 "$1" | sed -r 's/^.+: +([^ ]+)( .+)?$/\1/' } # Resolve the latest stable CachyOS release and the current config/patch # revisions from the CachyOS repositories. The source tarball is still # GPG-verified; the config and patches are fetched over HTTPS without pinned # SHA256 values, so this mode is not bit-reproducible. resolve_cachyos_latest() { [ "$CACHYOS_LATEST" = "1" ] || return 0 local feed tag command -v "${CURLBIN:-curl}" >/dev/null 2>&1 || fatal "--cachyos-latest requires curl; install curl or use --source cachyos" # The Actions token is scoped to this repository and cannot read CachyOS; # the public releases feed needs no API token and is not rate-limited. feed=$(${CURLBIN:-curl} -fsSL --retry 3 \ "https://github.com/CachyOS/linux/releases.atom" 2>/dev/null) || fatal "Could not query the CachyOS releases; use --source cachyos for the pinned source" tag=$(printf '%s\n' "$feed" | grep -o 'Repository/[0-9]*/cachyos-[^<]*' | sed 's#.*/##' | grep -E '^cachyos-[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$' | sort -V | tail -1) [ -n "$tag" ] || fatal "Could not find a stable CachyOS release" CACHYOS_SRCNAME="$tag" CACHYOS_VERSION=${tag#cachyos-} CACHYOS_TAGREL=${CACHYOS_VERSION##*-} CACHYOS_VERSION=${CACHYOS_VERSION%-*} CACHYOS_SOURCE_URL="https://github.com/CachyOS/linux/releases/download/${CACHYOS_SRCNAME}/${CACHYOS_SRCNAME}.tar.gz" CACHYOS_CONFIG_URL="https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/linux-cachyos/config" CACHYOS_CONFIG_SHA256="" CACHYOS_PATCHES_REV=master CACHYOS_BORE_PATCH_URL="https://raw.githubusercontent.com/cachyos/kernel-patches/master/${CACHYOS_VERSION%.*}/sched/0001-bore-cachy.patch" CACHYOS_BORE_PATCH_SHA256="" CACHYOS_BMQ_PATCH_URL="https://raw.githubusercontent.com/cachyos/kernel-patches/master/${CACHYOS_VERSION%.*}/sched/0001-prjc-cachy.patch" CACHYOS_BMQ_PATCH_SHA256="" log_info "Latest stable CachyOS release: ${CACHYOS_VERSION}-${CACHYOS_TAGREL}" } # Default Kernel version STABLE_VER=$(latest_kernel stable) # Mainline kernel version (set MAINLINE_VER to pin a specific -rc, e.g. in CI) MAINLINE_VER=${MAINLINE_VER:-$(latest_kernel mainline)} # Lonterm kernel version LONGTERM_VER=$(latest_kernel longterm) # Default kernel version without arguments LINUX_VER=${LINUX_VER:-$STABLE_VER} # Default linux version name LINUX_VER_NAME=Stable # Set to 1 when the kernel version is explicitly chosen by the user VER_SELECTED=${VER_SELECTED:-0} # Installed kernel CURRENT_VER=$(uname -r) # Default kexec option KEXEC=${KEXEC:-0} # Default compression - zstd DEFAULT_COMPRESSION=${DEFAULT_COMPRESSION:-zstd} DEF_COM=${DEF_COM:-ZSTD} DEF_COM_NUM=${DEF_COM_NUM:-5} # Repo name for this script REPO_NAME="tmiland/kernel-installer" # Pinned slib.sh revision for the remote fallback (used when running outside a # checkout, e.g. curl | bash). The file is fetched from an immutable commit and # verified against its sha256 before being sourced. # When src/slib.sh changes: run scripts/update-slib.sh (phase 1: vendor and # commit the file), then scripts/update-slib.sh --finalize <commit> (phase 2: # pin SLIB_REV to the pushed commit and refresh SLIB_SHA256). The "slib pin" # CI job fails on main while the pin does not match src/slib.sh. SLIB_REV="e6d7da7" SLIB_SHA256="694784527d354eb264df24e399a693124fe0df6cb5037a7af218677772cf47c5" # Functions url SLIB_URL=https://raw.githubusercontent.com/$REPO_NAME/$SLIB_REV/src/slib.sh # Set default configuration target CONFIG_OPTION=${CONFIG_OPTION:-olddefconfig} # Kernel source: vanilla (kernel.org) or cachyos (pinned CachyOS source) SOURCE=${SOURCE:-vanilla} # Scheduler selection for the CachyOS source: eevdf or bore KERNEL_SCHED=${KERNEL_SCHED:-eevdf} # CPU tuning: generic (portable), native, zen4, x86-64-v3, x86-64-v4 CPU=${CPU:-generic} # Link-time optimization: none, thin, or full (requires clang/lld) LTO=${LTO:-none} MAKE_LLVM=${MAKE_LLVM:-} # Timer frequency override (100/250/300/1000; 500/600/750 on CachyOS) HZ_OVERRIDE=${HZ_OVERRIDE:-} # BBRv3 default TCP congestion control (CachyOS source only) BBR3=${BBR3:-0} # Android Binder IPC and binderfs (Waydroid) BINDER=${BINDER:-0} # sched_ext and BTF for userspace BPF schedulers SCHED_EXT=${SCHED_EXT:-0} # PREEMPT_RT real-time kernel RT=${RT:-0} # linux-hardened variant (vanilla, pinned to HARDENED_VERSION) HARDENED=${HARDENED:-0} # AutoFDO profile path (clang sample-use profile) or a profiling build AUTOFDO_PROFILE=${AUTOFDO_PROFILE:-} AUTOFDO_COLLECT=${AUTOFDO_COLLECT:-0} # Validate the configuration and exit before compiling CONFIG_ONLY=${CONFIG_ONLY:-0} # Resolve the latest stable CachyOS release instead of the pinned source CACHYOS_LATEST=${CACHYOS_LATEST:-0} # Automatic Secure Boot signing: sign the installed kernel and DKMS modules # with the local MOK key when it exists. --no-sign disables it. NO_SIGN=${NO_SIGN:-0} SIGNING_KEY=${SIGNING_KEY:-/var/lib/shim-signed/mok/MOK.priv} SIGNING_CERT=${SIGNING_CERT:-/var/lib/shim-signed/mok/MOK.der} SIGNING_ACTIVE=${SIGNING_ACTIVE:-0} # Optional custom localversion suffix (without or with a leading hyphen) KERNEL_TAG=${KERNEL_TAG:-} # Include functions # Only trust src/slib.sh next to the script when the script itself is a file. # When it is piped in (curl | bash), $self is empty and SCRIPT_DIR would be # the current directory, so a src/slib.sh there must not be sourced. if [[ -n $self && -f $SCRIPT_DIR/src/slib.sh ]]; then # shellcheck disable=SC1091 . "$SCRIPT_DIR/src/slib.sh" else # Running outside a checkout (e.g. curl | bash): fetch the pinned slib.sh # revision and verify its checksum before sourcing it. slib_tmp=$(mktemp) || { echo -e "Could not create a temporary file.\nProcess aborted" exit 1 } if [[ $(command -v 'curl') ]]; then curl -sSLf "$SLIB_URL" > "$slib_tmp" elif [[ $(command -v 'wget') ]]; then wget -qO "$slib_tmp" "$SLIB_URL" else rm -f "$slib_tmp" echo -e "${RED}${BALLOT_X} This script requires curl or wget.\nProcess aborted${NORMAL}" exit 1 fi if ! echo "$SLIB_SHA256 $slib_tmp" | sha256sum -c - >/dev/null 2>&1; then rm -f "$slib_tmp" echo -e "Checksum verification of slib.sh failed, refusing to execute it.\nProcess aborted" exit 1 fi # shellcheck source=/dev/null . "$slib_tmp" rm -f "$slib_tmp" fi # Setup slog # shellcheck disable=SC2034 LOG_PATH="$LOGFILE" # Setup run_ok # shellcheck disable=SC2034 RUN_LOG="$LOGFILE" # Exit on any failure during shell stage # shellcheck disable=SC2034 RUN_ERRORS_FATAL=1 # Console output level; ignore debug level messages. if [ "$VERBOSE" = "1" ]; then # shellcheck disable=SC2034 LOG_LEVEL_STDOUT="DEBUG" else # shellcheck disable=SC2034 LOG_LEVEL_STDOUT="INFO" fi # Log file output level; catch literally everything. # shellcheck disable=SC2034 LOG_LEVEL_LOG="DEBUG" # log_fatal calls log_error log_fatal() { log_error "$1" } fatal() { echo log_fatal "Fatal Error Occurred: $1" printf "%s \\n" "${RED}Cannot continue installation.${NORMAL}" if [ -d "$INSTALL_DIR" ] && is_safe_install_dir "$INSTALL_DIR"; then log_warning "Removing temporary directory and files." remove_install_dir "$INSTALL_DIR" || log_warning "Could not completely remove $INSTALL_DIR." elif [ -d "$INSTALL_DIR" ]; then log_warning "Not removing $INSTALL_DIR: it may contain files not created by this installer." fi log_fatal "If you are unsure of what went wrong, you may wish to review the log" log_fatal "in $LOGFILE" exit 1 } # Make sure an option that takes a value actually got one require_arg() { # $1 = option name, $2 = value if [[ -z $2 ]]; then fatal "${RED}${BALLOT_X}Fatal:${NORMAL} Option $1 requires an argument" fi } # Record the build environment at the top of the log, so a failure report # carries what is needed to diagnose it. log_diagnostics() { local dir=$INSTALL_DIR while [ ! -d "$dir" ] && [ "$dir" != "/" ]; do dir=$(dirname "$dir") done log_debug "Diagnostics: ${SCRIPT_FILENAME:-kernel_installer.sh} ${VERSION}, args: ${SCRIPT_ARGS}" log_debug "Diagnostics: distro: ${DISTRO} (${DISTRO_GROUP}), running kernel: $(uname -srm)" log_debug "Diagnostics: target: ${LINUX_VER_NAME} ${LINUX_VER}, source: ${SOURCE}, sched: ${KERNEL_SCHED}, cpu: ${CPU}, lto: ${LTO}, tag: ${KERNEL_TAG:-auto}, config: ${CONFIG_OPTION}, profile: ${PROFILE:-none}, base config: ${BASE_CONFIG:-none}, custom directives: ${#CUSTOM_CONFIG_OPTIONS[@]}, verified tarball: ${GET_VERIFIED_TARBALL}, jobs: ${NPROC}" log_debug "Diagnostics: running kernel's config: $(ls /boot/config-"$(uname -r)" 2>/dev/null || echo "none")" log_debug "Diagnostics: $(gcc --version 2>/dev/null | head -n 1 || echo 'gcc: not found'); $(make --version 2>/dev/null | head -n 1); $(ld --version 2>/dev/null | head -n 1)" log_debug "Diagnostics: memory: $(awk '/^MemTotal:|^MemAvailable:/ {printf "%s %d MiB ", $1, $2 / 1024}' /proc/meminfo 2>/dev/null)" log_debug "Diagnostics: disk free for ${INSTALL_DIR}: $(df -Pk "$dir" 2>/dev/null | awk 'NR == 2 {printf "%d MiB on %s", $4 / 1024, $6}')" } # Explain a failed kernel build: show the first real error in the build # output instead of the tail, which only holds make's generic "Error 2" lines # (see issue #12). $1 = line count of $RUN_LOG before the build started. report_build_failure() { local start=$1 line='' hint='' from='' first='' # A shell or make could not run a program at all (dash, bash, make exec); # unlike "fatal error: foo.h: No such file or directory", a missing header local missing_cmd='^(/usr)?/bin/(ba|da)?sh: (line )?[0-9]+: .*not found$|^make([[][0-9]+[]])?: [^ ]+: No such file or directory$' line=$(awk -v start="$start" -v missing="$missing_cmd" ' NR <= start { next } /^dpkg-buildpackage: error:/ { next } # log lines written by this script ("[2026-01-01 12:00:00 CET] [ERROR] ..."), # also when run_ok appends one to its "message: " prefix /\[[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9:]+ [^]]*\] \[[A-Z]+\]/ { next } $0 ~ missing || /internal compiler error|Killed signal terminated program|No space left on device|mktemp: .*failed to create|No rule to make target|fatal error:|undefined reference to|(^|[^[:alpha:]])error:/ { print NR; exit }' "$RUN_LOG" 2>/dev/null) echo if [ -z "$line" ]; then log_error "Kernel build failed, and no error message was found in the build output; see ${RUN_LOG}." else log_error "Kernel build failed. First error in the build output (${RUN_LOG}, line ${line}):" # Two lines of context above (never from before the build), three below from=$((line - 2 > start ? line - 2 : start + 1)) sed -n "${from},$((line + 3))p" "$RUN_LOG" | sed 's/^/ /' first=$(sed -n "${line}p" "$RUN_LOG") case "$first" in *"internal compiler error"* | *"Killed signal terminated program"*) hint="The compiler itself crashed or was killed (often for lack of memory); this is not a bug in the kernel source. Retry with fewer jobs (--nproc). If it fails in a different file each time, suspect RAM or overclocking; if it fails in the same place, try another kernel version or compiler." ;; *"No space left on device"*) hint="The disk holding ${INSTALL_DIR} is full. Free some space or build elsewhere with --dir." ;; *".pem"* | *"certs/"*) hint="The kernel configuration points at a certificate file that does not exist in the kernel.org source (distribution configs set CONFIG_SYSTEM_TRUSTED_KEYS / CONFIG_SYSTEM_REVOCATION_KEYS). Clear them with: --custom-config 'scripts/config --set-str SYSTEM_TRUSTED_KEYS \"\"' --custom-config 'scripts/config --set-str SYSTEM_REVOCATION_KEYS \"\"'" ;; *) if [[ $first =~ $missing_cmd ]]; then hint="A program the kernel build runs is not installed (it is named on the error line). Install it and run the script again." fi ;; esac if [ -n "$hint" ]; then log_error "Hint: ${hint}" fi fi log_error "The build tree is kept in ${INSTALL_DIR} for inspection (it is removed on the next run)." } # Refuse to start while another run holds the lock. This deliberately does not # go through fatal(): fatal removes INSTALL_DIR, which would delete the build # tree of the run that currently holds the lock. take_lock() { if ! command -v flock >/dev/null 2>&1; then printf 'Cannot start: flock (util-linux) is not installed.\n' >&2 exit 1 fi if [ ! -d "$(dirname -- "$LOCK_FILE")" ]; then LOCK_FILE=/var/lock/kernel_installer.lock fi if ! exec 9>>"$LOCK_FILE"; then printf 'Cannot open lock file %s.\n' "$LOCK_FILE" >&2 exit 1 fi if ! flock -n 9; then printf 'Another kernel_installer run is already in progress (lock: %s).\n' "$LOCK_FILE" >&2 exit 1 fi } # Validate the log path before root appends to it or renames it to .1. The # default lives in a 0700 root-owned directory; a custom LOGFILE must not be a # symlink, must not be a file owned by someone else, and must not sit in a # directory other users can write to (#64). chk_logfile() { local log=${1:-$LOGFILE} dir mode dir=$(dirname -- "$log") if [ -L "$log" ]; then fatal "Log file $log is a symlink; refusing to write through it." fi if [ -e "$log" ] && { [ ! -f "$log" ] || [ ! -O "$log" ]; }; then fatal "Log file $log is not a regular file owned by the current user; refusing to use it." fi if [ -L "$log.1" ]; then fatal "Previous log $log.1 is a symlink; refusing to rotate onto it." fi if [ -e "$log.1" ] && { [ ! -f "$log.1" ] || [ ! -O "$log.1" ]; }; then fatal "Previous log $log.1 is not a regular file owned by the current user; refusing to replace it." fi if [ ! -d "$dir" ]; then if [[ $log == "$DEFAULT_LOGFILE" ]]; then if ! mkdir -p -m 0700 -- "$dir"; then fatal "Could not create log directory $dir." fi else fatal "Log directory $dir does not exist." fi fi if [ -L "$dir" ]; then fatal "Log directory $dir is a symlink; refusing to use it." fi mode=$(stat -c '%a' -- "$dir" 2>/dev/null) || fatal "Could not read the permissions of log directory $dir." if (( (8#$mode & 0022) != 0 )); then fatal "Log directory $dir is writable by group or others; use $DEFAULT_LOGFILE or a directory only root can write to." fi if [[ $log == "$DEFAULT_LOGFILE" ]]; then if [ ! -O "$dir" ]; then fatal "Log directory $dir is not owned by the current user." fi if (( (8#$mode & 0077) != 0 )); then fatal "Log directory $dir must not be accessible by group or others; run: chmod 700 $dir" fi fi } # Start an install with an empty log and keep the previous one as # $LOGFILE.1, so a failed build's log survives the next run (#53). rotate_log() { if [ -f "$LOGFILE" ]; then mv -f -- "$LOGFILE" "$LOGFILE.1" fi } # A directory is safe to reuse (and wipe) when it does not exist yet, is # empty, or was created by this installer in a previous run (marker present). is_safe_install_dir() { local dir="$1" if [ -z "$dir" ] || [ "$dir" = "/" ] || [ ! -d "$dir" ]; then return 1 fi if [ -L "$dir" ]; then return 1 fi if [ -e "$dir/$INSTALL_DIR_MARKER" ]; then return 0 fi if [ -z "$(find "$dir" -mindepth 1 -maxdepth 1 -print -quit 2>/dev/null)" ]; then return 0 fi return 1 } # Delete a build directory this installer owns, removing the marker last so an # interrupted delete leaves a folder the next run can still recognise (#69). remove_install_dir() { local dir=$1 if [ -z "$dir" ] || [ "$dir" = "/" ] || [ ! -d "$dir" ]; then return 1 fi if ! find "$dir" -mindepth 1 ! -name "$INSTALL_DIR_MARKER" -delete; then return 1 fi rm -f -- "$dir/$INSTALL_DIR_MARKER" || return 1 rmdir -- "$dir" 2>/dev/null || true return 0 } # Create a fresh build directory for this run. Refuse symlinks, folders owned # by another user, and shared parents another user can replace entries in: the # tree is built as root, so a nested attacker-controlled folder would let them # swap the tarball or source between verification and the build (#62). prepare_install_dir() { local dir=$INSTALL_DIR parent parent_uid caller_uid mode parent=$(dirname -- "$dir") if [ ! -d "$parent" ]; then # Create the parent private from the start. With the default root umask # 002 a plain `mkdir -p` would create 0775, which the check below then # rejects (the installer would create the directory and refuse it). if ! mkdir -p -m 0700 -- "$parent"; then fatal "Could not create install directory parent $parent" fi fi if [ -L "$parent" ]; then fatal "Install directory parent $parent is a symlink; refusing to use it." fi mode=$(stat -c '%a' -- "$parent" 2>/dev/null) || fatal "Could not read the permissions of $parent." # A non-sticky group/other-writable parent lets another user rename or # replace the build folder; sticky shared folders (/tmp, /var/tmp) do not. if (( (8#$mode & 0022) != 0 && (8#$mode & 01000) == 0 )); then fatal "Install directory parent $parent is writable by group or others and is not sticky; run: chmod 700 $parent (or choose a private --dir)" fi parent_uid=$(stat -c '%u' -- "$parent" 2>/dev/null) || fatal "Could not read the owner of $parent." caller_uid=${SUDO_UID:-$(id -u)} if [ "$parent_uid" != "0" ] && [ "$parent_uid" != "$caller_uid" ]; then fatal "Install directory parent $parent is owned by another user; choose a directory you own." fi if [ -e "$dir" ] || [ -L "$dir" ]; then if ! is_safe_install_dir "$dir"; then fatal "Install directory $dir is not empty and does not look like it was created by this script. Refusing to delete its contents; use an empty directory or clean it up yourself." fi if ! remove_install_dir "$dir"; then fatal "Could not remove the previous build directory $dir." fi fi if ! mkdir -m 0755 -- "$dir"; then fatal "Could not create install directory $dir" fi if [ -L "$dir" ] || [ ! -O "$dir" ]; then fatal "Install directory $dir is not owned by the current user; refusing to build in it." fi mode=$(stat -c '%a' -- "$dir" 2>/dev/null) || fatal "Could not read the permissions of $dir." if (( (8#$mode & 0022) != 0 )); then fatal "Install directory $dir is writable by group or others; refusing to build in it." fi if ! touch -- "$dir/$INSTALL_DIR_MARKER"; then fatal "Could not create the marker file in $dir" fi } read_sleep() { read -rt "$1" <> <(:) || : } # Read the user's answer into variable $1; the remaining arguments go to read # (e.g. -p prompt). When the script itself is piped in (curl | bash, $self is # empty), stdin is the rest of the script, so read from the terminal instead # and leave the answer empty if there is none. Otherwise read stdin as usual, # so answers can still be piped in (yes | ./kernel_installer.sh ...). ask() { local __var=$1 __reply='' shift if [ -n "$self" ]; then read -r "$@" __reply elif { : </dev/tty; } 2>/dev/null; then read -r "$@" __reply </dev/tty fi printf -v "$__var" '%s' "$__reply" } # Make sure that the script runs with root permissions chk_permissions() { # Only root can run this if [[ "$EUID" != 0 ]]; then local hint if [[ -n "$SCRIPT_FILENAME" ]]; then hint="Run it again as root: sudo bash ${SCRIPT_FILENAME}${SCRIPT_ARGS:+ ${SCRIPT_ARGS}}" else # A piped run cannot rerun itself; $self is empty there on purpose hint="Run it again as root: replace 'bash' with 'sudo bash' in the download command" fi fatal "${RED}${BALLOT_X}Fatal:${NORMAL} The ${SCRIPT_FILENAME:-kernel_installer.sh} script must be run as root. ${hint}" fi } # Kernel release (uname -r, package names) built from a kernel.org version. # The Makefile always has a SUBLEVEL, so 7.3 builds 7.3.0 and 7.3-rc7 builds # 7.3.0-rc7; versions that already have one (6.12.113, 7.0.0-38-generic) are # returned unchanged. kernel_release() { local base=${1%%-*} local extra=${1#"$base"} if [[ $base =~ ^[0-9]+\.[0-9]+$ ]]; then base=$base.0 fi echo "${base}${extra}" } # Print the installed package <name>-<release> (name: linux-image, # linux-headers, kernel, kernel-devel); fails if it is not installed. # binrpm-pkg writes - as _ in the rpm version (kernel-7.3.0_rc7) while distro # kernels keep it (kernel-6.17.1-300.fc44.x86_64), so rpm tries both. installed_kernel_pkg() { local name=$1 release=$2 pkg local -a candidates=("$name-$release") if [[ $DISTRO_GROUP == "RHEL" ]]; then candidates+=("$name-${release//-/_}") fi for pkg in "${candidates[@]}"; do if ${PKGCHK} "$pkg" >/dev/null 2>&1; then echo "$pkg" return 0 fi done return 1 } # Kernel release the configured tree builds, CONFIG_LOCALVERSION included # (6.12.113-test). mkdebian and kernel.spec name the packages after exactly # this release, so it is what the install path has to follow (#49). Prints # nothing and returns non-zero when the tree cannot answer (not configured # yet, no Makefile). built_kernelrelease() { local release # kernelrelease is a no-sync-config target: it runs scripts/setlocalversion, # which reads include/config/auto.conf but never refreshes it from .config. # The profile and --kernel-tag edits happen after the last syncconfig, so a # stale or missing auto.conf answers without the localversion (7.3.4 instead # of 7.3.4-cachyos-workstation-bore-lto) or fails outright. Force a resync # first; the tree then names exactly the release mkdebian and kernel.spec # used for the packages (#74). release=$( cd "$1" 2>/dev/null || exit 1 touch .config 2>/dev/null || exit 1 # shellcheck disable=SC2086 ${MAKE_LLVM:+$MAKE_LLVM }make -s syncconfig >/dev/null 2>&1 || exit 1 # shellcheck disable=SC2086 ${MAKE_LLVM:+$MAKE_LLVM }make -s kernelrelease 2>/dev/null ) || return 1 [[ -n $release ]] || return 1 printf '%s\n' "$release" } # Release from the built image package, linux-image-<release>_<version>_<arch>.deb. # mkdebian names the package after the release the configured tree built, so the # package itself is the ground truth for the install path (#74). built_deb_release() { local dir=${1:-.} deb release for deb in "$dir"/linux-image-*.deb; do [ -e "$deb" ] || continue release=${deb##*/} # mkdebian names the debug package linux-image-<release>-dbg; it carries a # different suffix and must not win the release lookup. case $release in *-dbg_*) continue ;; esac release=${release#linux-image-} release=${release%%_*} [ -n "$release" ] || continue printf '%s\n' "$release" return 0 done return 1 } # Kernel release derived from the top-level Makefile, # VERSION.PATCHLEVEL.SUBLEVEL+EXTRAVERSION. It carries the -rc suffix # (7.3-rc7 -> 7.3.0-rc7) but not CONFIG_LOCALVERSION, which only the # configured tree knows (#49). get_linux_full_ver() { # SUBLEVEL is always present in the Makefile (VERSION and PATCHLEVEL are on # the first line, SUBLEVEL on the third, so awk always has $3) awk '/^VERSION =/ { v = $3 } /^PATCHLEVEL =/ { p = $3 } /^SUBLEVEL =/ { s = $3 } /^EXTRAVERSION =/ { x = $3 } END { print v "." p "." s x }' "$1" } # Installed kernel packages named <name>-<release> plus a localversion suffix # (linux-image-6.12.113-test). The suffix is a config decision of the build # that installed them, so it can only be found by matching the installed # packages against the release prefix (#49). Every match is printed on its own # line; a following digit is not a suffix but a different version. installed_kernel_pkgs_localversion() { local name=$1 release=$2 pattern installed local -a grep_args=() pattern="${name}-${release}" pattern=${pattern//./\\.} grep_args=(-E -e "^${pattern}([^0-9].*)?$") if [[ $DISTRO_GROUP == "RHEL" ]]; then # The rpm version has - rewritten to _ (kernel-6.12.113_test) grep_args+=(-e "^${pattern//-/_}([^0-9].*)?$") installed=$(rpm -qa 2>/dev/null || true) else installed=$(dpkg-query -f '${binary:Package}\n' -W 2>/dev/null || true) fi grep "${grep_args[@]}" <<<"$installed" | sort -u } chk_kernel() { # Check if kernel is installed, abort if same version is found local release image_pkg release=$(kernel_release "$LINUX_VER") if [[ $DISTRO_GROUP == "RHEL" ]]; then image_pkg=kernel else image_pkg=linux-image fi # Only exact names are matched here: a kernel built with a localversion is # installed as <release><suffix> (6.12.113-test), and a prefix match would # also catch unrelated distribution kernels (6.12.113-generic, -300.fc44), # aborting on a build that installs next to them (#49). Pass the full # release (-k 6.12.113-test) to have it recognised. if [ "$CURRENT_VER" = "$release" ] || installed_kernel_pkg "$image_pkg" "$release" >/dev/null; then echo ask YESNO -e -p "${YELLOW}Linux kernel ${LINUX_VER} is already installed, install anyways?${NORMAL} [y/N]: " case ${YESNO,,} in y | yes) return ;; *) fatal "${RED}${BALLOT_X} Kernel ${LINUX_VER} is already installed. Process aborted${NORMAL}" ;; esac fi } # A kernel version is digits.digits plus an optional release suffix such as # -rc7, -38-generic or -300.fc44.x86_64. Only these characters are used: the # version is pasted into run_ok commands (which eval), so shell metacharacters, # spaces and path separators must never get through (#63). valid_kernel_version() { [[ $1 =~ ^[0-9]+\.[0-9]+[0-9A-Za-z.+~_-]*$ ]] } # Make sure a valid kernel version was determined before doing anything destructive chk_version() { if ! valid_kernel_version "$LINUX_VER"; then fatal "${RED}${BALLOT_X}Fatal:${NORMAL} Could not determine a valid kernel version (got: '${YELLOW}${LINUX_VER}${NORMAL}'). Check your network connection or specify a version with ${CYAN}--kernel${NORMAL}." fi } # Turn debug info off in .config (current directory = kernel tree). # From 5.18, "Debug information" is a choice (DEBUG_INFO_NONE, # DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT, DEBUG_INFO_DWARF4, DEBUG_INFO_DWARF5): # enabling NONE alone leaves e.g. Ubuntu's DWARF5=y in place, and with two # members at y olddefconfig keeps DWARF5, so every other member is disabled. # $1 = kernel version disable_debug_info() { if [ "$(versionToInt "$1")" -ge "$(versionToInt 5.18)" ]; then scripts/config --enable DEBUG_INFO_NONE \ --disable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \ --disable DEBUG_INFO_DWARF4 \ --disable DEBUG_INFO_DWARF5 else scripts/config --set-val DEBUG_INFO n scripts/config --set-val DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT n fi } versionToInt() { echo "$@" | awk -F "." '{ printf("%03d%03d%03d", $1,$2,$3); }'; } # Distribution configs copied from /boot (Ubuntu, Mint) point the trusted # and revoked key lists at certificate files from the distribution's own # kernel tree (debian/canonical-certs.pem), so a kernel.org tree stops with # "No rule to make target". Clear a key list whose file does not exist; # paths are relative to the kernel source tree (the current directory). clear_missing_cert_keys() { local key cert for key in SYSTEM_TRUSTED_KEYS SYSTEM_REVOCATION_KEYS; do cert=$(scripts/config --state "$key") case "$cert" in "" | n | undef) continue ;; esac if [ ! -f "$cert" ]; then log_warning "CONFIG_${key} points at ${cert}, which is not in the kernel source; clearing it." scripts/config --set-str "$key" "" fi done } # --- Optimization profiles --- # Profiles are config deltas applied after the kernel's base configuration. # They deliberately avoid symbols that need an out-of-tree patchset (BORE, # CACHY) or DEBUG_INFO_BTF (sched_ext); those are separate opt-ins. profile_cfg() { log_debug "Profile ${PROFILE}: scripts/config $*" scripts/config "$@" } profile_kernel_ge() { [ "$(versionToInt "$1")" -ge "$(versionToInt "$2")" ] } profile_set_hz() { local hz=$1 other profile_cfg --set-val HZ "$hz" profile_cfg --enable "HZ_${hz}" for other in 100 250 300 1000; do [ "$other" = "$hz" ] || profile_cfg --disable "HZ_${other}" done } profile_set_preempt_full() { profile_cfg --enable PREEMPT_DYNAMIC profile_cfg --enable PREEMPT profile_cfg --disable PREEMPT_LAZY profile_cfg --disable PREEMPT_VOLUNTARY profile_cfg --disable PREEMPT_NONE } profile_set_preempt_relaxed() { local lazy_state profile_cfg --enable PREEMPT_DYNAMIC profile_cfg --disable PREEMPT lazy_state=$(scripts/config --state PREEMPT_LAZY) if [ "$lazy_state" != "undef" ]; then profile_cfg --disable PREEMPT_VOLUNTARY profile_cfg --disable PREEMPT_NONE profile_cfg --enable PREEMPT_LAZY else profile_cfg --disable PREEMPT_LAZY profile_cfg --disable PREEMPT_NONE profile_cfg --enable PREEMPT_VOLUNTARY fi } profile_set_thp_madvise() { profile_cfg --enable TRANSPARENT_HUGEPAGE profile_cfg --enable TRANSPARENT_HUGEPAGE_MADVISE profile_cfg --disable TRANSPARENT_HUGEPAGE_ALWAYS } profile_set_lru_gen() { if profile_kernel_ge "$LINUX_VER" 6.1; then profile_cfg --enable LRU_GEN profile_cfg --enable LRU_GEN_ENABLED else log_info "LRU_GEN is not available before Linux 6.1; skipping" fi } profile_set_bbr() { profile_cfg --enable TCP_CONG_BBR profile_cfg --enable NET_SCH_FQ } profile_set_bbr_default() { profile_cfg --disable DEFAULT_CUBIC profile_cfg --enable DEFAULT_BBR profile_cfg --set-str DEFAULT_TCP_CONG bbr } profile_set_o2() { profile_cfg --enable CC_OPTIMIZE_FOR_PERFORMANCE profile_cfg --disable CC_OPTIMIZE_FOR_PERFORMANCE_O3 } profile_set_cgroup() { profile_cfg --enable PSI profile_cfg --enable CGROUPS profile_cfg --enable MEMCG profile_cfg --enable BPF_SYSCALL profile_cfg --enable BPF_JIT profile_cfg --enable CGROUP_BPF profile_cfg --enable FAIR_GROUP_SCHED profile_cfg --enable CFS_BANDWIDTH profile_cfg --enable SCHED_AUTOGROUP } profile_common() { profile_set_thp_madvise profile_set_lru_gen profile_cfg --enable PSI profile_cfg --enable ZRAM profile_set_bbr } # Balanced interactive desktop: low timer latency, full preemption, MGLRU, # THP madvise, BBR and O3 (the CachyOS-style compiler choice). profile_desktop() { profile_common profile_set_hz 1000 profile_set_preempt_full profile_set_o2 } # Build-heavy interactive desktop (LLM/Android builds): the desktop profile # plus the cgroup knobs needed to keep builds in their own slice, and BBR as # the default congestion control. profile_workstation() { profile_desktop profile_set_cgroup profile_set_bbr_default } # Same timer/scheduler trade-off as desktop; kept separate so a gaming profile # can grow scheduler-specific options without changing daily-driver defaults. profile_gaming() { profile_desktop } # Throughput server: 250 Hz, relaxed preemption, O2, BBR default, and the # group-scheduling knobs systemd needs for per-service CPU limits. profile_server() { profile_common profile_set_hz 250 profile_set_preempt_relaxed profile_set_o2 profile_set_cgroup profile_cfg --set-val NR_CPUS 256 profile_set_bbr_default } # Battery/thermal profile: 300 Hz, relaxed preemption, schedutil, P-state, # the energy model, MGLRU and zram-friendly memory defaults. profile_laptop() { profile_common profile_set_hz 300 profile_set_preempt_relaxed profile_set_o2 profile_cfg --enable CPU_FREQ_DEFAULT_GOV_SCHEDUTIL profile_cfg --enable X86_AMD_PSTATE profile_cfg --enable X86_INTEL_PSTATE profile_cfg --enable ENERGY_MODEL } # Legacy --lowlatency behavior. This is low-latency, not PREEMPT_RT. profile_lowlatency() { profile_set_hz 1000 profile_set_preempt_full profile_cfg --enable LATENCYTOP profile_cfg --disable COMEDI_TESTS_EXAMPLE profile_cfg --disable COMEDI_TESTS_NI_ROUTES profile_cfg --set-val TEST_DIV64 m } profile_is_valid() { case "$1" in desktop | workstation | gaming | server | laptop | lowlatency) return 0 ;; *) return 1 ;; esac } build_kernel_tag() { [ -n "$KERNEL_TAG" ] && return 0 local tag="" if [ "$SOURCE" = "cachyos" ]; then tag="-cachyos" elif [ -n "$PROFILE" ]; then tag="-vanilla" fi [ -n "$PROFILE" ] && tag+="-$PROFILE" [ "$KERNEL_SCHED" != "eevdf" ] && tag+="-$KERNEL_SCHED" [ "$CPU" != "generic" ] && tag+="-$CPU" case "$LTO" in thin) tag+="-lto" ;; full) tag+="-ltofull" ;; esac [ -n "$HZ_OVERRIDE" ] && tag+="-hz${HZ_OVERRIDE}" [ "$BBR3" = "1" ] && tag+="-bbr3" [ "$BINDER" = "1" ] && tag+="-binder" [ "$SCHED_EXT" = "1" ] && tag+="-sched-ext" [ "$RT" = "1" ] && tag+="-rt" [ -n "$AUTOFDO_PROFILE" ] && tag+="-autofdo" [ "$AUTOFDO_COLLECT" = "1" ] && tag+="-autofdo-collect" KERNEL_TAG="$tag" } apply_profile() { case "$1" in desktop) profile_desktop ;; workstation) profile_workstation ;; gaming) profile_gaming ;; server) profile_server ;; laptop) profile_laptop ;; lowlatency) profile_lowlatency ;; *) fatal "Unknown optimization profile: $1" ;; esac } # Fail the build if a profile symbol did not survive olddefconfig. This is # what catches a profile that was silently dropped by a Kconfig dependency. profile_assert() { local spec sym want got for spec in "$@"; do sym=${spec%%=*} want=${spec#*=} got=$(scripts/config --state "$sym") if [ "$got" != "$want" ]; then fatal "Profile ${PROFILE}: CONFIG_${sym} is '${got}', expected '${want}'" fi done } assert_profile() { local -a common=( ZRAM=y TCP_CONG_BBR=y NET_SCH_FQ=y ) # BMQ replaces CFS and makes PSI unavailable (Kconfig depends on !SCHED_ALT). [ "$KERNEL_SCHED" != "bmq" ] && common+=(PSI=y) # TRANSPARENT_HUGEPAGE depends on !PREEMPT_RT, so it cannot be asserted on # an RT kernel; olddefconfig drops the profile's THP settings. |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |