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?

  • Uncompressing the kernel sources would leave you with a single non-compressed tar file. You probably meant you extracted the sources from the compressed tar. – Anthon Jun 8 '13 at 16:56
  • Yes Anthon, you are right. – Devyn Collier Johnson Jun 8 '13 at 18:07

I just uncompressed a kernel and this is what I make of it:

  • For the samples directory, it's showing various examples of kernel modules people might want to develop. Here's a comment from kprobe_example.c:

Here's a sample kernel module showing the use of kprobes to dump a stack trace and selected registers when do_fork() is called.

and from uhid_example.c:

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 tools directory: 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 samples directory. 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).
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.