I am compiling the Linux kernel for my specific hardware and I only select the drivers/options which I really need. This is in contrast to a typical distribution kernel, where they compile almost everything, to be compatible with as many hardware configurations as possible.
I imagine, for my kernel, I am only using 1% of the total kernel code (order of magnitude estimate).
Is there any way to find out which files from the kernel source I have actually used when I build my kernel?
This is not an academical question. Suppose I have compiled my kernel 3.18.1. Now a security update comes along, and 3.18.2 is released. I have learned in my other question how to find which files have change between releases. If I knew whether any of the files I am using have changed, I would recompile my kernel to the new version. If, on the other hand, the changes only affect files which I am not using anyway, I can keep my current kernel version.
Best Answer
Compiling my comment as answer:
Run the following command on one shell. You can make a shell script of it or demonize with the
-d
option.On other shell, execute
make
/home/user/kernel_build.log
will have a list of the files that have been opened(read operation) during the build process.