LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-03-2012, 03:12 PM   #1
beyond
LQ Newbie
 
Registered: Feb 2012
Location: delhi(INDIA)
Distribution: Fedora 16
Posts: 26

Rep: Reputation: Disabled
linux kernel booting


Plz. do rectify me at all the wrong points!!!

when bootloader in bios executes its code, it do POST and other things...then as I read from somewhere kernel does initrd to load some basic modules so as to mount the root file system and then removes initrd filesystem to make the space .....
1.how does kernel do initrd as the kernel(vmlinuz) itself is present on the harddisk ....i mean how the control is transferrred to the kernel(present in hdd) from the bios????
--at initial point drivers(i mean the protocol to access the harddisk) is not known then how the MBR is accessed ??
2.can we put the kernel (even though very small part of it) in the bios itself??



Regards,,
saurabh

Last edited by beyond; 03-03-2012 at 03:17 PM.
 
Old 03-03-2012, 03:30 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

quite a sophisticated process that you're trying to understand!
The boot process is actually more complicated than you think. Your understanding is more or less correct, but incomplete.
  1. BIOS does self-test and a basic initialization of hardware (HDD controller, display, keyboard)
  2. BIOS looks for a valid boot media, usually the first HDD (could also be a USB storage device)
  3. BIOS loads the first physical sector of the boot drive into memory (not knowing anything about file systems), assumes that it contains machine code, and executes that code. Usually this sector is the beginning of the bootloader (e.g. GRUB) which takes over now. GRUB contains file system drivers for the configured boot partitions.
  4. The boot code usually loads more code (a few more sectors), as much as it takes
  5. The bootloader analyzes the boot configuration, displays the boot menu and waits for the user to select an item
  6. The bootloader loads the selected kernel plus the associated initrd (if any), and hands control to the loaded kernel

Quote:
Originally Posted by beyond View Post
2.can we put the kernel (even though very small part of it) in the bios itself??
In theory, that's possible, and something like that is often done in embedded systems. But then the kernel is usually located in a Flash memory, which is mounted like it was a Readonly-HDD.

[X] Doc CPU
 
1 members found this post helpful.
Old 03-03-2012, 03:37 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
For all it's worth (assuming you're using something that uses GRUB):
http://docs.redhat.com/docs/en-US/Re...ub-whatis.html


Cheers,
Tink
 
1 members found this post helpful.
Old 03-03-2012, 04:09 PM   #4
beyond
LQ Newbie
 
Registered: Feb 2012
Location: delhi(INDIA)
Distribution: Fedora 16
Posts: 26

Original Poster
Rep: Reputation: Disabled
thanks Tinkster and Doc CPU,,,
one more question:
1.does the meaning of bootloader is limited to any code that cause the booting of os??
2.the bios also does a similar thing(not activating the OS,, a lot of initiallisation and other things),, is it also a (sort of)bootloader???
 
Old 03-03-2012, 04:33 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Ad 2)
The BIOS reads the first few bytes (I think 512) of the first sector
of the boot device into memory, and point the execution pointer of the
CPU at it.
Ad 1)
I don't really understand what you're saying, but:
The boot loader (part of which sits in those 512 bytes above) will then
try to load the kernel (or the "other OSes" equivalent), and have it
carry on with execution in the same way - setting the CPUs execution pointer
at the memory location into which it loaded whatever it slurped of the disk.



Cheers,
Tink
 
Old 03-05-2012, 05:40 AM   #6
beyond
LQ Newbie
 
Registered: Feb 2012
Location: delhi(INDIA)
Distribution: Fedora 16
Posts: 26

Original Poster
Rep: Reputation: Disabled
So sir,
1.can i say that after the initiallisation that the bios do, the bios code can access all the peripherals completely???

2.I mean that from the bios code only,, can i acess the harddisk completely..specifically the kernel bcz. If i have accessed the MBR!! which is in harddisk, so can i access the remaining part of it too ??

3.if not. Then is it possible to extend the size of MBR(just asking) so as to fit the kernel in it(it will initiallise all the peripherals and other things ) thus removing the bootloadr??
 
Old 03-05-2012, 01:17 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by beyond View Post
So sir,
1.can i say that after the initiallisation that the bios do, the bios code can access all the peripherals completely???
You can say that, but it's wrong. =o)


Quote:
Originally Posted by beyond View Post
2.I mean that from the bios code only,, can i acess the harddisk completely..specifically the kernel bcz. If i have accessed the MBR!! which is in harddisk, so can i access the remaining part of it too ??
No you can't. From BIOS you can access what's in MBR. Full stop. Period. End
of BIOS' responsibility.


Quote:
Originally Posted by beyond View Post
3.if not. Then is it possible to extend the size of MBR(just asking) so as to fit the kernel in it(it will initiallise all the peripherals and other things ) thus removing the bootloadr??
No. MBR is 512 bytes (unless you write your own BIOS and flash it to your motherboard),
that's all you get to play with. And no, I don't think you can write a replacement kernel
that will fit in there and do all the work.


Cheers,
Tink
 
Old 03-05-2012, 03:51 PM   #8
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

let me add a few words to what Tinkster said.

Quote:
Originally Posted by beyond View Post
1.can i say that after the initiallisation that the bios do, the bios code can access all the peripherals completely???
No, definitely not. The BIOS won't initialize and care for sound cards, TV cards, integrated modems, let alone special hardware like CAN cards or something. It initializes just a basic set of peripherals, like VGA, keyboard, HDD controller and disks, FDD controller (if present), serial and parallel ports (if present) and USB controllers. I may have forgotten something, but I think that's it more or less.

Quote:
Originally Posted by beyond View Post
2.I mean that from the bios code only,, can i acess the harddisk completely..specifically the kernel bcz. If i have accessed the MBR!! which is in harddisk, so can i access the remaining part of it too ??
BIOS contains functions to access hard disks on a sector-by-sector basis, not knowing anything about file systems. So yes, basically it could also read any other part of the hard disk. But standard implementations just read the very first sector, which contains the boot record and the partition table. Usually they leave anything else to the operating system that's about to be started.
On newer computers that support GPT partitioning, the GUID partition table can be several sectors long, starting after the traditional MBR.

Quote:
Originally Posted by beyond View Post
3.if not. Then is it possible to extend the size of MBR(just asking) so as to fit the kernel in it(it will initiallise all the peripherals and other things ) thus removing the bootloadr??
No. You're confusing hardware matters and software structures. The MBR (Master boot record) is a part of the very first sector. That's by definition. But well, one could, in theory, create a very specialized operating system that starts directly from the MBR. But I don't know any system that actually works this way.

[X] Doc CPU
 
Old 03-06-2012, 07:51 AM   #9
beyond
LQ Newbie
 
Registered: Feb 2012
Location: delhi(INDIA)
Distribution: Fedora 16
Posts: 26

Original Poster
Rep: Reputation: Disabled
thanks Doc CPU and Tinkster,, for clearing some of my doubts...



Regards,
 
  


Reply

Tags
bios, boot, kernel, linux



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
uncompressing linux ok, booting the kernel 'then nothing' fez1200 Linux - Newbie 12 11-17-2010 12:05 PM
Linux Kernel problem while booting muvendrann Linux - Kernel 1 01-27-2010 04:29 PM
smp kernel: uncompressing Linux ..ok booting the kernel krissb Linux - General 1 11-16-2005 06:31 PM
booting new kernel. Booting new kernel dies with INIT: VFS issue, really mus335 Linux - General 0 04-21-2004 11:52 AM
Booting my Linux Kernel natto34 Linux - General 1 07-11-2002 02:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:13 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