When checking whether we're trying to print an initrd directive for the
early microcode initrd again, use the streq macro instead, as it handles
the edge cases for us.
Make sure we only attempt to match at the end of the string, so we
don't accidentally fail if we also match earlier in the string, e.g.
foo-ucode.cpio-ucode.cpio
We still have to print the initrd entry first, but need to leave it in
the hashmap because it hasn't been copied to the ESP yet. Instead, just
skip printing it again when we print the rest.
Now that we identify microcode initrds for early loading, write the
entry for the one we've picked prior to all other initrds, then remove
it from the bootmanager's hashmap so we don't write it again with the
rest.
Check the user- and system-owned initrd.d directories for potential
microcode initrds (*-ucode.cpio). Save the first one found.
Later, we'll make sure that's the first entry we emit when writing the
loader config files.
In some cases (legacy in particular) /proc/self/mounts contains
/dev/root as the device the root path ('/') resolves to. This isn't
a valid device and so fall back to using stat in cases where
cbm_system_get_device_for_mountpoint doesn't return a device path.
Signed-off-by: William Douglas <william.r.douglas@gmail.com>
When using autofree, pointers must be initialized to NULL otherwise
use of uninitialized data might occur in the handler.
Signed-off-by: William Douglas <william.r.douglas@gmail.com>
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.
Make sure we honor users timeout configuration propagating it to config file when
running update command.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
With recent systemd changes cbm use cases will break if we don't add ".conf" to the
loader.conf default entry configuration.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Currently we can't set default kernel with extlinux/syslinux because we basically
the current implementation doesn't load the installed kernel data and when comparing
the detected ones to check with the selected kernel we'll use a data the set-kernel
command doesn't provide us. Long story short this patch brings to life the
set-kernel command for legacy bios mode bootloaders.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
This will affact the list-kernels command that for now with legacy bios mode will
not list the actual default kernel(the one starting with *).
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
The biggest difference between extlinux and syslinux from cbm point of view is the
bootloaders install/update command. Having said that, This patch unifies the
syslinux and extlinux implementation reducing much of duplication on that side.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Make sure extlinux is consistent with syslinux and mark the boot partition as legacy
bios bootable.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Make our life easier, put together all the required steps before cutting a new
release instead of having to remember it all.
Change the VERSION file, create the release commit and tag. Bonus point added a
--help flag so we can easily remember how this script works.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
For some reason (may be a user manual intervention or some issue on previous
updates) the syslinux/extlinux config file may be empty and in that case cbm will
segfault when reading the content's buffer.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
By using syslinux-nomtools we don't depend on mtools and reduce the footprint for
smaller images.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
If we don't find the boot partition then we warn the user exit, currently we
segfault.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
With the commit 512323d we started ignoring the --path flag therefore breaking image
mode use cases. This patch brings back --path flag.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
We've found some cases where the path to LoaderDevicePartUUID will have
some "virtual" entries containing some "garbage" in the path. This patch
makes sure we always match only the right formatted ones.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Avoid parsing flags, allocating BootManager twice when calling update
from time out command.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
We would like to disable grub2 in scenarios/configurations where we
know we won't ever use/need it.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>