Calling stat() on some filesystems, like Btrfs,
results in a dev_t with no relation to the backing device(s),
and subsequent failure to detect the root fs.
Add support such filesystems by retrieving the block device from
`/proc/self/mounts` and working on from there.
Resolves#61, #182 and #193.
Improve the internal filesystem detection, with these changes we
can reuse this code elsewhere and be more efficient - other areas
needing the filesystem knowledge can use this mapping strategies
adding a more precise and centralized code to that.
This patch also makes sure to keep tests and filesystem checks more
consistent.
When mounting we were assuming the /boot filesystem to always be
vfat, with this code now we can have /boot partitions with whatever
filesystem we support (for now: vfat, ext[2-4]).
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Without a FS type set, all tests will fail because none of the
bootloaders are compatible. We change the tests to simulate the
appropriate FS type so that these tests succeed as expected.
`syslinux` is a bootloader for `FAT` filesystems. `extlinux` is a bootloader
for `ext` filesystems. The name therefore is entirely incorrect, since the
code clearly is using `extlinux` and we may want to support `syslinux` at
some point in the future.
This is a mostly mechanical rename/replace.
gummiboot hasn't been supported upstream or by Clear Linux for an age,
and due to format bumps no compatibility is required with it, thus it
can be completely removed from source.
goofiboot, the fork of gummiboot, was initially created to address concerns
in systemd-boot in their tooling. However, the concerns were mitigated by
opting to entirely bypass their tooling, and clr-boot-manager absorbed all
safety and distribution support that was part of libnica and goofiboot.
At this point, both of the legacy bootloaders are safe to be nuked from
orbit and are no longer used in CBM-using distributions.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This change allows the installation of a shim when using systemd-boot as
the bootloader. It also enables the management of EFI variables to
manage the default boot device.
The shim will eventually become a required piece for secure-boot enabled
booting.
As of glibc 2.25, warnings will be emitted at compile time to state
that you must explicitly include the header now, due to libraries
tending to have their own definitions.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
With a GPT disk, in native mode, we should ensure that we only use syslinux
if the native system isn't actually UEFI. This test will account for that,
in preparation for issue #58.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
In accordance with issue #53, we must only use the PartUUID for root=
entries when we *know* that the partition definitely resides on a GPT
disk.
Whilst an EFI System Partition must live on a GPT disk to be considered
a valid ESP, there is no such constraint on the rootfs itself. Cases
emerged during testing of an MBR rootfs partition, with a GPT disk used
to house the ESP itself.
This change ensures we only ever write a root=PARTUUID if we're fully
certain of the topology, otherwise all bootloaders will automatically
fall back to root=UUID entries.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This test exposes bugs within the core cbm_inspect_root function, by
validating exactly *which* bootloader we select depending on the system
topology.
The tests show that the majority of cases are handled properly, however
when encountering a UEFI system, and we have not been able to explicitly
find the ESP (which is allowed to be mounted already), we fail to select
the UEFI capability, and *very* incorrectly fallback to GRUB2.
Obviously this is highly broken but the test suite is required to develop
the correct functionality, whilst being able to validate changes for *all*
of the possible configurations.
This test is required for issue #54.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>