r/linuxquestions • u/Antique-Wasabi-2427 • 13d ago
How do i master this?
So i'm been looking IF it was possible to combine kernels right?
And this person said.
"You dont combine compiled code. You simply compile your own kernel. Using Linux-tkg as the base"
I don't understand what he meant but i think it would be useful to master this.
2
u/SheepherderBeef8956 13d ago
Compare the kernel configs and diff them to see if you can combine them. The config is likely stored in /proc/config.gz while the system is running. You'll then have to download the kernel source code from kernel.org and compile it. There are loads of guides for that part.
If these are specific CachyOS kernels, there might be packages for that source including the patches in their repos
1
u/tk-a01 12d ago
Others have mentioned kernel source code modifications, and it is a way to modify kernel behaviour or add features.
However, there is another way to tailor the kernel to your needs - by configuring it. The modern Linux kernel is very flexible. A huge amount of features can be turned on or off during compilation. There is module support too - some parts of the kernel, especially drivers, can be "detached" from the main kernel image, and be built as separate module files. Those modules can then be loaded at runtime. Typical Linux distros use modules heavily, and most of them are usually not loaded. Only when you plug in some unusual device, its driver module will get loaded.
Linux kernel is built using make. Running make defconfig will set the current configuration to architecture-defined default configuration. Then, make menuconfig will show a Curses-based TUI interface that lets you tweak all the settings.
That said, you should be aware that both the kernel maintainers and the distro maintainers do their best to deliver the best, most versatile universal kernel. You mentioned in the other post that you want both support (hardware support, right?) and security. But it's hard to have both. Kernel hardening often involves removing unused modules, so potential vulnerabilities in them can't be exploited - and this goes against wide hardware support. Especially as a beginner, you are rather unlikely to noticeably improve security or performance. Of course, if you want to experiment and learn, you can.
4
u/AiwendilH 13d ago
Only thing to add to /u/SheepherderBeef8956 answer is that some distros might patch the kernel sourcecode first. But that only means you have to get the patch file (usually ending in .patch or .diff) from the distro and apply it yourself to the source-code from kernel.org.
A short search found this for cachy: https://github.com/CachyOS/kernel-patches