Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
what on earth is an initrd?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
batistuta
Veteran
Veteran


Joined: 29 Jul 2005
Posts: 1384
Location: Aachen

PostPosted: Thu Apr 13, 2006 8:17 am    Post subject: what on earth is an initrd? Reply with quote

I don't get this thing :?
I understand that it is something (an actual kernel of some sort) that gets loaded before the actual kernel into a RAM disk. But what I don't get is: the thing gets loaded into a RAM disk. It initializes stuff (God knows what, I dont' get that part). Then does it load the actual kernel? If so, do they have to be the same kernels? Does the initrd kernel kill himself after? I would say either no, or both kernels have to be the same. Because otherwise would could end up with a situation that the first kernel recognizes some hardware and the second doesn't.
Does anyone have a good link? Thanks
Back to top
View user's profile Send private message
bin-doph
Guru
Guru


Joined: 23 May 2003
Posts: 302

PostPosted: Thu Apr 13, 2006 8:34 am    Post subject: Reply with quote

How about this

http://www.google.com/search?q=initrd

First hit

http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/initrd.html

hth
-fe
_________________
perl -e '$_=q;4a75737420616e6f74686572205065726c204861636b65720as;;for(s;s;s;s;s;s;s;s;s;s;s;s){s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'
Back to top
View user's profile Send private message
batistuta
Veteran
Veteran


Joined: 29 Jul 2005
Posts: 1384
Location: Aachen

PostPosted: Thu Apr 13, 2006 9:47 am    Post subject: Reply with quote

I did see this in the past (I'm not allergic to google), but it confused me. Let's disect it

Quote:
initrd provides the capability to load a RAM disk by the boot loader.

OK, great. But what is exactly in that initrd file? Does it include a kernel? Since we anyway need to have a kernel image next to it, then we either have two kernel images (one outside and one in the initrd), or the initrd has no kernel image. In short: don't understand what the initrd has.

Quote:
1) the boot loader loads the kernel and the initial RAM disk

Great. Which kernel? What is inside the initial RAM disk that it loads?

Quote:
2) the kernel converts initrd into a "normal" RAM disk and frees the memory used by initrd

I've thought this RAM disk was loaded before. Now something gets converted to it? Which memory was being used by initrd that now is freed? This is as clear as quantum physics.

Quote:
3) initrd is mounted read-write as root

Are you kidding me? I've thought the initrd (whatever that is) was freed. Dead. Gone. Now it gets mounted?

Quote:
4) /linuxrc is executed (this can be any valid executable, including shell scripts; it is run with uid 0 and can do
basically everything init can do)

Finally something that I understand

Quote:
5) linuxrc mounts the "real" root file system

understand something++

Quote:
6) linuxrc places the root file system at the root directory using the pivot_root system call

Is this a fancy name for a chroot?

Quote:
7) the usual boot sequence (e.g. invocation of /sbin/init) is performed on the root file system

cool

Quote:
8 ) the initrd file system is removed

This is hilarious. This initrd guy is like Freddie Krugger, the bustard just doesn't wanna die! He keeps unloading himself, converting himself to all sort of mutant objects, removed, but he keeps popping back. This guy is my new nightmare :D

Anyone out there understand this? :roll:
Back to top
View user's profile Send private message
lordsteff
n00b
n00b


Joined: 30 Jun 2004
Posts: 12

PostPosted: Thu Apr 13, 2006 10:09 am    Post subject: Reply with quote

Perhaps this helps: http://en.wikipedia.org/wiki/Initrd
Back to top
View user's profile Send private message
batistuta
Veteran
Veteran


Joined: 29 Jul 2005
Posts: 1384
Location: Aachen

PostPosted: Thu Apr 13, 2006 11:07 am    Post subject: Reply with quote

So if I understand correctly, the idea is something like this
- Grub loads the kernel image
- Mounts the initrd as root (which has some executables)
- Executes them
- Mounts the real files system
- Boot process keeps going

If this is correct, then there is only one kernel image. Right? The initrd is just like a temparoary root folder, with some executables, with an entry point and nothing else.

Now my pending question is: does an initrd that for example initializes evms, lvm or displays a gensplash image work with any kernel, or is there a tight link between the initrd and the kernel image?
I would guess that if the initrd initializes some SCSI controller as a module for the kernel, then this is kernel dependent. But if the initrd just mounts / from LVM, then the initrd is generic. Am I right?
thanks a lot for the links. The things slowly starts to make sense :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum