Add the ability for clr-boot-manager to handle removing content from
the kernel commandline. The removal configuration files are formatted
exactly the same as the add configuration files. The matches are done
line-by-line so that:
"option-a option-b"
in a removal file would only delete exactly that string unlike:
"option-a
option-b"
in a removal file which would try to remove "option-a" and "option-b"
separately.
This change introduces support for vendor kernel configuration fragments,
which typically live within the /usr/share/kernel/cmdline.d directory.
These are useful to vendors and OEMs to pre-enable some hardware quirks
such as acpi_os, i8042 tweaks, etc.
These files take a higher precedence than the /etc/ files, however to
ensure we abide by a proper stateless policy we allow the concept of masking
and disabling in the style of systemd. The files in the "vendor config"
directory are considered masked when a file with the same base name lives
within the "system config" (/etc/kernel/cmdline.d) tree. The vendor file
will be skipped regardless of system config validity in this instance.
To allow disabling entirely of the vendor config file, the local system
administrator may follow the masking approach as described as above, but
instead of creating a override, symlink this file to /dev/null. This will
cause the file to be removed entirely from any kind of parsing. This link
logic is only valid within the context of the system config directory.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
These tests verify the basic install & update functionality for the
bootloaders, not the kernels. It should be noted that in the case of
syslinux, we have a restricted feature-set. As such we *always* report
that syslinux needs an update when the source file changes, because
it's far cheaper than actually reading the block device itself.
This change also addresses the gptmbr bin file being 1 byte too long,
which was revealed during the development of this test.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This test adds very basic coverage for doing a basic image installation,
using the syslinux legacy path.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
To make it easier to manipulate the cmdline that is emitted into the
per-kernel boot entries, we add a new parser to clr-boot-manager. This
parser will be responsible in future for loading a *per kernel* cmdline,
as well as loading a global system cmdline.
The first file to be read will always be /etc/kernel/cmdline, and after
this the files in /etc/kernel/cmdline.d/*.conf will be read in, which is
then merged into a single cmdline line.
The file format permits new lines and comments, which are stripped from
the emitted text. It also takes care to skip unnecessary whitespace,
allowing the cmdline to be built in layers from various locations.
Two immediate consequences arise: The ability for the user to append to
the default kernel cmdline, and the ability for vendors to provide
quirks and such by default, without modifying kernel packages or CBM
itself.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
Instead of hard-coding the OS ID into clr-boot-manager at build time,
we'll be able to use the standardised {/etc/,/usr/lib/}os-release file
to provide updated OS identity information.
This change adds the os-release parser, which takes steps to ensure that
only predefined sane keys are used, and that value keys never have NULL
values.
In the absence of all configuration, an empty map is returned to allow
the library to make use of default values and not rely on extensive
error handling in multiple locations, making the change far less
invasive.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
Much of our low coverage rate can be attributed to using an imported version
of libnica, without the test suites. This change incorporate much of the nica
test suite for the core types that we utilize.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This is just part of improving coverage within clr-boot-manager, and is
a critical requirement given that we have changed how we determine that
two files differ.
With that said, we still do have the test harness that makes heavy use of
cbm_files_match, and one can clearly see that by deliberately inverting
logic in paths within cbm_files_match, the harness tests then completely
fail.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
As the cbm_files_match function now uses a mmap'd stream-byte comparison,
the requirement for get_sha1sum has disappeared within clr-boot-manager.
Thus, we remove the no longer necessary code, and remove the requirement
for OpenSSL from the codebase permanently.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>