464 Commits
Author SHA1 Message Date
Leandro Dorileo 696ee57b99 v3.2.2 release
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
v3.2.2
2019-12-12 16:19:37 -08:00
Leandro Dorileo a67ce45cb3 bootman: add user initrd configuration
With these changes the user may add custom initrd freestanding files
into /etc/kernel/initrd.d.

Additionally the user can mask system defined initrd freestanding
by adding symlinks pointing to /dev/null within /etc/kernel/initrd.d.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:02:31 -08:00
Leandro Dorileo f853bfd49b print source and target intrd on error
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:02:31 -08:00
Leandro Dorileo 9d40544ff0 log: add check_*_continue
These utilities are meant to be used whenever a "continue" fits.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:02:31 -08:00
Leandro Dorileo e6c6dfccc5 man: update man page to reflect new flags (-n,--no-efi-update)
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:02:08 -08:00
Leandro Dorileo b21cbe91fa cli: add update_efi_vars configuration file support
The user can set a system-wide configuration to skip efi vars update.
With that the user can insure the efi vars will not be touched when
c-b-m is called by some other tool i.e swupd post update hooks.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:02:08 -08:00
Leandro Dorileo 20a72f0736 skip efi vars update when requested by user
This patch introduces a new flag (-n,--no-efi-update), with that flag
c-b-m will not touch efi variables. It's useful for multi-boot systems
where the user will not want c-b-m messing with the efi configurations.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:02:08 -08:00
Leandro Dorileo f33bbe7f79 cli: properly align help description
Makes sure we properly align flags and descriptions when flags are
larger than current ones.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:02:08 -08:00
Leandro Dorileo 92c883720f github actions: split test executions
Split each test to its own execution, with that we can have a better
visualization of the build type failure.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:01:31 -08:00
Leandro Dorileo 838f6205d5 test: make test runner a bit more "flexible"
Added arguments to the script so we can select the test we want to
run, also make the coverage optional (enabled by default).

Started transitioning the name from travis_test.sh to a more generic
name (run-test-suite.sh).

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:01:31 -08:00
Leandro Dorileo 3a3b49cebb update valgrind suppressions
There are new issues introduced by check we might ignore for now.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-12-12 16:01:31 -08:00
Leandro Dorileo 4868945b21 v3.2.1 release
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
v3.2.1
2019-12-09 13:38:17 -08:00
Leandro Dorileo ff2c817c68 set-timeout: make sure to apply the changes
Currently when the user calls the set-timeout command that change
will only be applied after calling update command, with this patch
we internally call update command.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-11-14 13:18:20 -08:00
Leandro Dorileo 24e2ffd81c add pull_request event to actions
It seems that without pull_request event the pull request will not
get actions triggered.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-11-13 13:07:02 -08:00
Leandro Dorileo f48ea3d436 Add github actions workflow
Preparing to migrate from travis to github actions.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-11-13 12:53:32 -08:00
Leandro Dorileo dd2e383b7a cli: add flags to the usage output
Add usage info wherever the flags -p and -i are relevant.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-11-01 16:40:21 -07:00
Leandro Dorileo 1d2303ab04 cli: remove dead code
We could me things simpler and have a single condition.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-11-01 16:40:21 -07:00
Leandro Dorileo 8de7d13539 readme: add filesystem support table 2019-11-01 14:55:32 -07:00
Leandro Dorileo c4e4903b46 efi: add a entry_label argument
With that each vendor can create a more meaningful uefi menu entry if provided on
build time.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-10-04 21:21:17 -07:00
Anselmo L. S. Melo c7ef26a2ff bootman: deallocate boot device strings
Either boot_device or legacy_boot needs to be maintained, thus
the unused one should be properly deallocated.
2019-09-19 12:03:59 -07:00
William Douglas cdbf756073 v3.2.0 release v3.2 2019-09-18 09:26:50 -07:00
Leandro Dorileo 486486e19a bootman: improve filesystem detection
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>
2019-09-17 15:08:18 -07:00
Leandro Dorileo ef65b290de extlinux: fix extlinux_cmd on partitionless /boot - native_mode
The patch simplifies the extlinux_cmd to work both on image_mode
and native_mode, with /boot partition or not. The -i will work in
both cases, using the --device will also ensure that.

The current form will not work across these scenarios. In a
partitionless in native_mode we'll always need --device to tell
extlinux to install the mbr in a device but install stage files
into /boot, otherwise extlinux will fail telling the device was
not found - it can't find the device "mapped" to /boot.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-17 15:08:18 -07:00
Leandro Dorileo 001623a697 bootman: fix boot directory for "partitionless boot" - native_mode
When running into a system with a partition table where /boot hasn't
its own partition and running in native_mode we must also check if
/boot is empty to determine if we must keep trying to mount or not.

