In this section, we will see two broad ways in which you can obtain a Linux kernel source tree:
- By downloading and extracting a specific kernel source tree from the Linux kernel public repository (https://www.kernel.org)
- By cloning Linus Torvalds' source tree (or others') – for example, the linux-next Git tree
But how do you decide which approach to use? For the majority of developers like you working on a project or product, the decision has already been made – the project uses a very specific Linux kernel version. You will thus download that particular kernel source tree, quite possibly apply project-specific patches to it if required, and use it.
For folks whose intention is to contribute or "upstream" code to the mainline kernel, the second approach – cloning the Git tree – is the way to go for you. (Of course, there's more to it; we described some details in the&...