Frogging-Family / linux-tkg

linux-tkg custom kernels
GNU General Public License v2.0
1.25k stars 157 forks source link

linux-tkg

This repository provides scripts to automatically download, patch and compile the Linux Kernel from the official Linux git repository, with a selection of patches aiming for better desktop/gaming experience. The provided patches can be enabled/disabled by editing the customization.cfg file and/or by following the interactive install script. You can use an external config file (default is $HOME/.config/frogminer/linux-tkg.cfg, tweakable with the _EXT_CONFIG_PATH variable in customization.cfg). You can also use your own patches (more information in customization.cfg file).

Important information

Customization options

Alternative CPU schedulers

CFS is the only CPU scheduler available in the "vanilla" kernel sources ≤ 6.5. EEVDF is the only CPU scheduler available in the "vanilla" kernel sources ≥ 6.6.

Its current implementation doesn't allow for injecting additional schedulers at kernel level, and requires replacing it. Only one scheduler can be patched in at a time. However, using Sched-ext, it's possible to inject CPU schedulers at runtime. We offer support for it on ≥ 6.8 by default. Arch users can find scx schedulers on the AUR thanks to @sirlucjan (for persistence, set scheduler in "/etc/default/scx" and enable the scx service).

Alternative schedulers are available to you in linux-tkg:

These alternative schedulers can offer a better performance/latency ratio for gaming and desktop use. The availability of each scheduler depends on the chosen Kernel version: the script will display what's available on a per-version basis.

Default tweaks

Optional tweaks

The customization.cfg file offers many toggles for extra tweaks:

To apply your own patch files using the provided scripts, you will need to put them in a linux<VERSION><PATCHLEVEL>-tkg-userpatches folder -- where VERSION and PATCHLEVEL are the kernel version and patch level, as specified in linux Makefile, the patch works on, e.g linux65-tkg-userpatches -- at the same level as the PKGBUILD file, with the .mypatch extension. The script will by default ask if you want to apply them, one by one. The option _user_patches should be set to true in the customization.cfg file for this to work.

Install procedure

For all the supported linux distributions, linux-tkg has to be cloned with git. Since it keeps a clone of the kernel's sources within (linux-src-git, created during the first build after a fresh clone), it is recommended to keep the cloned linux-tkg folder and simply update it with git pull, the install script does the necessary cleanup at every run.

Arch & derivatives

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

The script will use a slightly modified Arch config from the linux-tkg-config folder, it can be changed through the _configfile variable in customization.cfg. The options selected at build-time are installed to /usr/share/doc/$pkgbase/customization.cfg, where $pkgbase is the package name.

Note: the base-devel package group is expected to be installed, see here for more information.

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

Important notes: An issue has been reported for Ubuntu where the stock kernel cannot boot properly any longer, the whereabouts are not entirely clear (only a single user reported that, see https://github.com/Frogging-Family/linux-tkg/issues/436).

The interactive install.sh script will create, depending on the selected distro, .deb or .rpm packages, move them in the the subfolder DEBS or RPMS then prompts to install them with the distro's package manager.

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

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

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

The script will use a slightly modified Arch config from the linux-tkg-config folder, it can be changed through the _configfile variable in customization.cfg.

Generic install

The interactive install.sh script can be used to perform a "Generic" install by choosing Generic when prompted. It git clones the kernel tree in the linux-src-git folder, patches the code and edits a .config file in it. The commands to do are the following:

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

The script will compile the kernel then prompt before doing the following:

sudo cp -R . /usr/src/linux-tkg-${kernel_flavor}
cd /usr/src/linux-tkg-${kernel_flavor}
sudo make modules_install
sudo make install
sudo dracut --force --hostonly --kver $_kernelname $_dracut_options
sudo grub-mkconfig -o /boot/grub/grub.cfg

Notes:

Gentoo

The interactive install.sh script supports Gentoo by following the same procedure as Generic, symlinks the sources folder in /usr/src/ to /usr/src/linux, then offers to do an emerge @module-rebuild for convenience

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

Note: If you're running openrc, you'll want to set _configfile="running-kernel" to use your current kernel's defconfig instead of Arch's. Else the resulting kernel won't boot.