Installing the sources
The core around which all Linux distributions are built is the Linux kernel. It is the layer between the user programs and the system hardware. Gentoo provides its users several possible kernel sources. A full listing with description is available at the Kernel overview page.
Downloading the sources
The recommended way to get the kernel sources is downloading them directly from upstream (the kernel developers themselves). Like with downloading the stage tarball, the only tool necessary is a web browser.
When installing kernel sources provided by Portage on a running Gentoo system, the package manager places them in the /usr/src directory. Go to the directory that once the installation is finished and running on the target system will be found at /usr/src:
In environments with fully graphical web browsers copy the kernel sources URL from . Right click on the big yellow button labeled "Latest Release" and featuring the current stable release's version number, then Copy link address (Firefox) or Copy link location (Chromium) to copy the link to the clipboard, then paste the link to the wget utility on the command-line to download the sources:
To download the kernel sources directly from a command line environment, use for example links, the non-graphical, menu-driven browser.
To use an HTTP proxy with links, pass on the URL with the
links -http-proxy proxy.server.com:8080 https://www.kernel.org
Alternatively, use the (also non-graphical but not menu-driven) lynx browser.
If a proxy needs to be defined, and it has not been done already, export the http_proxy and/or ftp_proxy variables:
Select the version number (or "Download" next to it) displayed below the line "Latest Release" and press d to start the download.
Unpacking the sources
Create a directory on the storage device for the unpacked kernel sources:
Now unpack the downloaded kernel sources with tar into the newly created directory specified with the command line argument
tar xpvf linux-*.tar.xz -C /mnt/gentoo/usr/src/upstream-sources
This will install the Linux kernel sources under the path /mnt/gentoo/usr/src/upstream-sources in a directory named "linux" followed by a version number. Change into that folder now:
TODO: reevaluate commented out parts
Now it is time to configure and compile the kernel sources.