On Sun, Oct 23, 2011 at 6:29 PM, jiangtao.jit <jiangtao.jit@xxxxxxxxx> wrote: > Hi: > Hi jiangtao, > While reading the kernel code > 1. the huge amount of files make me scared > there are too many alike functions in different files > sometimes I can't figure out which one was really compiled > 2. too many macros in the definition of a struct or functions declaration > confused me a lot > I tried to follow the generated file autoconf.h to guess the final face > but it's really a difficult thing > > Is there a tool which can generate a small and simple source tree after config? > not pre-processor Not that I'm aware of. > just generate a small source tree contains the files and dirs which really will be compiled > and no macros like CONFIG_SMP etc. > according to the configuration > > or some other way to understand the architecture of the final working source tree? > The Linux kernel is a very complex beast yet it is highly modularized. I recommend you to focus on the specific subsystem that you need to work and don't worry about the rest. To know if a specific file is included in your kernel I usually do this (it works for me but I'm not sure if is the right way to do it): For example if I want to know if the driver to support nand memories on ARM OMAP platforms is included in my kernel. 1- Find the file that implements the driver (drivers/mtd/nand/omap2.c) 2- See which Kconfig symbol determines its compilation: $ fgrep omap2 drivers/mtd/nand/Makefile obj-$(CONFIG_MTD_NAND_OMAP2) += omap2.o 3- Look if that symbol is included in my config file: $ fgrep MTD_NAND_OMAP2 .config CONFIG_MTD_NAND_OMAP2=y Then I know that my kernels includes that file. Hope it helps, -- Javier Martínez Canillas (+34) 682 39 81 69 Barcelona, Spain _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies