Difficulty: Easy
Correct Answer: /usr/src/linux
Explanation:
Introduction / Context:
Compiling a kernel or out-of-tree kernel modules requires matching headers and often the full source tree. Historically, distributions placed the kernel source and headers in a conventional directory to simplify builds and documentation references.
Given Data / Assumptions:
Concept / Approach:
Older and many instructional references point to /usr/src/linux as the canonical path for the Linux source tree or a symlink to the active kernel source. While modern distributions may use versioned directories (for example, /usr/src/kernels/
Step-by-Step Solution:
Verification / Alternative check:
Run uname -r to get the running kernel version and ensure your headers under /usr/src/linux or /usr/src/kernels match. If not, install the appropriate kernel-devel package.
Why Other Options Are Wrong:
Common Pitfalls:
Building against mismatched headers, removing the linux symlink, or assuming the headers are installed by default. Always align versions for reliable builds.
Final Answer:
/usr/src/linux
Discussion & Comments