How to understand flow of kernel code
Hi,
Can Anyone tell me the tips/tricks/techniques/practices followed in understanding flow of Linux kernel code?
Regards,
Krishna Chaitanya
Quoted 2 lines · In article <[email protected]> you wrote:
Can Anyone tell me the tips/tricks/techniques/practices followed in understanding flow of Linux kernel code?
You read the code and use an ide which allows to find declarations/usage (ctags suppot in editor for eample). You could also browse with LXR. But some basic architectural understanding from various kernel books and articles is helpfull.
http://lxr.linux.no/source/init/main.c
Greetings
Bernd
Hare Krishna, Hare Krishna, Krishna, Krishna, Hare, Hare, Hare Rama, Hare Rama, Rama, Rama, Hare, Hare.
Start at entry.S and head.S in /arch/i386/kernel and trace the initialization. It's a good place to start for understanding how the kernel boots and follow the code through init. Check out the userspace interaction as well. It will at least start you with the basics.
You may want to offer a leaf, fruit, flower, and water to Lord Chaitanya and Lord Krishna and chant the mantras in between to ask for guidance and understanding (I'm serious).
Interesting trivia. Krishna in hindi means "all attractive". The Greeks took the word and over time it was corrupted into the word "Christ" which was later used for Jesus of Nazereth. I lot of people probably don't know his last name actually came from the Vedic culture.
Hare Krishna,
Jeff
Quoted 12 lines · krishna
Hi,
Can Anyone tell me the tips/tricks/techniques/practices followed in understanding flow of Linux kernel code?
Regards,
Krishna Chaitanya
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 6 lines · Jeff V. Merkey
Interesting trivia. Krishna in hindi means "all attractive". The Greeks took the word and
over time it was corrupted into the word "Christ" which was later used for Jesus of Nazereth.
I lot of people probably don't know his last name actually came from the Vedic culture.
Hmm - don't think you are a reliable source of etymological information.
Krishna means "black".
Christos means "anointed".
The IE roots are different. The krs-no- is seen e.g. in Slavic cerny (black). The ghrei- is perhaps seen in English grime.
Quoted 15 lines · Jeff V. Merkey
Hare Krishna, Hare Krishna, Krishna, Krishna, Hare, Hare, Hare Rama, Hare Rama, Rama, Rama, Hare, Hare.
Start at
entry.Sandhead.Sin /arch/i386/kernel and trace the initialization. It's a good place
to start for understanding how the kernel boots and follow the code through init. Check out
the userspace interaction as well. It will at least start you with the basics.You may want to offer a leaf, fruit, flower, and water to Lord Chaitanya and Lord Krishna
and chant the mantras in between to ask for guidance and understanding (I'm serious).
Quoted 6 lines
Interesting trivia. Krishna in hindi means "all attractive". The Greeks took the word and
over time it was corrupted into the word "Christ" which was later used for Jesus of Nazereth.
I lot of people probably don't know his last name actually came from the Vedic culture.
FYI, The vedic culture refers to vedic era.
The Vedic scriptures were written much before the books Mahabharatha and Ramayana.
The last of the vedas, ie, i don't know whether it is the Rig veda or the Yajur veda, talks about Kristu or Kristo somebody like that, referring to Jesus of Nazareth.
Maybe you should consult some Sanskrit scholars, before making wrong statements.
Manu
Quoted 25 lines
Hare Krishna,
Jeff
Quoted 5 lines · krishna
Hi,
Can Anyone tell me the tips/tricks/techniques/practices followed in understanding flow of Linux kernel code?
Quoted 8 lines
Regards,
Krishna Chaitanya
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · krishna
Can Anyone tell me the tips/tricks/techniques/practices followed in understanding flow of Linux kernel code?
A really good idea would be to visit:
* http://user-mode-linux.sourceforge.net/
Build a UML kernel with support for kernel debugging and follow their instructions for debugging the kernel using gdb or even perhaps ddd. Then you can watch the flow of initialisation for yourself within the UML. Note that this obviously doesn't have low level hardware specifc handling for your architecture, but it's a good place to start messing around.
Also, the usual plugs:
* http://www.kernelnewbies.org/
* http://www.tech9.net/rml/kernel_book/
* http://www.xml.com/ldd/chapter/book/
* http://safari.oreilly.com/ - Read Understanding the Linux kernel online
Jon.
P.S. You're probably not in the UK, but the next issue of Linux User & Developer will have a feature on UML debugging. My rather biased opinion is that it'll be interesting to you :-)
One of the more bizarre details of kernel initialization is in do_initcalls(). It's one of the last things in the initialization sequence that you see code for, and it does some odd function-pointer table assembly hackery. You don't actually see a list of the functions that do_initcalls() calls because *it's generated at compile time*. Each module/filesystem/arch/etc can register an initialization function with the build system through a declaration like the following in "binfmt_elf.c":
core_initcall(init_elf_binfmt);
This macro is defined in init.h, along with several others:
#define core_initcall(fn) __define_initcall("1",fn)
#define postcore_initcall(fn) __define_initcall("2",fn)
#define arch_initcall(fn) __define_initcall("3",fn)
#define subsys_initcall(fn) __define_initcall("4",fn)
#define fs_initcall(fn) __define_initcall("5",fn)
#define device_initcall(fn) __define_initcall("6",fn)
#define late_initcall(fn) __define_initcall("7",fn)When the build system is done building all the files, it gathers together all of the special initcall declarations and links them into one table:
the one that do_initcalls() iterates over.
-dte