Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Cc: frares@×××××.com
Subject: Re: [gentoo-user] /dev/sda* missing at boot
Date: Fri, 19 Aug 2011 13:50:06
Message-Id: 1439087.joxse6lcPE@nazgul
In Reply to: Re: Re: [gentoo-user] /dev/sda* missing at boot by frares@gmail.com
1 On Fri 19 August 2011 13:12:25 frares@×××××.com did opine thusly:
2 > I the case I don't need a initram, I guess that the grub line for
3 > parameter passing to the kernel would be empty. Am I wrong?
4
5 Yes.
6
7 Using or not using kernel parameters has nothing to do with whether
8 you use an initramfs or not.
9
10 It's the initrd line in grub you do not need.
11
12 >
13 > I was just looking on how to build my own initram. What is it
14 > supposed to do anyway?
15
16 First, it's initramfs (the previous incarnation was initrd). You
17 should use the correct name.
18
19 An initramfs is a filesystems image stored on disk in a place that
20 grub can find. It contains a kernel, essential drivers and other bits
21 and pieces. When booting, grub finds the image, bangs it into memory
22 and instructs the cpu to start executing at a known point.
23
24 Why is this useful?
25
26 For Gentoo it usually isn't (there are times when it is - see below).
27 Binary distros like Ubuntu and Fedora absolutely require this. These
28 distros do not know what hardware you have and what drivers you
29 require, so they supply drivers for everything. But Ubuntu cannot
30 possibly compile into the kernel every possible driver you might need
31 to boot as the list would be huge (every known floppy, CD, USB, every
32 known MFM, IDE, SATA, SCSI, netboot, Fibre and more driver for a
33 start), so what they do instead is probe the hardware at boot time,
34 find out what you have, and load the driver modules you DO need.
35
36 This is the problem. The kernel wants to load disk drivers so that it
37 can access the disk and continue booting. Where are the drivers? Well,
38 they are on the disk. Oops, circular problem.
39
40 The difficulty is not finding and loading drivers, it's how do you get
41 the disk driver off the disk before you have the disk driver in
42 memory? (think chicken and egg here).
43
44 An initramfs solves this nicely. Grub shoved a disk image into memory
45 when it booted. The kernel knows how to access it's memory it doesn't
46 need a driver for that. And now the files containing the needed
47 drivers are on a virtual disk *in memory*. The kernel loads them, and
48 can now access the real physical disks.
49
50 Lots more complicated stuff then happens, like getting rid of the
51 virtual filesystem from the initramfs and mounting the real filesystem
52 from disk at /, but that's beyond the scope of this mail.
53
54 Gentoo mostly doesn't need any of this because you do know your
55 hardware and can just compile your disk drivers into the kernel - this
56 is the very thing that Ubuntu cannot do.
57
58 Some Gentoo users still need an initramfs, such as booting off drives
59 in a RAID configuration. They need the RAID drivers first to read the
60 disks so use an initramfs to fix this little problem exactly as Ubunut
61 fixes their problem.
62
63 Make sense?
64
65
66 --
67 alan dot mckinnon at gmail dot com

Replies

Subject Author
Re: Re: [gentoo-user] /dev/sda* missing at boot frares@×××××.com