LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 11-26-2008, 04:08 AM   #1
PlatinumX
Member
 
Registered: May 2008
Location: France
Distribution: Debian / Fedora / Gentoo
Posts: 178

Rep: Reputation: 15
How can a kernel boot without initramdisk ?


Hey all,

My question is about the overall Linux boot process.

I understood that the initramdisk loaded at boot time, contains modules essential to access the physical location of the kernel (modules to support IDE, SCSI, SATA,...).

So, I don't understand now how a kernel compiled without any modules can boot ?
How the bootloader access the hard-drive to find the kernel ?

Thanks
 
Old 11-26-2008, 04:17 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,352

Rep: Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042
Quote:
Originally Posted by PlatinumX View Post
I understood that the initramdisk loaded at boot time, contains modules essential to access the physical location of the kernel (modules to support IDE, SCSI, SATA,...).
Close. The initrd needs to include the required driver(s) to (pre-)mount the root - the kernel is loaded into storage by the bootloader. If you compile your own kernel and include the necessary drivers no initrd is needed.
 
Old 11-26-2008, 05:51 AM   #3
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Quote:
So, I don't understand now how a kernel compiled without any modules can boot ?
That is putting it incorrectly. You mean a kernel without an initrd, not without modules - having a kernel without either is impossible. Either you leave out certain key modules, in which case they have to be included into the initrd, or you compile them straight into the kernel, in which case an initrd is not required.
 
Old 11-26-2008, 07:08 AM   #4
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by PlatinumX View Post
So, I don't understand now how a kernel compiled without any modules can boot ?
Kernel without initrd can easily boot, but only if all required modules are compiled into kernel. Usually "required modules" means filesystem modules, few modules that are required by filesystem, and maybe few modules that might be required to access your hardware. If some modules won't be compiled in, then kernel might not be able to mount root partition. Personally, I prefer to use kernel without initrd, unless using initrd is absolutely necessary.

Quote:
Originally Posted by PlatinumX View Post
How the bootloader access the hard-drive to find the kernel ?
I'd suggest to read info about how boot loader works, or take a look at lilo/grub source. It probably won't be easy reading, though.
 
Old 11-26-2008, 02:06 PM   #5
PlatinumX
Member
 
Registered: May 2008
Location: France
Distribution: Debian / Fedora / Gentoo
Posts: 178

Original Poster
Rep: Reputation: 15
Quote:
That is putting it incorrectly. You mean a kernel without an initrd, not without modules
Right, my post was confused about initramdisk and kernel modules.
Quote:
Close. The initrd needs to include the required driver(s) to (pre-)mount the root - the kernel is loaded into storage by the bootloader.
So the bootloader is able to mount and read any kind of filesystem to open the kernel ? Ext2,3,4,XFS,JFS...even the most exotic filesystem ?
 
Old 11-26-2008, 03:06 PM   #6
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by PlatinumX View Post
So the bootloader is able to mount and read any kind of filesystem to open the kernel ? Ext2,3,4,XFS,JFS...even the most exotic filesystem ?
AFAIK kernel mounts filesystems, not bootloader.
Read this:
http://home.att.net/~lilo-boot/faq_genl.htm#map_magic
http://home.att.net/~lilo-boot/lilohome.htm
http://www.cromwell-intl.com/unix/linux-boot.html
http://www.ibm.com/developerworks/li...-bootload.html
Honestly, you could find all this yourself long time ago.
 
Old 11-26-2008, 03:26 PM   #7
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Think of it this way, the kernel can be compiled in various ways. You can have one compiled with everything built-in, or one compiled with almost everything as modules, and something in-between. Not all modules are needed at boot time. The most important ones usually include SATA or AHCI drivers, filesystem drivers, and other drivers critical to the boot process that have to do with accessing the HDD and a few other things. If you have all critical drivers built-in, then there is no need for initrd. The rest of the modules are simply loaded later in the boot process.

The typical catch 22 here is that if you built the filesystem or IDE/SATA/AHCI drivers as modules and have no initrd the kernel will panic. Why ? Because it does not have the required modules to be able to access the HDD, and most unfortunately these are located on the HDD ... yes a catch 22.

The bootloader doesn't have too much to do with this. All it really does is load the kernel into RAM and pass control over to it. Read the wiki for more details:
http://en.wikipedia.org/wiki/Bootloader
 
Old 11-26-2008, 03:55 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,352

Rep: Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042
Quote:
Originally Posted by ErV View Post
AFAIK kernel mounts filesystems, not bootloader
True but irrelevant - mounting is not required for accessing data. Makes it more convenient though.
The loader needs to be aware of filesystem structure so it can navigate the inode chain properly to assemble the kernel. Most filesystems are supported, but new filesystems/features can fail - for example the recent change to ext3 inode size for ext4 compatability. Unpatched versions of grub (at least - I don't know about lilo) failed to load kernels from newly allocated ext3 partitions with the larger inode size.
 
Old 11-27-2008, 07:54 AM   #9
PlatinumX
Member
 
Registered: May 2008
Location: France
Distribution: Debian / Fedora / Gentoo
Posts: 178

Original Poster
Rep: Reputation: 15
Quote:
True but irrelevant - mounting is not required for accessing data
This is the information I missed: the bootlaoder is able to read the kernel (which is a file) without mounting the filesystem itself. (which is the role of the kernel).

Thanks
 
Old 11-27-2008, 09:45 AM   #10
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by syg00 View Post
True but irrelevant
Not irrelevant, because this means that bootloader uses other mechanisms to access required files.

Quote:
Originally Posted by syg00 View Post
Unpatched versions of grub (at least - I don't know about lilo)
I already gave link to lilo documentation where it is explained how lilo works. Looks like it doesn't understand filesystems at all and simply uses disk offsets (or something similar).
 
Old 11-27-2008, 10:15 AM   #11
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
It's true that lilo uses disk offset to access the drive, so this is why it's recommended to use an ext2 /boot partition, because with journaled filesystems the disk offset for the kernel may actually change and lilo will no longer find it. GRUB on the other hand seems to have different stages for each filesystem, for example look inside '/boot/grub' if you have it installed...

Code:
bash-3.1$ ls -1 /boot/grub
device.map
e2fs_stage1_5
fat_stage1_5
ffs_stage1_5
grub.txt
iso9660_stage1_5
jfs_stage1_5
mbr.sda.17811
menu.lst
minix_stage1_5
reiserfs_stage1_5
stage1
stage2
stage2_eltorito
ufs2_stage1_5
vstafs_stage1_5
xfs_stage1_5
 
  


Reply

Tags
kernel


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
no /boot/loader and no /boot/kernel/kernel error message on a free bsd install chownuseradd Linux - Newbie 1 02-09-2008 08:05 PM
DSL Kernel Wont detect Flash drive on boot, cant boot =( Javahulk Linux - General 1 03-24-2005 02:59 PM
CAVEAT: /boot/kernel.h & how not to clobber your kernel sources (Conectiva, Red Hat) JCCyC LinuxQuestions.org Member Success Stories 0 08-07-2003 07:49 AM
Kernel Compile Boot Loader? boot disk? SPMcRuube Linux - Newbie 3 12-03-2002 07:02 PM
boot of kernel 2.4.0-ac10 stops after releasing mem used by kernel zielot Linux - Software 0 01-26-2001 06:30 PM


All times are GMT -5. The time now is 07:17 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration