After a quick look at the recent Gentoo installations I set up, I noticed a few, recurring problems. The first being that my scripts for building an initrd were hacks centered around genkernel. The second being that genkernel's extensibility, for what I was doing, was poor. And the third being that while I was reusing a lot of configuration files and tricks, I had no one archive containing the majority of them. There were different versions of all my scripts all over the place.
The first two problems were quite easily solved. I hacked together an init system that supports dependency management relatively well. Init modules can require files, binaries, libraries, and directories. The script mkinitrd resolves these dependencies, and attempts to guarantee that each of the init modules requirements is satisfied.
Within this init system, init modules can also define custom configuration options. The functions for these options should create a configuration file in the folder $config_tmp, a temporary folder provided by mkinitrd. Read usr/share/mkinitrd/modprobe for an example of how this is applied. In the script usr/share/mkinitrd/modprobe you can see a function modprobe_option that this module, and all those that come after it can use to define modprobe options. When multiple init scripts give different parameters for a kernel module, they are combined into one modprobe line. These are then written to modules.parameters, which is then included in the initrd as /etc/modules.parameters using the dfile command.
Another interesting consequence of the way these scripts are used, is the menu script. This script allows the user to define multiple init paths to choose from on init, once the menu script is run. The VirtualBox Gentoo image on this website, contains a good example of how this can be applied.
A lot of ready made init scripts are included, amongst which scripts that can be used to initialize an encrypted system, or a system with squashfs as root, and a write overlay. As time goes on, I will gradually be tweaking these scripts, and writing more of them. I will also cover some use-cases on this blog. Updated versions of my configuration files and init system will be added to this blog post.
Below you can find the updated configuration files, and the updated VirtualBox image. All previously provided tarballs and configuration files will not be updated with these new scripts. You can always however simply untar these configuration files to the root of your filesystem and compile your kernel and initrd ( buildkernel && mkinitrd ) .
15 Sept 2015: Published configuration tarball and VirtualBox image.
16 Sept 2015: Added /etc/init.d/restartd to restart services that break
edit restartd to configure it.
-added /bin/mail_debug to mail useful information to debug crashes
to the administrator.
-enabled logging on hiawatha, and configured logrotate.