legend:
- "clean up" means to keep the last three versions
compile new kernel
1. mount "/boot/"
2. create a new symlink to the newest kernel source (not necessary, if use flag "symlink" is set)
cd "/usr/src/"
ln --symbolic --force "linux-<new_kernel_version>-gentoo/" "linux"
3. copy the file ".config" from the old kernel source directory to the newer one
cp "linux-<old_kernel_version>/.config" "linux/.config"
3.1. alternative: copy the config at runtime
zcat "/proc/config.gz" > "linux/.config"
4. compile the new kernel
4.1. adapt new kernel settings and use their default values
cd "/usr/src/linux/"
make olddefconfig
4.1.1. alternative: adapt new kernel settings manually
make oldconfig
4.2. compile the kernel and kernel modules
make --jobs 4 --load-average 3.6 && make --jobs 4 --load-average 3.6 modules_install
4.3. install the kernel and copy it to "/boot/":
make install
5. update the initramfs for the new kernel
update_initramfs
5.1. copy the initramfs file to "/boot/"
cp "/usr/src/custom-initramfs-<new_kernel_version>.cpio.gz" "/boot/"
6. update the intel cpu microcode, if necessary
emerge --ask sys-firmware/intel-microcode
iucode_tool --scan-system --write-earlyfw="/boot/early_ucode.cpio" "/lib/firmware/intel-ucode/"* --overwrite
6.1. check the current revision and date
dmesg | grep "microcode"
6.2. reload the microcode manually
echo "1" > /sys/devices/system/cpu/microcode/reload
6.3. check, if the microcode was updated
dmesg | grep "microcode"
7. update the grub configuration
grub-mkconfig --output="/boot/grub/grub.cfg"
8. compile all modules for the new kernel
emerge @module-rebuild
9. use the new kernel
reboot
10. clean up "/lib/modules/"
11. clean up "/usr/src/"
12. clean up "/boot/"