forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POC: Dynamically load ignition and afterburn from rootfs
This is a proof-of-concept of the idea in coreos/fedora-coreos-tracker#1247 (comment) The role of the initramfs originally was just to mount the root filesystem. Us running ignition from the initramfs makes sense, but it doesn't mean the ignition binary has to physically live in the initramfs. In the end state our initramfs for example doesn't need to physically contain NetworkManager for example either. Or for that matter, kernel network drivers. It just has to have enough code to mount the root filesystem, and neither ignition nor afterburn are needed for that. This clearly adds some nontrivial logic to our already nontrivial initramfs. But, it does shave 9M from each copy of the initramfs, so in the likely case of having (transiently) 3 different versions, we will save 27MB in /boot, which is a good amount.
- Loading branch information
Showing
4 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...b/dracut/modules.d/40ignition-ostree/ignition-ostree-firstboot-populate-initramfs.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[Unit] | ||
Description=Ignition OSTree: Populate initramfs for Ignition | ||
DefaultDependencies=false | ||
# Any services looking at mounts need to order after (or before) this | ||
# because it causes device re-probing. | ||
Before=coreos-gpt-setup.service | ||
# Also this one is probing disks | ||
Before=coreos-unique-boot.service | ||
# On the ignition boot, we must have a device labeled `root`. | ||
Wants=systemd-udevd.service | ||
After=systemd-udevd.service | ||
Requires=dev-disk-by\x2dlabel-root.device | ||
After=dev-disk-by\x2dlabel-root.device | ||
# We need to run before any services which execute: | ||
# - /usr/bin/ignition | ||
# - /usr/bin/afterburn | ||
Before=ignition-fetch.service | ||
Before=afterburn-network-kargs.service | ||
ConditionKernelCommandLine=ostree | ||
OnFailure=emergency.target | ||
OnFailureJobMode=isolate | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
# So we can transiently mount sysroot | ||
MountFlags=slave | ||
ExecStart=/usr/libexec/ignition-ostree-transposefs populate-initramfs-pre-ignition |
19 changes: 19 additions & 0 deletions
19
.../dracut/modules.d/40ignition-ostree/ignition-ostree-subsequent-populate-initramfs.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Unit] | ||
Description=Ignition OSTree: Populate initramfs (subsequent boot) | ||
After=initrd-root-fs.target | ||
# We need to run before any services which execute: | ||
# - /usr/bin/ignition | ||
# - /usr/bin/afterburn | ||
Before=afterburn-hostname.service | ||
# This ensures we don't duplicate work on firstboot | ||
ConditionPathExists=!/usr/bin/ignition | ||
ConditionKernelCommandLine=ostree | ||
OnFailure=emergency.target | ||
OnFailureJobMode=isolate | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
# So we can transiently mount sysroot | ||
MountFlags=slave | ||
ExecStart=/usr/libexec/ignition-ostree-transposefs populate-initramfs-subsequent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters