Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-05-2013, 10:29 AM   #1
LQ Newbie
Registered: Apr 2009
Location: USA
Distribution: Red Hat Based Distros
Posts: 20

Rep: Reputation: 0
Linux Kernel Questions - learning the sourcecode

I'm attempting to learn the general structure of the Linux kernel for the purpose of debugging and greater understanding. I'm looking to ask C related questions about the linux kernel regarding things I don't understand. First off, Is this a good place to do this?

Second an actual kernel question (using linux-3.8.11):
I have decided to go about this by starting with following the boot process. I figure I can follow this into a general structure for how each piece of the kernel ties together.
I'm currently stumped on this function in arch/x86/boot/pm.c:
void go_to_protected_mode(void)
        /* Hook before leaving real mode, also disables interrupts */

        /* Enable the A20 gate */
        if (enable_a20()) {
                puts("A20 gate not responding, unable to boot...\n");

        /* Reset coprocessor (IGNNE#) */

        /* Mask all interrupts in the PIC */

        /* Actual transition to protected mode... */
                            (u32)&boot_params + (ds() << 4));

On the last line I can't seem to find the function protected_mode_jump using my cscope map. Without knowing about that function, I can't reliably determine where to go from this point. I feel I must be missing something obvious, but what?
Old 05-06-2013, 01:26 AM   #2
Registered: Aug 2008
Distribution: Slackware
Posts: 463

Rep: Reputation: 192Reputation: 192
That's because it's written in Assembly:*/arch/x86/boot/pmjump.S#L24 I recommend either using “git grep” in source code tree or [url=]LXR[/url.

In general, I wouldn't recommend trying to figure out kernel by following the boot process. There's a lot of weird stuff happening when kernel starts and to understand all of it, you'd have to dig into a whole lot of subsystems (eg. memory management, block, etc).

Instead you could first try reading through Understanding the Linux Kernel or Linux Device Drivers.
Old 05-06-2013, 07:10 PM   #3
LQ Newbie
Registered: Apr 2009
Location: USA
Distribution: Red Hat Based Distros
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks Mina,
I forgot that cscope only looks at c files :P.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hi Linux questions. Another old dog learning new tricks is here.... gtrub00 Member Intro 1 01-07-2011 10:31 AM
add global variable in linux kernel sourcecode sid18 Linux - Kernel 3 01-18-2008 08:43 PM
MEPIS/Linux learning curve questions 21Williamkp Linux - Software 3 05-01-2006 09:40 PM
kernel-sourcecode-2.6.8-1.603.noarch.rpm RottenMutt Fedora 5 10-13-2004 10:21 PM
kernel-sourcecode-2.6.8-1.603.noarch.rpm RottenMutt Red Hat 1 10-12-2004 02:42 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration