LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-23-2008, 07:58 AM   #1
atmurali
Member
 
Registered: Nov 2007
Location: Kerala
Posts: 42

Rep: Reputation: 15
The Very First Codes of Kernel


After the completion of Boot loader program, Which is the kernel code that may be executed(Architecture Dependent assembly/C code)?
I simply meant the very first code of kernel in which directory?

Shall I get some links to PDF/Books for tracing the kernel sequences?
 
Old 10-23-2008, 02:40 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
The initial startup sequences are always architecture-specific.

For instance, in the x86 architecture, the first part is probably /usr/src/linux/arch/x86/boot/main.c. (At least, for the primary CPU...)

This very-first stage of the boot process (on the x86...) finds itself in "real mode." That is to say, virtual-memory and other fundamental capabilities do not yet exist. So, the very first job is to set up the processor data-structures necessary to enter the so-called "protected mode." From there, remaining data structures are set-up to allow the kernel to avail itself of other fundamental capacities, such as memory-management, multi-CPU handling, and processes.

Each CPU-type upon which Linux has been implemented ... from the smallest handheld device to the biggest "big iron" mainframe ... has its own specific version of this startup sequence.
 
Old 10-31-2008, 03:49 AM   #3
atmurali
Member
 
Registered: Nov 2007
Location: Kerala
Posts: 42

Original Poster
Rep: Reputation: 15
Ok

Thank You,

I think the defferent architecture and board have its own code
and no common code at very first.

Thank You.
 
Old 11-01-2008, 10:22 AM   #4
Matthias
LQ Newbie
 
Registered: Oct 2008
Posts: 9

Rep: Reputation: 0
further question

Related with this issue I have a question which I am wondering
about for a long time.

While loading the kernel the processor is still in real mode.
However in real mode it can only address about 1MB + upper memory.
Usually a Kernel is much bigger than that amount.

How does it works?
 
Old 11-02-2008, 10:18 PM   #5
nigelc
Member
 
Registered: Oct 2004
Location: Sydney, Australia
Distribution: Mageia 7
Posts: 406
Blog Entries: 4

Rep: Reputation: 80
Hi,
When it starts to load the kernel switches to protected mode.
It does it very early on.
Here is how it works.
http://www.xs4all.nl/~lennartb/bootloaders/node3.html

cheers
 
Old 11-03-2008, 08:32 AM   #6
Matthias
LQ Newbie
 
Registered: Oct 2008
Posts: 9

Rep: Reputation: 0
thanks nigelc, its a real interesting page. However
I did not get the point yet. Must the kernel be small
enough before decompressing to fit in to the available
memory in real mode?
 
Old 11-03-2008, 02:02 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
It is my distinct impression that the compressed image must fit there, but the uncompressed image does not. It will be relocated into protected-mode memory.

There are various curiosities about the initial-stage of the boot process on the x86 processors, which after all was designed with floppy disks in mind. The black actually-floppy ones with a big slot.
 
  


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
seeing the actual TCP codes in the kernel muskvar Programming 2 12-05-2007 04:24 AM
about motherboard driver in kernel source codes jianggw Linux - General 2 07-07-2006 12:06 AM
Are the hex codes for colors in a jpg the same codes as used in html? abefroman Linux - Security 3 07-31-2005 03:21 PM
Where can i find comments on Kernel-AODV module source codes? quzheng Programming 0 07-18-2004 03:44 PM
Kernel 2.6 and Extended Keyboard Codes davecs Linux - Hardware 1 05-30-2004 09:09 PM

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

All times are GMT -5. The time now is 01:49 PM.

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