In native mode and without /boot partition we'll always fail to
detect boot device (once we don't have one) but will always report
a fail. This patch makes sure to check if in native we have content
installed into /boot directory and assume it's a partitionless /boot.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-17 15:08:18 -07:00
Leandro Dorileo b5e75c3c6c bootman: fix boot directory for "partitionless boot" - image_mode
When installing into a system with a partition table where /boot hasn't
its own partition - the mount_boot() will reset the bootloader's boot_dir
to reflect to the root directory, given the set_default_kernel() flow
we'll end up having the bootloader configuration installed into /
instead of /boot.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-17 15:08:18 -07:00
Leandro Dorileo 340d16eca5 extlinux: rename config file
extlinux also looks up syslinux.cfg, we're wrongly assuming extlinux
will try to use extlinux.cfg instead.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-17 15:08:18 -07:00
Leandro Dorileo 2eb0da5523 log: add check helpers
This patch just introduces some cosmetic macros for log and condition
checking.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-17 15:08:18 -07:00
Leandro Dorileo fc8d452a5f sysconfig: split image and native partition detection
With these changes the code becomes more clear on how the wanted
capabilities mask is configured.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-17 15:08:18 -07:00
Leandro Dorileo f4975a7975 libnica: sync with upstream
We have a memory leak fixed upstream.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-05 16:33:56 -07:00
Leandro Dorileo dca4d8b13f sysconfig: add CBM_FORCE_LEGACY flag
With this we can "force" install syslinux into a UEFI running system,
it's useful for syslinux validation as well as CI testing.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-05 16:33:56 -07:00
Leandro Dorileo 7992d91e1b syslinux: add missing bits
This patch introduces some minor missing bits:

  + implement the "mark legacy bios bootable" attribute to partition
  + always use syslinux -U since -i will fail if using partuuid

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-05 16:33:56 -07:00
Leandro Dorileo 53fdea822b bootman: generalize the legacy/UEFI boot partition detection
Generalize the logic and boot partition mounting into its own function,
reusing into 3 different points. This function can be improved more
later on to be used elsewhere.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-05 16:33:56 -07:00
Leandro Dorileo 8e834067b0 files: add a generic partition index utility
This util function returns a partition index based on the given a prefix
and a partitions device node.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-09-05 16:33:56 -07:00
Auke Kok c730d3e509 Statically add mbr.bin and gptmbr.bin.
We should not rely on these being present on the filesystem and
the space we use is minimal. On top of that, we need at a later stage
dynamically choose gpt or non-gpt MBR blocks depending on the device,
so we need both available no matter what.

Punch a hole so the bootloader can easily get the wanted_boot_mask
and decide whether the GPT or non-GPT mbr.bin is needed.
2019-09-05 16:33:56 -07:00
Auke Kok d46f567386 Add syslinux support.
For now this is a literal copy of extlinux.c with just the FSTYPE
capability modified.
2019-09-05 16:33:56 -07:00
Auke Kok 366531ce8f Fix test cases.
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.
2019-09-05 16:33:56 -07:00
Auke Kok 8c38df9900 Detect filesystem type of boot device.
This code makes the program detect the filesystem type of the boot
device. We need this because not all bootloaders will support the
same filesystem type. For instance, extlinux only supports ext2/3/4
but sd-boot supports vfat.

All existing bootloader plugins now report that they support one or
the other filesystem types. This works OK on my systemd-boot based
system. The tests need adjusting, still.
2019-09-05 16:33:56 -07:00
Auke Kok f093ece402 Check for existence of grub2 and extlinux.
If these are not present, there's no use in attempting to use them.

For convenience, we LOG_DEBUG() print the path we searched for
them.
2019-09-05 16:33:56 -07:00
Auke Kok 7b492b0cc2 Rename syslinux to extlinux.
`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.
2019-09-05 16:33:56 -07:00
Leandro Dorileo a6551782db bootman: avoid a buffer overflow
On the cbm_parse_system_kernel() we're not leaving room for \0 by
checking only "len" and not considering the end line terminator.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-08-27 10:51:01 -07:00
Leandro Dorileo 1857f9801b Generalize cbm_cmdline_disabled_by_link() and move to files.c
This function may be reused by other areas, it would be nice to have
it generalized. The build system is building cmdline.c with
-Wfree-nonheap-object but the same flag is not being applied to
files.c, moving it there makes the tests output saner.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-08-27 10:50:33 -07:00
Leandro Dorileo 329e724371 cmdline: remove unsed label clean
The commit bd30daa changed the  function cbm_parse_cmdline_removal_files_directory
but left the clean label behind. This patch removes the leftover.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2019-08-27 10:50:33 -07:00
Anselmo L. S. Melo a4dbf38207 bootvar: Check boot rec name format earlier
That way the loop iteration can be skipped before any memory allocation.
2019-08-27 10:49:59 -07:00
Anselmo L. S. Melo 32750a354f harness: prepare_playground failure flow
Make all prepare_playground error cases go to fail cleanup
(boot_manager_free and return NULL) instead of returning false.
2019-08-27 10:49:36 -07:00
Anselmo L. S. Melo c98b9daae4 bootman: Fix initrd_file check
Check for initrd_file || user_initrd_file instead of initrd_file twice.
2019-08-27 10:49:16 -07:00
Lucius Hu 086dfc7d32 completions: Minor fix on comments
It was wrongly described as `Software Updater - autocompletion script`, and it's changed to
`Kernel & Boot Loader Management - autocompletion script`.
2019-07-30 07:06:25 -07:00
William Douglas 1d27478c2d v3.1.1 release v3.1.1 2019-07-29 11:50:35 -07:00
Lucius Hu 3aedb7d42f Fixup typo in meson.build for shell completions 2019-07-29 11:49:42 -07:00
Lucius Hu 145014d5ea Edited meson.build for shell completion template 2019-07-29 11:49:42 -07:00
Lucius Hu a2c802d6e9 completions: multiple improvement
- `bash` completion now has completions for sub-commands. Notably,
  for `set-kernel` sub-command, it list all kernels installed in
  kernel directory. If `--path` is present, it will prepend its
  argument before the kernel directory.
- Both `bash` and `zsh` completions are turned into templates, which have
  two special variables, `@KERNEL_DIRECTORY@` and `@KERNEL_NAMESPACE@`.
  On current Clear Linux, their default values are `/usr/lib/kernel` and
  `org.clearlinux`
- `meson.build` file is modified and will replace kernel namespace and
  kernel directory in completions.
2019-07-29 11:49:42 -07:00