Commit Graph

365 Commits

Author SHA1 Message Date
Samuele Pedroni
550fad4640 bootloader: allow different names for the grub binary in different archs
Merge pull request #11282 from alfonsosanchezbeato/grub-multiarch

Currently, the grub binary name is always grubx64.efi. However, for
arm64 the usual name is Ubuntu us grubaa64.efi. Make it dependent on
architecture, so one or the other is expected in each case. This will
allow using grub on arm64 systems.
2022-03-01 11:57:19 +01:00
Alfonso Sánchez-Beato
ead29039b9 bootloader/grub_test.go: remove now unused variable 2022-02-16 12:22:11 +01:00
Alfonso Sánchez-Beato
5903d72f39 bootloader: use AddCleanup instead of TearDownTest in tests
Use AddCleanup from the test suite instead of relying on TearDownTest
to clean-up state after a test finishes.
2022-02-16 12:01:06 +01:00
Alfonso Sánchez-Beato
077fbe2a03 bootloader/grub_test: add multi-arch support 2022-02-15 19:12:34 +01:00
Alfonso Sánchez-Beato
347b73cbee bootloader/grub: check for prepare image time when retrieving boot assets 2022-02-15 19:11:34 +01:00
Alfonso Sánchez-Beato
f2fdf40bf0 bootloader: include grub prefix in some names uin grub.go 2022-02-14 19:06:08 +01:00
Alfonso Sánchez-Beato
721bf78f27 bootloader: use different boot assets in grub depending on arch
Make the choosing of boot assets dependent dynamically on arch instead
of having static names. This will facilitate overriding by environment
variables if needed in the future.
2022-02-14 10:49:04 +01:00
Alfonso Sánchez-Beato
41cb1b79f7 b/assets: revert grub-recovery.cfg edition to 1 again
There is no need for the bump as no new features are added by using
gnu_arch in the grub script.
2022-02-11 15:44:19 +01:00
Alfonso Sánchez-Beato
660db7bf77 bootloader: use different grub binaries in different arch
Use different grub binaries in different architectures, by checking
the grub_cfg variable in the grub recovery script. Also, increase the
config edition for grub-recovery.cfg.

Provide the different names for the assets in snapd by using constants
in files tagged for different architectures.
2022-02-11 12:31:02 +01:00
Alfonso Sánchez-Beato
7d489d7129 boot: add tests for RebootInfo 2022-02-04 14:01:24 +01:00
Alfonso Sánchez-Beato
a51858b1e7 bootloader: rename RebootArgumentsBootloader interface to RebootBootloader 2022-02-02 18:12:39 +01:00
Alfonso Sánchez-Beato
f0d19f3379 bootloader: add interface for bootloaders needing reboot args
These reboot arguments are passed from systemd to the reboot syscall.
2022-01-28 16:48:30 +01:00
Sreeja Manghat
9bf5d2485a many: unit test fix when SNAPD_DEBUG=1 is set
Minor changes ensuring unset SNAPD_DEBG to avoid test failures when run with SNAPD_DEBUG=1.
Added support in test.yaml for unit tests with SNAPD_DEBUG=1 to be re-run to avoid regressions.
2022-01-25 20:26:56 +05:30
Ian Johnson
21654fb2f7 bootloader/assets/grub_*cfg_asset.go: update Copyright
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2022-01-06 08:51:34 -06:00
Miguel Pires
13209fc52c many: fix formatting w/ latest go version
Fix formatting when running the latest version (1.17) of gofmt.
2021-12-08 13:59:56 +00:00
Ian Johnson
89d3d02ec9 many: mv MockDeviceNameDisksToPartitionMapping -> MockDeviceNameToDiskMapping
This isn't mapping to partitions anymore, rather to a Disk itself.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-10-13 20:39:07 -05:00
Ian Johnson
06c8892536 osutil/disks, many: switch to defining Partitions directly for MockDiskMapping
This will be necessary for more complicated test cases in the gadget package,
so time to rip this band-aid and get rid of the old methods.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-10-13 20:30:31 -05:00
Maciej Borzecki
41bf1a3597 many: pick up special build time flags for invoking go while generating artifacts
Some packaging frameworks (dh-golang in partcular) invokes go generate. Our code
calls `go run ..` to generate some output files. In particular, when building
with Go modules support, we must pass -mod=vendor occasionally. Allow the build
code to set an environment variables with flags that shall be passed to go run.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-09-09 13:37:31 +02:00
Miguel Pires
aa623a49ea many: remove unused parameters and returns 2021-09-02 17:44:34 +01:00
Miguel Pires
db9c63b734 many: remove unused code 2021-08-26 18:24:02 +01:00
Maciej Borzecki
9efaa6ff96 bootloader/assets: update recovery grub to allow system labels generated by snapd
Update the recovery grub boot config to allow all system labels that are
considered valid by snapd, which are typically just numbers based on date, eg.
20210706 but follow the same rules as model names so hyphen separated
numbers/letters are allowed.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-07-07 07:01:29 +02:00
Samuele Pedroni
54e84fb8db many: fix imports order (according to gci)
had to make the comment in wrappers/services_test.go a one-liner
otherwise half of it is lost

last set of files needing changing (as per current master)
2021-06-16 09:54:31 +02:00
Maciej Borzecki
8b7473d0de bootloader/bootloadertest: mock a mix of TrustedAssetsBootloader and RecoveryAwareBootloader
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-22 11:25:18 +02:00
Maciej Borzecki
f0d20ddc84 bootloader/bootloadertest: provide mixins for interface implementations
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-22 11:25:18 +02:00
Maciej Borzecki
8411bcf892 bootloader: lk: tweak error when trying to extract recovery kernel assets at runtime
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-21 12:14:15 +02:00