From which point onwards the kernel execution starts
Hello Everyone,
I am studying bootloaders and wanted to know which function exactly the kernel starts from , i.e. where is the main function?
I been through the init/main.c file and I think most likely this is the file. Could someone please explain how the kernel initializes, i.e. I want to know how does kernel starts from main function
Quoted 2 lines · AQ Tast
Could someone please explain how the kernel initializes, i.e. I
want to know how does kernel starts from main function
http://www.ibm.com/developerworks/linux/library/l-linuxboot/
Signature · 7 lines
regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Quoted 4 lines · AQ Tast
Quoted 2 lines
Could someone please explain how the kernel initializes, i.e. I
want to know how does kernel starts from main functionhttp://www.ibm.com/developerworks/linux/library/l-linuxboot/
It's quite good article at start, but it is a bit old and doesn't cover the newest kernel. If you want to get the details i suggest read great post on Gustawo Duarte blog:
http://duartes.org/gustavo/blog/post/kernel-boot-process
Very useful is Makefile
http://lxr.linux.no/#linux+v2.6.37.2/Makefile
you can trace kernel building process step by step and see what files are linking into kernel in which order.
On the other hand, you have always up to date documentation of Kernel Boot Process in documentation directory in kernel sources:
http://lxr.linux.no/#linux+v2.6.37.2/Documentation/x86/boot.txt
If you want to trace linux boot process in source code, you probably want to start at line:
_start:
# Explicitly enter this as bytes, or the assembler # tries to generate a 3-byte jump here, which causes # everything else to push off to the wrong offset.
.byte 0xeb # short (2-byte) jump
.byte start_of_setup-1f
in arch/x86/boot/header.S
(http://lxr.linux.no/#linux+v2.6.37.2/arch/x86/boot/header.S#L108_) for x86 architecture.
Have fun in exploring :)
Signature · 2 lines
regards, Andrzej Kardas
Hi :)
Quoted 5 lines · Andrzej Kardas
It's quite good article at start, but it is a bit old and doesn't cover the newest kernel. If you want to get the details i suggest read great post on Gustawo Duarte blog:
Wow!!!! great blog post there... a must read for me and possibly the rest of all newbies here....
Oh and I forgot my usual tips in such case: use qemu...attach gdb to qemu's gdb stub.... use -s and -S options...it will stop the guest invocation right from the initial startup. Assuming you compile guest kernel with frame pointer and sufficient debug symbols, it would be easy for you to explore the kernel code :)
Signature · 7 lines
regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Quoted 7 lines · Mulyadi Santosa
Oh and I forgot my usual tips in such case: use qemu...attach gdb to qemu's gdb stub.... use -s and -S options...it will stop the guest invocation right from the initial startup. Assuming you compile guest kernel with frame pointer and sufficient debug symbols, it would be easy for you to explore the kernel code :)
Let me add some stuff to Your tips :). If we talking about qemu and gdb, if somebody doesn't like console-oriented tools (who doesn't ?? :) ), anyway there is possibility to use qemu and gdb with very popular IDE - Eclipse and trace execution of kernel code with "magnificent graphical interface".
The recipe how configure Eclipse + qemu + gdb :
http://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.html
--
regards
Andrzej Kardas
http://www.linux.mynotes.pl
Quoted 3 lines · Andrzej Kardas
The recipe how configure Eclipse + qemu + gdb :
http://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.html
oh my gooodnesss ! that's great...thanks for sharing.... :)
Signature · 7 lines
regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Thanks a lot :) had been looking for a long time...
Quoted 14 lines · Mulyadi Santosa
Quoted 3 lines · Andrzej Kardas
The recipe how configure Eclipse + qemu + gdb :
http://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.html
oh my gooodnesss ! that's great...thanks for sharing.... :)
--
regards,Mulyadi Santosa
Freelance Linux trainer and consultant
Quoted 8 lines
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110308/088e9e6d/attachment.html