# Compiling Time: 46.76 SBU # Maintainer: James Buren # Contributor: Miklos Vajna ### NOTE: check btrfs-progs to match the kernel ## set to y to generate configs ## the build will die after patching USE_MAKE_CONFIG=${USE_MAKE_CONFIG:-"n"} Finclude kernel ## ZFS sh** ## *** This kernel has unused symbols trimming enabled, please disable. ## *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set. ## check in >=4.16.x , is being working on ## DO NOT enable CONFIG_SP5100_TCO until ## https://bugzilla.kernel.org/show_bug.cgi?id=114201 is *really* resolved ## it kills lots AMD based systems off ## DO NOT enable any CONFIG_GOLDFISH , CONFIG_*_GOLDFISH the driver is broken ## once a decision is made upstream we may re-enbale but for now just don't ## check in >=4.15.x - some fixes in tip/* ## DO NOT enable any X86_5LEVEL CONFIG .. this is a feature Intel CPUs ## will have sometime BUT if you enable such a kernel won't boot on any other BOX! ## DO NOT enable CONFIG_MQ_IOSCHED_KYBER , on my EPYC box it corrupts ## any FS in about seconds on NVMe's , need to investigate -- crazy -- ## ENABLE in 14.15 .. ## BPF speculation prevention ( spectre v2 part ) -> CONFIG_BPF_JIT_ALWAYS_ON url="https://www.kernel.org" depends=('kmod' 'sed') makedepends+=('bison' 'rsync') [[ -z "$_F_kernel_name" ]] && makedepends+=('unifdef') groups=('base') archs=('x86_64') ## Do NOT remove noccache here options+=('nodocs' 'genscriptlet' 'noccache') _F_archive_grepv="rc" up2date="Flasttar $url" _F_kernel_patches=( ## disable verbose output in normal mode ath10k-be-quiet.patch ## this one is just for NCQ stuff for now ata-fix-NCQ-LOG-strings-and-move-to-debug.patch ## wrong used there radeon_dp_aux_transfer_native-no-ratelimited_debug.patch ## WELL! while technically is an BUG the KERN_ERR is nonsense here while ## all it does is to break silent boot. If is an bug will break the kernel ## it will break anyway , no matter the error level. acpi-use-kern_warning_even_when_error.patch ## mute crap from ath* driver ## Please do not remove , not upstream yet Unknow-SSD-HFM128GDHTNG-8310B-QUIRK_NO_APST.patch ## Broken SUBNQN on Viper VPN100 nvme-Patriot_Viper_VPN100-QUIRK_IGNORE_DEV_SUBNQN.patch ## No that is just insanity.. turn that warn into debug ## 'XXX filesystem being mounted at XXXX supports timestamps until 2038' ## is just 2020 so flooding for 18 years with this on each mount AND/OR remount?. C'mon! do_not_bug_the_next_18-years.patch ## -> dmesg | grep -E 'Applying debug destination|FW already configured' iwlwifi-use-debug-for-debug-infos.patch ## somewhat broken fix-bootconfig-makefile.patch bootconfig-fallthrough.patch ## While meant to me informative for admins that code floods ## with lots false positive even. IOW, is more confusing than informative. ## Not so funny on large boxes. Turn the pr_warn() into pr_debug() apic_vector-spam-in-debug-mode-only.patch ## Fix iwlwifi bad reporting of Intel/Killer chips iwlwifi-fix-5e003982b07ae.patch ## fix HDMI sound bc of somewhat wrong BIOS ## See: https://forums.lenovo.com/t5/ThinkPad-T400-T500-and-newer-T-series-Laptops/T14s-AMD-no-HDMI-audio-on-Linux/m-p/5081195?page=1 #rn-pci-acp3x.c_blacklist_dmic_for_P14s_T14s_Campus.patch ## revert forced default schedutil governor if Intel Pstae driver is enabled ## this is crazy stuff and need an bug report 0001-Revert-cpufreq-Avoid-configuring-old-governors-as-de.patch revert-parts-of-a00ec3874e7d326ab2dffbed92faddf6a77a84e9-no-Intel-NO.patch k10temp-frugalware.patch ## UKMS Patchset https://raw.githubusercontent.com/dolohow/uksm/master/v5.x/uksm-5.13.patch ) for ppatch in "${_F_kernel_patches[@]}" do source+=("$ppatch") signatures+=('') done source+=("https://www.kernel.org/pub/linux/kernel/v5.x/$_F_archive_name-$pkgver.tar.xz" 'config.x86_64') signatures+=("https://www.kernel.org/pub/linux/kernel/v5.x/$_F_archive_name-$pkgver.tar.sign" '') conflicts=('wireguard-linux-compat') replaces=('wireguard-linux-compat') provides=('wireguard-linux-compat') subpkgs=('cpupower') subdescs=('Kernel cpu powersaving tool') subrodepends=("kernel=$_F_kernelver_ver") subdepends=('pciutils') subgroups=('apps-extra') subarchs=('x86_64') subbackup=('etc/sysconfig/cpupower') subconflicts=('cpufrequtils') subprovides=('cpufrequtils') subreplaces=('cpufrequtils') suboptions=('') subinstall=('') source+=("cpupower" "cpupower.sh" "cpupower.service") signatures+=('' '' '') makedepends+=('gettext') subpkgs+=('x86_energy_perf_policy') subdescs+=('Kernel tool for setting MSR energy policies') subrodepends+=("kernel=$_F_kernelver_ver") subdepends+=('pciutils') subgroups+=('apps-extra') subarchs+=('x86_64') subbackup+=('') subconflicts+=('') subprovides+=('') subreplaces+=('') suboptions+=('') subinstall+=('') subpkgs+=('bootconfig') subdescs+=('Kernel tool for appending cmd line options to a initrd.') subrodepends+=("kernel=$_F_kernelver_ver") subdepends+=('') subgroups+=('apps-extra') subarchs+=('x86_64') subbackup+=('') subconflicts+=('') subprovides+=('') subreplaces+=('') suboptions+=('') subinstall+=('') subpkgs+=('perf') subdescs+=('Kernel performance profiling tool') subrodepends+=("kernel=$_F_kernelver_ver") subdepends+=('elfutils slang binutils>=2.35.1 xz python') subgroups+=('devel-extra') subarchs+=('x86_64') subbackup+=('') subconflicts+=('') subprovides+=('') subreplaces+=('') suboptions+=('') subinstall+=('') subpkgs+=("kernel$_F_kernel_name-docs") subdescs+=("Linux kernel documentation") subrodepends+=("kernel=$_F_kernelver_ver") subdepends+=('') subgroups+=('devel-extra') subarchs+=('x86_64') subbackup+=('') subconflicts+=('') subprovides+=('') subreplaces+=('') suboptions+=('') subinstall+=('') subpkgs+=("kernel$_F_kernel_name-source") subrodepends+=("make gcc>=6.2.1 kernel-headers") subdescs+=('Linux kernel source') subgroups+=('devel-extra chroot-core') subdepends+=('') subreplaces+=('') subprovides+=('') subconflicts+=('') subarchs+=('x86_64') subbackup+=('') subinstall+=('') suboptions+=('nodocs') if [ -z "$_F_kernel_name" ]; then subpkgs+=('kernel-headers') subrodepends+=('') subgroups+=('devel devel-core') subdescs+=('Linux kernel include files') subarchs+=('x86_64') subbackup+=('') subinstall+=('') suboptions+=('') subreplaces+=('') subdepends+=('') subprovides+=('') subconflicts+=('') fi kmake() { make -j $(getconf _NPROCESSORS_ONLN) "$@" } build() { Fcd Fexec kmake clean || Fdie if [ -e "$Fsrcdir/config.$CARCH" ]; then Fexec cp $Fsrcdir/config.$CARCH .config || Fdie else Fmessage "Cannot find a valid config.." exit 1 fi # not using Fpatchall here since not applying the patches from # _F_kernel_patches() having the wrong extension would be stange :) local i for i in "${_F_kernel_patches[@]}" do Fpatch `strip_url $i` done if Fuse $USE_MAKE_CONFIG; then Fdie fi if [ -z "$_F_kernel_name" -a $_F_kernel_dontfakeversion -eq 0 ]; then # stock kernel, nobody interested in the buildsystem's detail export KBUILD_BUILD_USER="fst" export KBUILD_BUILD_HOST="`uname -m`.frugalware.org" fi # remove unneded localversions rm -fv localversion-* rm -fv ../*.{gz,bz2,sign} yes "" | kmake config if [ $_F_kernel_dontfakeversion -eq 0 ]; then if [ "${_F_kernel_ver#*.*.}" = "$_F_kernel_ver" ]; then # If patten match fails, sublevel version is missing Fsed "SUBLEVEL =.*" "SUBLEVEL =" Makefile else Fsed "SUBLEVEL =.*" "SUBLEVEL = ${_F_kernel_ver#*.*.}" Makefile fi Fsed "EXTRAVERSION =.*" "EXTRAVERSION = $_F_kernel_uname" Makefile else Fexec kmake include/config/kernel.release unset _F_kernel_ver _F_kernel_uname=$(cat include/config/kernel.release) fi ## let we do kernel$_F_kernel_name-source before make Fmkdir /usr/src Fexec cp -Ra $Fsrcdir/linux-$_F_kernelver_ver $Fdestdir/usr/src/linux-$_F_kernel_ver$_F_kernel_uname || Fdie Fln linux-$_F_kernel_ver$_F_kernel_uname /usr/src/linux Fexec kmake -C $Fdestdir/usr/src/linux-$_F_kernel_ver$_F_kernel_uname scripts || Fdie Fexec kmake -C $Fdestdir/usr/src/linux-$_F_kernel_ver$_F_kernel_uname prepare || Fdie Fexec rm -rfv $Fdestdir/usr/src/linux-$_F_kernel_ver$_F_kernel_uname/{.git,.gitignore,.config.old,Documentation,COPYING,CREDITS,MAINTAINERS,README} || Fdie Fexec rm -rff $Fdestdir/usr/src/linux-$_F_kernel_ver$_F_kernel_uname/usr/ || Fdie # Workaround for permissions bug Ffileschmod usr/src/linux-$_F_kernel_ver$_F_kernel_uname/include/generated 644 Fsplit kernel$_F_kernel_name-source usr/src ## now the kernel$_F_kernel_name-docs Fmkdir /usr/src/linux-$_F_kernel_ver$_F_kernel_uname Fexec cp -Ra $Fsrcdir/linux-$_F_kernelver_ver/{Documentation,COPYING,CREDITS,MAINTAINERS,README} \ $Fdestdir/usr/src/linux-$_F_kernel_ver$_F_kernel_uname || Fdie ## do we need to ln /usr/share/doc ?! Fsplit kernel$_F_kernel_name-docs usr/src if [ -z "$_F_kernel_name" ]; then Fexec kmake INSTALL_HDR_PATH=$Fdestdir/usr headers_install || Fdie [ -e $Fdestdir/usr/include/scsi ] && Frm /usr/include/scsi [ -e $Fdestdir/usr/include/drm ] && Frm /usr/include/drm Fsplit kernel-headers /usr fi ## now time to eat some cookies and wait the kernel got compiled :) ## use verbose by default, we want to know what is going on... Fexec kmake V=1 || Fdie Fmkdir /boot Fmkdir /lib/modules Ffilerel .config /boot/config-$_F_kernel_ver$_F_kernel_uname if [ ! -z "$_F_kernel_vmlinuz" ]; then Ffilerel $_F_kernel_vmlinuz /boot/$_F_kernel_path-$_F_kernel_ver$_F_kernel_uname else Ffilerel arch/x86/boot/bzImage /boot/$_F_kernel_path-$_F_kernel_ver$_F_kernel_uname fi Fln config-$_F_kernel_ver$_F_kernel_uname /boot/config Fln System.map-$_F_kernel_ver$_F_kernel_uname /boot/System.map Fln $_F_kernel_path-$_F_kernel_ver$_F_kernel_uname /boot/$_F_kernel_path Fexec kmake INSTALL_MOD_PATH=$Fdestdir $MAKEFLAGS modules_install || Fdie # dump symol versions so that later builds will have dependencies and # modversions Ffilerel System.map /boot/System.map-$_F_kernel_ver$_F_kernel_uname Ffilerel /usr/src/linux-$_F_kernel_ver$_F_kernel_uname/Module.symvers # Since kernel 5.10 this is needed to build external modules Ffilerel scripts/module.lds /usr/src/linux-$_F_kernel_ver$_F_kernel_uname/scripts/module.lds Frm /lib/modules/$_F_kernel_ver$_F_kernel_uname/build Frm /lib/modules/$_F_kernel_ver$_F_kernel_uname/source Fln /usr/src/linux-$_F_kernel_ver$_F_kernel_uname /lib/modules/$_F_kernel_ver$_F_kernel_uname/build Fln /usr/src/linux-$_F_kernel_ver$_F_kernel_uname /lib/modules/$_F_kernel_ver$_F_kernel_uname/source Fsplit kernel$_F_kernel_name-source usr/src/linux-$_F_kernel_ver$_F_kernel_uname/Module.symvers Fsplit kernel$_F_kernel_name-source usr/src/linux-$_F_kernel_ver$_F_kernel_uname/scripts/module.lds Fexec /sbin/depmod -a -b $Fdestdir $_F_kernel_ver$_F_kernel_uname || Fdie # build bootconfig Fexec cd tools/bootconfig Fexec kmake || Fdie Fexec kmake DESTDIR="$Fdestdir" install || Fdie Fsplit bootconfig usr/sbin Fexec cd ../.. # build cpupower Fexec cd tools/power/cpupower Fexec kmake clean || Fdie Fsed '$(OPTIMIZATION) -fomit-frame-pointer' "$CFLAGS" Makefile Fsed 'lib64' 'lib' Makefile Fexec kmake DEBUG=false CPUFREQ_BENCH=false || Fdie Fexec kmake DESTDIR="$Fdestdir" CPUFREQ_BENCH=false install || Fdie Fmv /usr/man /usr/share Ffile /etc/sysconfig/cpupower Fexe /usr/sbin/cpupower.sh Ffile /lib/systemd/system/cpupower.service Fsplit cpupower etc/ Fsplit cpupower lib/systemd Fsplit cpupower usr/bin/ Fsplit cpupower usr/include/ Fsplit cpupower usr/lib/ Fsplit cpupower usr/sbin/ Fsplit cpupower usr/share/ # build x86_energy_perf_policy Fexec cd ../x86/x86_energy_perf_policy Fexec kmake clean || Fdie Fsed '$(OPTIMIZATION) -fomit-frame-pointer' "$CFLAGS" Makefile Fexec kmake || Fdie Fmkdir usr/bin usr/share/man/man8 Fexec kmake DESTDIR="$Fdestdir" install || Fdie Fsplit x86_energy_perf_policy usr/bin/ Fsplit x86_energy_perf_policy usr/share/ # build perf Fexec cd ../../../perf Fsed "lib64" "lib" Makefile.config Fsed "libexec/perf-core" "lib/perf/perf-core" Makefile.config Fexec kmake \ WERROR=0 \ DESTDIR="$Fdestdir/usr" \ NO_GTK2=1 \ NO_LIBAUDIT=1 \ NO_LIBNUMA=1 \ NO_LIBUNWIND=1 \ PERF_VERSION="$pkgver-$pkgrel" \ install || Fdie Fmv /usr/etc /etc/ Frm /usr/etc Fsplit perf etc/ Fsplit perf usr/bin/ Fsplit perf usr/share/ Fsplit perf usr/lib } # optimization OK