Commit Graph

17 Commits

Author SHA1 Message Date
Fredrik Lönnegren f132230beb Update copyright year (2025)
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2025-01-07 16:43:28 +01:00
David Cassany Viladomat 44b2e7b563
Bump efi library (#2158)
* Bump go-efilib

Signed-off-by: David Cassany <dcassany@suse.com>

* Adapt to new efilib library

Signed-off-by: David Cassany <dcassany@suse.com>

---------

Signed-off-by: David Cassany <dcassany@suse.com>
2024-08-07 10:38:44 +02:00
David Cassany 76caad5f6e Add test for auto disabled boot entry in Grub
Signed-off-by: David Cassany <dcassany@suse.com>
2024-07-22 15:59:15 +02:00
David Cassany Viladomat 15a10cc4f5
Make EFI partition size configurable at install time (#2105)
* Make EFI partition size configurable at install time
* Add a custom EFI size test
* Rename efi to bootloader partition in config.yaml
* Rename EFI variable to Boot
* Rename constants

Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-19 06:23:33 +02:00
David Cassany 28c4e4735e Use fake mounter in tests
Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-11 14:46:12 +02:00
Fredrik Lönnegren 48d6ca488b Refactor and test efi manager
This commit refactors the efi mocks out of pkg/efi/types.go and adds a
ReadLoadOptions method the the efivars interface.

We also add some tests for creating a new BootManager and verify that
the ReadLoadOptions error does not bubble up from NewBootManager method.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-05-23 08:59:17 +02:00
Fredrik Lönnegren 2e56a099b3 Do not return error for efi.ReadLoadOption
When encountering a boot-entry for a device-path that go-efilib is
unable to parse we should just skip that entry instead of erroring out.

This same behavior is used earlier in the same loop so this should fix
an edge-case where the boot entry is parseable but the device-path is
not.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-05-23 08:59:17 +02:00
Fredrik Lönnegren 8baaef2251
Disable boot entry if efivars is read-only (#2059)
On some systems the efivars is mounted read-only if the firmware does
not support writing (such as RPI).

This commit turns off writing boot entries to efivars if the efivars
filesystem is mounted read-only.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-04-24 14:06:35 +00:00
David Cassany Viladomat c05f5d4913
bump elemental-toolkit to v2 (#1969)
* bump elemental-toolkit to v2

Signed-off-by: David Cassany <dcassany@suse.com>

* Move pkg/types/v2 to simply pkg/types

This commit leaves the code with a single set of types
and in refers to it as the types packge instead of
v1 or v2.

For the time being we do not foresee managing more
than one single major version of type within the
same code.

Signed-off-by: David Cassany <dcassany@suse.com>

* Stop referring to mocks package as v2mock in favor of simply 'mocks'

Signed-off-by: David Cassany <dcassany@suse.com>

* Fix leftovers after rebase

Signed-off-by: David Cassany <dcassany@suse.com>

---------

Signed-off-by: David Cassany <dcassany@suse.com>
2024-03-08 09:14:56 +01:00
Fredrik Lönnegren b44cebeccb
Use backup legacy grub.cfg location (#1967)
If the new /etc/elemental/grub.cfg config is not found, revert to using
/etc/cos/grub.cfg for backwards compatibility.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-02-22 09:37:29 +01:00
David Cassany Viladomat 4cab6a0eae
Refactor to switch to snapshotter interface (#1906)
* Refactor to switch to snapshotter interface

This commit adopts snapshotter interface in install,
reset and upgrade commands. The change implies changes
to the respective specs, grub configuration and dracut
modules.

This commit also changes the behavior of recovery system
upgrades. Now recovery upgrades are an optional step
of a system upgrade. Recovery image can't be upgraded
without upgrading the active system.

Finally build-disk command is also changed to be better
aligned with upgrade and install procedures. Expandable
disks are an unprivileged build and non expandable ones
require privileges as they relay on snapshotter.

* Attempting to fix integration tests

* Adding a migration path from legacy deployments

* Omit /etc/resolv.conf for dir:// paths

* Adaptations after rebase

* Make sure we also mount EFI in upgrades if it was not already mounted

* Default maximum number of snapshots is 2

* Upgrade grub to EFI partition

* Improve recovery management

* Recovery back to ext2 by default

* Adapt upgrade after rebase


Signed-off-by: David Cassany <dcassany@suse.com>
2024-01-31 11:03:24 +01:00
David Cassany 24b19bc883 This commit does removes the assumption of a /boot folder
With this commit all grub binaries (EFI images and modules)
and configurations are installed always in defined prefixes.

Defined prefixes are always appended to the EFI path, which
is usually the EFI partition mountpoint at run time.

This causes a duplication of data if multiple prefixes are
defined.

Signed-off-by: David Cassany <dcassany@suse.com>
2024-01-30 11:43:48 +01:00
Fredrik Lönnegren 56b2723919
Install grub.cfg into EFI System Partition (#1904)
* Install grub.cfg into EFI System Partition

Change the bootloader install logic to install the grub.cfg into the EFI
System Partition (ESP).

This needs some changes to how root is set in the grub.cfg as well as
moving grub_oem_env file to ESP when created in install/reset/upgrade
command.

Install grub-modules to both EFI/BOOT and EFI/ELEMENTAL.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-01-22 18:46:36 +01:00
David Cassany 2e18efa696 Bump twpayne/vfs module to latest version
Specifically bumping from v1.7.2 to v4.3.0. We were pretty outdated.

This commit could not get rid of the old version dependency completely
because yip requires a vfs v1 within the plugin API and we implement
a yip plugin for partitioning in elemental-toolkit. Because of that
both versions are coexisting.

Signed-off-by: David Cassany <dcassany@suse.com>
2024-01-19 16:56:49 +01:00
Fredrik Lönnegren cd4e009b88 Update copyright year (2024)
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-01-09 09:44:34 +01:00
David Cassany Viladomat 1a1b942acd
Add other example distros (#1868)
Signed-off-by: David Cassany <dcassany@suse.com>
2023-12-11 10:31:56 +01:00
David Cassany c786f640f7 Refactor grub as a bootloader interface
This commit moves grub logic into its own bootloader interface.

In addition it adds helper methods to find EFI binaries, kernel and
initrd based on patterns. No longer a distro detection is required.

It also sets an elemental criteria for those bootloader files. In fact
first place to look at is /usr/lib/elemental/bootloader, which gives a chance
within the OS Dockerfile to prepare EFI binaries if default distro
paths are not matching any of the default Elemental patterns.

Kernel and initrd symlinks as /boot/vmlinuz and /boot/initrd are also
created within the init command. This gives at build time more
confidence that the kernel and initrd are set consistently with
Elemental expectations.

As part of the refactor BIOS firmware and MSDOS partition tables support
is finally dropped.

Signed-off-by: David Cassany <dcassany@suse.com>
2023-11-30 13:40:49 +01:00