I want to learn the linux kernel
So, I am a newbie to Linux kernel, and I want to study it.
I am reading a book "Linux Kernel Development". I want to read the source code of the Linux kernel. In my opinion, the book went into detail too much. I want to know how the kernel work first. When I open the source of kernel, I found myself lost in so much source code, I dont understand what is in those directories, can anybody help me? |
Who said it was going to be easy? If it was, everyone would be doing it. If the book was too detailed, what could possibly make you think the source code would somehow summarize anything? What is the purpose of your study?
--- rod. |
Quote:
|
Quote:
|
Quote:
1 - The kernel is *huge*. Any book that would give you a step-by-step walkthrough of the entire kernel would take a long time to write/edit before being ready to publish. 2 - The kernel's development development pace is pretty fast. The latest 2.6 kernel (or 3.x now?...) is quite different from the first release of 2.6.0, so much so that drivers written for the older 2.6 kernels won't compile against the newer ones unless they keep up with the changes. This kind of makes the effort put into writing such a book a bit of a waste of time since it will become outdated very quickly. |
Quote:
aims will be difficult and pretty much useless too. What EXACTLY do you want to do after studying the kernel? http://www.linuxquestions.org/questi...-books-873556/ |
Perhaps a study of OS's in a more general way would be a good place to start. From there, you can apply general principles to specific implementations within Linux. There is an older book 'The Design of the Unix Operating System' which covers the basics with some detail. There are others with similar scope.
--- rod. |
Thank everybody for answering, well, I found myself not very familiar with how an operating system work, I am looking for some information from grub and openbios.
Well, I just don't understand, forgive my ignorance, why there is not a main() function in linux kernel and many other softwares? I was taught there must be one, wired. And when the kernel was boot, where does the code started executing. I think the linux kernel is just like a large program, as the other programs, while it just have some functions of allocating the memory or something. I thought I may have a wrong concept about the linux kernel...*-* |
The kernel entry point is not the same as that of a userspace application. It is platform-specific, and is usually invoked by the bootloader. Older x86 kernels were made to load directly from the disk, and included built-in bootloaders. The entry point for those was defined by the PC BIOS. Linux has since been generalized for other architectures. The kernel is also quite modular, and is composed of loadable/un-loadable kernel modules, which also do not require a main() function.
When doing kernel level programming, one needs a very different mindset from the usual userspace software development. Same for bootloaders. --- rod. |
Quote:
|
Quote:
And who told you there should be a 'main' function and if he/she told you this, were you given any reason ? And when you boot, say, your PC (or cellphone) is a 'main' function involved ? And if you think it is, who/what calls it ? At all, do you understand how a computer works ? I.e., more specifically, how a CPU works ? And do you think CPU has anything to do with 'main' function ? |
Quote:
If grub calls it, or bios calls it, fine, they can be main(). 'Main' is a clue for us to understand the exact process of running a program, maybe there is not a main, but there must be something controlling everything, that's all I know. |
Quote:
|
Quote:
--- rod. |
Quote:
So, think again about 'main' and realize that CPU knows nothing about 'main'. I.e. 'main' is not part of CPU architecture. No, there is nothing controlling everything, there is just currently executed code, and there can be causes (interrupts, exceptions) which interfere with currently executed code. |
All times are GMT -5. The time now is 02:36 PM. |