453 Commits
Author SHA1 Message Date
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
Lucius Hu fba3b31b93 zsh-completion: Improved
Added completions for sub-commands, including
- Path completion if a sub-command accept `--path=` option
- Shows a list of kernels for `set-kernel` sub-command, where it searches for
  kernels under `/usr/lib/kernel` by default, while prepends the option arg of
  `--path` if it's given. If the user specified a path manually, instead of
  using file path completion, and that path doesn't exist, warns user.
- Reminds the user to input a integer value for `set-timeout`
  sub-command
- Adds all sub-commands to completion menu as argument to `help` sub-command
2019-07-26 11:18:12 -07:00
William Douglas f742b600df Enable completions to be installed
Add meson integration for the completions files.
2019-07-22 21:45:40 -07:00
Lucius Hu d7e0b6cbd5 clr-boot-manager.bash: Added bash completion 2019-07-22 21:45:40 -07:00
Lucius Hu 841690c847 clr-boot-manager.zsh: Added zsh completion 2019-07-22 21:45:40 -07:00
chax f059bcf1fd Fix "double free or corruption (!prev)" error 2019-06-05 09:50:52 -07:00
William Douglas bd30daa4d2 Fix kernel commandline removal handling
Previously the only removal that would be processed was extra
configuration and not the default kernel commandline that is shipped
with the kernel. This change moves processing the removal until after
the extra configuration and the default commandline have been merged.
2019-05-20 13:50:18 -07:00
William Douglas 2a08878dab Do not attempt an update without a kernel dir
Previous code would try and find informatin about the given root even
when the kernel dir under the root did not exist causing unhelpful
errors. Update to check if the kernel dir exists before probing the
given root and exit if it does not.
2019-05-10 08:53:08 -07:00
William Douglas ce2f3e0542 Fix output of DECLARE_OOM macro
The DECLARE_OOM macro didn't add a newline at the end leading to
potentially confusing output.
2019-05-10 08:52:56 -07:00
William Douglas f23491c901 Attempt kernel update even if bootloader update fails
In some cases the bootloader update will not impact the kernel update,
usually when another tool like syslinux is used which may fail
independently of the file copies the kernel update will need. Since
the kernel update may still succeed always attempt it to avoid cases
where the kernel becomes stale as it is more likely to need updates
than the bootloader.
2019-05-10 08:52:27 -07:00
William Douglas 54bbf99842 bootman: Use mount helpers for setting the default kernel 2019-03-12 13:20:01 -07:00
William Douglas 1b039c2a7b bootman: Move mount and list helpers
Restructure where helpers are located in source files. Make a few
helper functions public as part of this restructure to enable
sharing.
2019-03-12 13:20:01 -07:00