ketchup is a neat utility to download and unpack a specific version of the Linux kernel sources into the current directory. It also does rather well on saving download bandwidth, i.e. if you have the 2.6.17 source tarball and ask for 2.6.18, it will only download the 2.6.17-to-2.6.18 patch.
Here’s a quick usage example, which installs the 2.6.21-rc7 kernel sources:
# emerge ketchup # cd /usr/src # mkdir linux-2.6.21-rc7 # cd linux-2.6.21-rc7 # ketchup 2.6.21-rc7
When ketchup has finished, you then have a clean set of kernel sources for that particular version in front of you.
I like to configure ketchup to use the same storage directory as portage, so that they can share kernel tarballs. In my ~/.ketchuprc I have:
archive = "/usr/portage/distfiles"