1 |
On Sun, Apr 10, 2016 at 5:37 AM, Duncan <1i5t5.duncan@×××.net> wrote: |
2 |
> |
3 |
> Tho with the initr*, I did go the dracut route myself. But I'm still not |
4 |
> entirely convinced that I wouldn't have been better off rolling my own, |
5 |
> as I'm still not entirely comfortable with the level to which I |
6 |
> understand, or more accurately don't understand, dracut. Tho I do |
7 |
> understand it well enough to have cut it down to the modules I need, |
8 |
> only, but I still don't understand the scripts at the level I know I |
9 |
> would had I created them myself... |
10 |
> |
11 |
|
12 |
Well, by this logic you ought to be writing your own kernel as well. |
13 |
How else are you going to deal with a kernel panic? :) |
14 |
|
15 |
Dracut is pretty straightforward though and fairly well-documented. |
16 |
It runs through a series of stages like detecting devices, mounting |
17 |
filesystems, and so on. Plugins can run at any stage, and they also |
18 |
can add files to the initramfs at time of creation. |
19 |
|
20 |
The advantage of using something standard is that somebody else has |
21 |
probably already thought of all the edge cases already, and they'll |
22 |
fix the bugs as well. If you contribute your plugin upstream they'll |
23 |
take care of it for you as well. |
24 |
|
25 |
So, you can just put one line in a config file to add /usr/bin/btrfs |
26 |
to your initramfs and the built-in code will figure out that you'll |
27 |
need /usr/lib64/liblzo2.so.2 installed there as well. Of course, that |
28 |
is just an example as somebody else has already written the btrfs |
29 |
module. |
30 |
|
31 |
I was running into some kind of strange md-raid behavior ages ago and |
32 |
worked around it by writing a quick module: |
33 |
https://rich0gentoo.wordpress.com/2012/01/21/a-quick-dracut-module/ |
34 |
|
35 |
That one is a bit of a hack - I suspect there was some underlying bug |
36 |
in udev or something preventing the raid from being set up by the |
37 |
normal module. I suspect that module would no longer be needed (I've |
38 |
since moved on to btrfs). However, it demonstrated how dracut plugins |
39 |
work - you just define hooks that get run at the appropriate phase. |
40 |
|
41 |
-- |
42 |
Rich |