Further Optimizations

Features of kernel


Speeding up builds with ccache: Ccache (or “ccache”) is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again. Ccache is free software, released under the GNU General Public License version 3 or later.

Installing ccache

# For Debian/Ubuntu
sudo apt-get install ccache
    
# For Arch/Garuda/Manjaro
sudo pacman -S ccache

Setting ccache max size (Default 5G)

ccache -M 10G

And then finally

export KERNEL_USE_CCACHE=1

Compiling Kernel with Link Time Optimizations (LTO): Link Time Optimization (LTO) refers to program optimization during linking. The linker pulls all object files together and combines them into one program. The linker can see the whole of the program, and can therefore do whole-program analysis and optimization.

LTO patch if using Clang as compiler:

curl https://raw.githubusercontent.com/theradcolor/patches/master/rad-kernel-clang-lto-patch.patch | git am

LTO patch if using GCC as compiler:

curl https://github.com/theradcolor/patches/blob/master/rad-kernel-gcc-lto-patch.patch | git am