Kernel/Rebuild

From Gentoo Wiki
< Kernel
Jump to:navigation Jump to:search

Common

Exit the kernel configuration and rebuild the kernel using the following command:

root #make && make modules_install
Note
Don't forget the -j option!
Depending on system performance, building the kernel could take quite some time. If the number of logical CPU cores in the system is known, the -jN (where N is the number of available logical cores) option can be used to dramatically speed up the compilation process. For example, a quad core processor with 2-way Simultaneous multithreading (SMT) has eight logical cores, so make can be invoked with the -j8option: make -j8. An easy way to determine the number of available logical cores is to run the nproc command:

user $nproc
8

so the command would become:

root #make -j8 && make -j8 modules_install


Do not forget to copy the newly compiled kernel image to the /boot location. If applicable mount /boot.

root #mount /boot
root #make install

If necessary, update the boot loader

When not changing kernel versions, it may not be necessary to update the system's boot loader. This depends on the system configuration; if the boot loader is pointed to a replaced binary file with the exact same name, secondary boot loader entries may not need updated. When in doubt re-run the boot loader configuration generator or inspect the boot loader's configuration file to avoid issues the next time the system reboots.

Using GRUB

Update the boot loader configuration prior to rebooting the system. For instance, when using GRUB, these steps can be done by running the following command:

root #grub-mkconfig -o /boot/grub/grub.cfg

Using EFI stub kernel

Users of EFI stub follow the procedure in the Installation section.

Using systemd-boot

If using systemd's EFI bootloader, review the systemd-boot article.

Reboot

Reboot for the new kernel configuration to take effect:

root #reboot