How to get a whole list of compiled files of Linux kernel?

吃可爱长大的小学妹 提交于 2019-12-20 03:55:19

问题


I'm working on different Android projects and need to setup project in Source Insight for different kernel source tree. There are many unused files in kernel, I want to find a method to pick out all .c,.h,.S files that are compiled in kernel. I was nearly crazy when I pick the source files manually.

I'd wrote a script that can pick up the files corresponding to the .o files, but there are some .o files are compiled by multiple .c files, which make it more complicated.

Is there an easier way to know what files are handled in the compiling process?

Any information would be greatly appreciated.

It's my first question in stackoverflow, I love here so much.

Thanks.


回答1:


I always need to search the kernel source without looking at powerpc, ia86, sparc, alpha, infiniband, etc. Assuming you can compile the kernel, several ways of doing this:

1) $K/scripts/basic/fixdep.c is called from Makefile.build to create a .cmd file for each source which contains information about the compile options, compile source/target and dependency list. Modify this to write a separate file with just the source file or source/dependencies.

2) Hack $K/scripts/Makefile.build to log the currently compiled file. See the cmd_as_o_S and rule_cc_o_c areas.

Option #1 is the best but requires a little coding. Option #2 is easiest but a true hack, and doesn't pick up the dependencies.



来源:https://stackoverflow.com/questions/17440819/how-to-get-a-whole-list-of-compiled-files-of-linux-kernel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!