When I uncompress the Linux kernel source code from Kernel.org, there are many folders. I know what most of them contain and their purpose. However, I cannot figure out or find on the Internet the purpose for the tools and samples directories. What are these two directories and what is their purpose?
I just uncompressed a kernel and this is what I make of it:
- For the
samplesdirectory, it's showing various examples of kernel modules people might want to develop. Here's a comment from
Here's a sample kernel module showing the use of kprobes to dump a stack trace and selected registers when do_fork() is called.
The code may be used by anyone for any purpose, and can serve as a starting point for developing applications using uhid.
etc, etc. Basically, anytime they felt a subject needed an illustration they wrote illustrative code and put it somewhere in this part of the directory tree.
- For the
toolsdirectory: This looks like a directory tree housing linux-specific executables. The bulk of a GNU/Linux platform's userland consists of cross-platform tools or tools created outside the Linux Foundation but occasionally the maintainers know there needs to be a userland tool in order to take advantage of features specific to the Linux kernel. The comments on most seem to include the word "simple" a lot which leads me to believe this directory tree is basically a userland equivalent of the
samplesdirectory. This is also because it doesn't look like util-linux comes from this (even though util-Linux does come from the Linux Foundation and kernel.org as well).