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 ) .
Update history:
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.
File | Gentoo.vdi |
Size | 1.64GB |
crc32 | 1672649006 |
md5 | d7000e2732cb167ed0c5201aca421db3 |
sha512 | 38c07d40cd7f34335f715e2b658c2109e37780fe0eb282b6a60cc7a28e1cf6fe402ed3d3019ea43ac6f22b85c30efcdcd21bdf1a4858dd3143a439bc34607d46 |
File | unified_config.tar.xz |
Size | 67.25kB |
crc32 | 87079166 |
md5 | e508bdcdf8e8091fa28c4f859d25f695 |
sha512 | 0dd128b30f0eefbcd1812ac7c9ac91a3ec40023a6668b06b56be3d0167732c787c8af0a2bfbd8a1bd169edb6e8015ee5271c007e2d34652354f3b40743658936 |