LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-25-2009, 07:04 PM   #1
jsjcaowei
LQ Newbie
 
Registered: Nov 2009
Posts: 10

Rep: Reputation: 0
linux kernel first process


Dear:

I start to learn linux Boot and Kernel.

But I don not find which is the first process when my UBoot(Or RedBoot) ends and gives the contol rights to Kernel. Or the first file in kernel code.

my kernel version : 2.6.29.1.

thank you
 
Old 11-25-2009, 07:48 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
There is no one "first file in kernel code" - it's architecture dependent. You could try ../arch/<your_arch>/boot/header.S and meander from there.
Trying to read the kernel from the beginning will be an interesting challenge. I'd suggest you try small bites first.
www.kernelnewbies.org might be a good place to visit.
 
Old 11-25-2009, 08:01 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, jsjcaowei -

syg00 is correct - the answer to "what is the first process" or "what is the source code for the first process" is, unfortunately:

"It depends".

However, in general, the "first process" can safely be considered "init". Its source code code, "init/main.c", can be seen here:

http://lxr.linux.no/#linux+v2.6.31/init/main.c

Good, high-level descriptions of the boot process can be found here:

http://www.redhat.com/docs/manuals/l...n-process.html

http://tldp.org/LDP/sag/html/boot-process.html

A good, high-level overview of the kernel itself: particularly the relationship between the kernel, user-space Linux programs running under the kernel, and hardware resources managed by the kernel, can be found here:

http://www.ibm.com/developerworks/li...-linux-kernel/

'Hope that helps .. PSM
 
Old 11-25-2009, 08:36 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,671
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
It basically goes like this:
  1. When you boot the computer, a special program called a boot loader is brought into memory. It, in turn, loads a kernel image into memory (replacing itself), and hands over control of the system to it.
  2. The kernel manually constructs all of the various lists and data-structures that it will use in the course of normal operations ... the memory heaps, the basic device-tables, and the process list. When built, the process list contains (usually) one entry: a very special process that by-definition is not allowed to die. That process is called init.
  3. Once this initialization is finished, the kernel switches into virtual-memory mode and then activates the process-dispatcher ... which is now able to do its job because "a process" does exist: the process-list is not empty and it never will become so. From this point forward, init, and the various other processes that it spawns, "run the show."
As you may have guessed, this picture is somewhat over-simplified, but "for our purposes here, it will suffice."
 
1 members found this post helpful.
Old 11-25-2009, 08:53 PM   #5
jsjcaowei
LQ Newbie
 
Registered: Nov 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Dear syg00 and paulsm4:
thank you.
 
  


Reply



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
process priorities in linux kernel rkemiset Linux - Kernel 0 08-25-2009 11:53 PM
How to Debug Linux Kernel Boot process kushalkoolwal Linux - Kernel 4 06-22-2006 06:30 PM
checkpointing a process using linux kernel programming Karthikeyan.C Linux - Kernel 3 05-23-2006 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:09 AM.

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