emerge --ask sys-kernel/dracut
cd /usr/src/linux
sudo cp /usr/src/linux-6.4.4-gentoo/.config .config
sudo make oldconfig
General architecture-dependent options --->
Link Time Optimization (LTO) (Clang ThinLTO (EXPERIMENTAL)) --->
( ) None
( ) Clang Full LTO (EXPERIMENTAL)
(x) Clang ThinLTO (EXPERIMENTAL)
sudo make CC=clang LLVM=1 menuconfig
sudo make CC=clang \
LD=ld.lld \
AR=llvm-ar \
NM=llvm-nm \
STRIP=llvm-strip \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
READELF=llvm-readelf \
HOSTCC=clang \
HOSTCXX=clang++ \
HOSTAR=llvm-ar \
HOSTLD=ld.lld \
LLVM_IAS=1 \
-j14 KCFLAGS="-O2 -march=native -pipe" \
EXTRAVERSION=-gentoo-llvm-lto \
all
sudo make modules_install
sudo make install
sudo cp arch/x86_64/boot/bzImage /boot/vmlinuz-6.9.11-gentoo-llvm-lto-x86_64
sudo dracut --hostonly "/boot/initramfs-$(make EXTRAVERSION=-gentoo-llvm-lto kernelrelease).img" \
--kver "$(make EXTRAVERSION=-gentoo-llvm-lto kernelrelease)"
sudo grub-mkconfig -o /boot/grub/grub.cfg