Adel Kara Slimane dea8847167 Various refactorings + Enable Clang LTO (#248)
* Enable Clang LTO

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: improve kernel prompting and selection code

- Subversion are to be directly edited in the _kver_subver_map
variable at the top of the file
- _supported_kernels is theoretically not needed, but it's needed
for the prompting to happen with the correct order, since the
keys in _kver_subver_map are hash-ordered, which is not the
natural ordering

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: update comment

* prepare: improve compiler selection and LTO enablement code path

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* install.sh: use _prompt_from_array for distro selection

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: move optiprofile prompt to _prompt_from_array

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: improve cpu sched fallback code

* install.sh: move set -e at the top

* prepare: use arrays for HZ configs

* prepare: enable default selection in _prompt_from_array

* prepare: use _prompt_from_array for _rr_interval

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: update _rr_interval prompting

* prepare: update and use config script for tickless

* prepare: use scripts/config accross the entire script

* prepare: change last lines to scripts/config

* prepare: small fixes

* customization.cfg: revert back to old values for _tickless

* prepare: revert back to old numbering for _rr_interval

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: msg2 used _rr_interval

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: be smarter/dumber with _rr_interval

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: remove last manual interventions to .config

* prepare: fix condition

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: improve cpu march handling and implement prompt

Making `make` prompt wasn't working on my Gentoo for a
reason I don't understand anymore. The configs are unset
by the script. So it always goes for generic by default.
Maybe they need to be entirely deleted from the .config
file.

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: fix name for MuQSS.c

* prepare: use _sched for scheduler source code files

* install.sh: use sudo to clean root owned files in linux-src-git

* prepare: remove useless code

* prepare: fix issue with MuQSS

* Add CacULE scheduler

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* 5.13 rc4

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: Remove voluntary_preempt, OFenable and disable_acpi_cpufreq options

* prepare: Prevent config prompt w/ modprobed-db

Rebase of @CodingKoopa PR

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: Empty LOCALVERSION config option for Arch at the correct spot

@CodingKoopa spotted the issue and reported it, thanks!

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: use _enable _undefine and _disable wrappers

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* Restore the state tracker for makepkg usage

* Fix tickless array selection order for nohz idle/hz periodic

* Also handle the disabling part of the generic march selector

* Replace _undefine() calls with _disable()

* Preserve the case of config options passed to scripts/config

* Echo the CONFIG_EXPERT options without blank lines

And with a header/footer
Makes searching for config setting bugs easier

* prepare: uppercase config options with "tr"

Co-authored-by: Etienne JUVIGNY <ti3nou@gmail.com>
2021-06-01 20:14:47 +02:00

Due to intel_pstate poor performances as of late, I have decided to set it to passive mode to make use of the acpi_cpufreq governors passthrough, keeping full support for turbo frequencies.

Nvidia prop drivers might need to be patched if they aren't supporting your chosen kernel OOTB (https://github.com/Frogging-Family/nvidia-all can do that automatically for you)

Custom Linux kernels with specific CPU schedulers related patchsets selector (CFS is an option for every kernel) with added tweaks for a nice interactivity/performance balance, aiming for the best gaming experience.

  • 5.13 RCs (Project C / PDS & BMQ, CacULE)
  • 5.12.y (Project C / PDS & BMQ, MuQSS, CacULE)
  • 5.11.y (Undead PDS, Project C / PDS & BMQ, MuQSS)
  • 5.10.y (Undead PDS, Project C / PDS & BMQ, MuQSS)
  • 5.9.y (Undead PDS, Project C / PDS & BMQ, MuQSS)
  • 5.8.y (Undead PDS, Project C / PDS & BMQ)
  • 5.7.y (MuQSS, PDS, Project C / BMQ)
  • 5.4.y (MuQSS, PDS, BMQ)

CacULE : https://github.com/hamadmarri/cacule-cpu-scheduler

MuQSS : http://ck-hack.blogspot.com/

Project C / PDS & BMQ : http://cchalpha.blogspot.com/

Undead PDS: PDS-mq was originally created by Alfred Chen : http://cchalpha.blogspot.com/

While he dropped it with kernel 5.1 in favor of its BMQ evolution/rework, my pretty bad gaming experiences with BMQ up to this point convinced me to keep PDS afloat for as long as it'll make sense/I'll be able to. Update: Alfred has revived PDS through Project C as of kernel 5.8.0 release.

Various personalization options available and userpatches support (put your own patches in the same dir as the PKGBUILD, with the ".mypatch" extension). The options built with are installed to /usr/share/doc/$pkgbase/customization.cfg, where $pkgbase is the package name.

Comes with a slightly modified Arch config asking for a few core personalization settings at compilation time. If you want to streamline your kernel config for lower footprint and faster compilations : https://wiki.archlinux.org/index.php/Modprobed-db You can optionally enable support for it at the beginning of the PKGBUILD file. Make sure to read everything you need to know about it as there are big caveats making it NOT recommended for most users.

Note regarding kernels older than 5.9 on Archlinux: Since the switch to zstd compressed initramfs by default, you will face an "invalid magic at start of compress" error by default. You can workaround the issue by editing /etc/mkinitcpio.conf to uncomment the COMPRESSION="lz4" (for example, since that's the best option after zstd) line and regenerating for all kernels with sudo mkinitpcio -P.

Anbox usage

When enabling the anbox support option, the modules are built-in. You don't have to load them. However you'll need to mount binderfs :

sudo mkdir /dev/binderfs
sudo mount -t binder binder /dev/binderfs

To make this persistent, you can create /etc/tmpfiles.d/anbox.conf with the following content :

d! /dev/binderfs 0755 root root

After which you can add the following to your /etc/fstab :

binder                         /dev/binderfs binder   nofail  0      0

Then, if needed, start the anbox service :

systemctl start anbox-container-manager.service

You can also enable the service for it to be auto-started on boot :

systemctl enable anbox-container-manager.service

You're set to run Anbox.

Other stuff included:

  • Graysky's per-CPU-arch native optimizations - https://github.com/graysky2/kernel_gcc_patch
  • memory management and swapping tweaks
  • scheduling tweaks
  • optional "Zenify" patchset using core blk, mm and scheduler tweaks from Zen
  • CFS tweaks
  • using yeah TCP congestion algo by default
  • using cake network queue management system
  • using vm.max_map_count=524288 by default
  • cherry-picked clear linux patches
  • optional overrides for missing ACS capabilities
  • optional Fsync support (proton)
  • optional futex2 support (proton)
  • optional Anbox support (binder, ashmem)
  • optional ZFS fpu symbols (<5.9)

Install procedure

Arch & derivatives

git clone https://github.com/Frogging-Family/linux-tkg.git
cd linux-tkg
# Optional: edit customization.cfg file
makepkg -si

DEB (Debian, Ubuntu and derivatives) and RPM (Fedora, SUSE and derivatives) based distributions

git clone https://github.com/Frogging-Family/linux-tkg.git
cd linux-tkg
# Optional: edit customization.cfg file
./install.sh install

Uninstalling custom kernels installed through the script has to be done manually. The script can can help out with some useful information:

cd path/to/linux-tkg
./install.sh uninstall-help

Void Linux

git clone -b tkg https://github.com/Hyper-KVM/void-packages/
cd void-packages
./xbps-src binary-bootstrap
# Optional: edit customization.cfg located in srcpkgs/linux-tkg/files
# Optional: add custom userpatches with the ".mypatch" extension to srcpkgs/linux-tkg/files/mypatches
./xbps-src pkg -j$(nproc) linux-tkg

If you have to restart the build for any reason, run ./xbps-src clean linux-tkg first.

Other linux distributions

If your distro is not DEB or RPM based, install.sh script can clone the kernel tree in the linux-src-git folder, patch and edit a .config file from the one that your current distro uses. It is expected either at /boot/config-`uname -r`.config or /proc/config.gz (otherwise it won't work as-is).

The command to do for that is:

./install.sh config

If one chooses Generic as distro. ./install.sh install will compile the kernel then prompt before doing the following:

sudo make modules_install
sudo make headers_install INSTALL_HDR_PATH=/usr # CAUTION: this will replace files in /usr/include
sudo make install
sudo dracut --force --hostonly --kver $_kernelname
sudo grub-mkconfig -o /boot/grub/grub.cfg

Note: these changes will not be tracked by your package manager and uninstalling requires manual intervention.

Description
linux-tkg custom kernels
Readme 18 MiB
Languages
Shell 100%