Skip to contentSkip to conversation

Is there a tool which can generate a small and simple source tree after config?

DISCUSSION jiangtao.jit 4 participants 4 messages Oct 23, 2011 – Oct 25, 2011

lore
Share & tools
lore
#0 lore raw

Hi:

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
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?

Thanks.

--
2011-10-23
jiangtao.jit

#1 lore raw

hum, how about doxygen?

Quoted 34 lines · jiangtao.jit

Hi:

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
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?

Thanks.

--
2011-10-23
jiangtao.jit

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Signature · 5 lines
Best Regards!
Aiolia Lea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111023/71772272/attachment.html 
#2 lore raw
In reply to jiangtao.jit

Hi :)

Quoted 7 lines · jiangtao.jit

Is there a tool which can generate a small and simple source tree after config? not pre-processor
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?

I feel the same way too, even 'til now :)

The way I do it is maybe counter intuitive for you. I compile the kernel image with frame pointer enabled and debug info (check kernel hacking section in "make config" during kernel compilation).

Then, together with a disk image, I run this kernel in Qemu virtual machine. While running, I hook gdb to this Qemu instance. Finally, I put breakpoints, watchpoints, check backtraces etc I needed to understand the flow.

Maybe that'll work for you too.

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
#3 lore raw
In reply to jiangtao.jit
Quoted 2 lines · jiangtao.jit

Hi:

Hi jiangtao,

Quoted 11 lines

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.

Quoted 6 lines

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,

Signature · 3 lines
Javier Mart?nez Canillas
(+34) 682 39 81 69
Barcelona, Spain