managing your own kernel in linux can come with a plethora of bonuses. people praise kernels like the CachyOS kernel for being fast and reliable. in some cases, you might have hardware that is experiencing issues on your current kernel, and you need to use patches supplied by the developers.

these aren’t mutually exclusive. in fact, having both is quite easy, if you “simply” manage your own kernel.

now, you could go to kernel.org, download the latest stable tarball, extract it, apply your patches manually with patch -Np1 < /path/to/patch.patch, but that quickly becomes annoying as soon as there’s a new version of the kernel, and now you’re juggling multiple folders and tarballs and having to bother with manually generating your initramfs/initrd and re-making your GRUB config every time. it’s a hassle.

linux-tkg is an absolutely wonderful set of scripts that can handle all of this for you. it works on most major distros, and builds to a package for use with your system package manager, so your system is aware of it and can handle all appropriate configuration for you.

and it’s simple to use. just clone the repository to a folder using git clone and walk down the list of options in customization.cfg in your text editor. if there’s an option you don’t particularly understand, you can probably leave it as-is. anything required will be prompted to you during installation and given a sane default.

if you have patches you want to apply, the format is a bit weird. in the root of the project, create a folder named linux{major}{minor}-tkg-userpatches, where you replace {major} and {minor} with the major and minor version numbers of the kernel version. i’m currently using 6.14.2; my major is 6 and minor is 14, so my folder is linux614-tkg-userpatches. inside of this folder you can drop in your patch files, though the file extension must be .mypatch for linux-tkg to pick them up.

if you’re on Arch, all you need to compile and install is a makepkg -i. if you’re not on Arch, the command to run is ./install.sh install. once the kernel is compiled, you’ll likely be prompted to install it, where your system package manager will take over and configure the rest for you. after that’s all done, you’ll be ready to reboot into your fresh custom kernel.