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
On Sat, Mar 5, 2011 at 12:42, AQ Tast <tasteaq@gmail.com> wrote:
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/ -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
On Sat, Mar 5, 2011 at 12:42, AQ Tast <tasteaq@gmail.com> wrote:
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/
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 :) -- regards, Andrzej Kardas
Hi :) On Sat, Mar 5, 2011 at 17:41, Andrzej Kardas <andrzej-kardas@o2.pl> wrote:
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 :) -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
On 06.03.2011 09:01, Mulyadi Santosa wrote:
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.ht... -- regards Andrzej Kardas http://www.linux.mynotes.pl
On Sun, Mar 6, 2011 at 17:26, Andrzej Kardas <andrzej-kardas@o2.pl> wrote:
The recipe how configure Eclipse + qemu + gdb :
http://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.ht...
oh my gooodnesss ! that's great...thanks for sharing.... :) -- 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... On Mon, Mar 7, 2011 at 9:48 PM, Mulyadi Santosa <mulyadi.santosa@gmail.com>wrote:
On Sun, Mar 6, 2011 at 17:26, Andrzej Kardas <andrzej-kardas@o2.pl> wrote:
The recipe how configure Eclipse + qemu + gdb :
http://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.ht...
oh my gooodnesss ! that's great...thanks for sharing.... :)
-- regards,
Mulyadi Santosa Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
participants (4)
-
Andrzej Kardas -
AQ Tast -
Ashwath -
Mulyadi Santosa