If the CoreOS developer image was used to build custom kernel modules for the
same kernel version as in a CoreOS image, these modules can be added to the
existing set with overlayfs. This example mount unit illustrates this if the
modules are available under /mnt. Note that usual overlayfs requirements
apply: namely that the working directory must be on the same root as the upper
layer, and it needs to support extended attributes.
[Unit]
Description=Add custom kernel modules into the mix
ConditionPathExists=/mnt/%v
[Mount]
Type=overlay
What=overlay
Where=/lib/modules/%v
Options=lowerdir=/lib/modules/%v,upperdir=/mnt/%v,workdir=/mnt/wd
On the first boot, module dependency information should be generated for the
union of the module directories. Tools like modprobe (and udev, which uses
modprobe) rely on this dependency information for loading modules. It is
optional if the additional modules will just be insmoded.
[Unit]
Description=Generate module dependency files
ConditionPathExists=!/mnt/%v/modules.dep
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/depmod %v