sys-kernel/gentoo-sources

This wiki page is about a gentoo ebuild. Include any information about how to install it (emerge it), potential problems and how to resolve them. Be bold and improve it!

If you have any questions or experience any problem related to this ebuild, don't hesitate to open a new ticket and we'll do our best to assist you.

emerge --depclean

# emerge --depclean
sys-kernel/gentoo-sources
    selected: 4.4.21
   protected: none
     omitted: 4.4.26

emerge --depclean does not remove the kernel source if you have CONFIG_PROTECT. If you build the kernel in-tree, the kernel source will be removed but all the files created by the build process will be left. Those have to be removed manually: https://wiki.gentoo.org/wiki/Kernel/Removal

In fact, it is better to build out-of-tree with $KBUILD_OUTPUT, allowing multiple builds with different configurations.

So, if you want to keep the kernel sources of a specific linux kernel, you might want to add the package to your world file:

emerge --noreplace =gentoo-sources-versiontoprotect
emerge --ask --noreplace gentoo-sources:4.4.21

See also

https://packages.gentoo.org/packages/sys-kernel/gentoo-sources
https://wiki.gentoo.org/wiki/Kernel/Overview
https://wiki.gentoo.org/wiki/Kernel/Upgrade
https://wiki.gentoo.org/wiki/Kernel/Removal