Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt bootargs file to support btrfs snapshotter #1213

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .obs/specfile/elemental.spec
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ rm -rf %{buildroot}/usr/libexec/.placeholder
%defattr(-,root,root,-)
%doc README.md
%license LICENSE
%dir %{_sysconfdir}/elemental
%dir %{_sysconfdir}/elemental/config.d
%config %{_sysconfdir}/elemental/config.d/snapshotter.yaml
%dir %{_sysconfdir}/cos
%config %{_sysconfdir}/cos/bootargs.cfg
%dir %{_sysconfdir}/dracut.conf.d
Expand Down
26 changes: 23 additions & 3 deletions framework/files/etc/cos/bootargs.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
set kernel=/boot/vmlinuz
# bootargs.cfg inherits from grub.cfg several context variables:
# 'img' => defines the image path to boot from. Active img is statically defined, does not require a value
# 'state_label' => label of the state partition filesystem
# 'oem_label' => label of the oem partition filesystem
# 'recovery_label' => label of the recovery partition filesystem
# 'snapshotter' => snapshotter type, assumes loopdevice type if undefined
#
# In addition bootargs.cfg is responsible of setting the following variables:
# 'kernelcmd' => essential kernel command line parameters (all elemental specific and non elemental specific)
# 'kernel' => kernel binary path within the target image
# 'initramfs' => initramfs binary path within the target image

if [ -n "${img}" ]; then
set img_arg="elemental.image=${img}"
fi

if [ "${mode}" == "recovery" ]; then
set kernelcmd="console=tty1 root=LABEL=$recovery_label elemental.image=${img} rd.neednet=0 elemental.oemlabel=$oem_label"
set kernelcmd="console=tty1 root=LABEL=${recovery_label} ${img_arg} elemental.mode=${mode} rd.neednet=0 elemental.oemlabel=${oem_label}"
else
set kernelcmd="console=tty1 root=LABEL=$state_label elemental.image=${img} panic=5 rd.neednet=0 elemental.oemlabel=$oem_label fsck.mode=force fsck.repair=yes"
if [ "${snapshotter}" == "btrfs" ]; then
set snap_arg="elemental.snapshotter=btrfs"
fi
set kernelcmd="console=tty1 root=LABEL=${state_label} ${img_arg} ${snap_arg} elemental.mode=${mode} panic=5 rd.neednet=0 elemental.oemlabel=${oem_label} fsck.mode=force fsck.repair=yes"
fi

set initramfs=/boot/initrd
set kernel=/boot/vmlinuz
3 changes: 3 additions & 0 deletions framework/files/etc/elemental/config.d/snapshotter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
snapshotter:
type: btrfs
max-snaps: 4
Loading