351 Commits

Author SHA1 Message Date
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
Maciej Borzecki
abb058121f boot, bootloader: tweak naming of panic injection helper
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-19 13:27:10 +02:00
Maciej Borzecki
6c4c7c713d bootloader/bootloadertest: make panic inject part of the base mock bootloader
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-16 18:42:15 +02:00
Maciej Borzecki
1d910cddd4 bootloader/assets: move command line arguments assignment
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-16 14:15:22 +02:00
Maciej Borzecki
7677942be4 bootloader/assets: tweak comment about what gets loaded from the bootenv
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-16 08:04:56 +02:00
Maciej Borzecki
d4f888598f boot, bootloader: extend unit tests, bump year
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-15 19:21:46 +02:00
Maciej Borzecki
98da32f4ef bootloader: introduce full set of command line arguments, refactor trusted bootloader interface
Introduce a structure for passing components of kernel command line. Extend the
structure with a field to carry the full set of arguments. Introduce support in
grub.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-15 19:20:21 +02:00
Maciej Borzecki
d0897fb526 bootloader/assets: add support for snapd_full_cmdline_args to grub assets
Add support for snapd_full_cmdline_args variable that carries a set of command
line arguments that shall be used in place of the static and extra ones. Thus
the contents of the new variable effectively become the list of arguments that
directly follows `snapd_recovery_mode=.. snapd_recovery_system=...` in the
kernel command line passed by grub.

The boot config edition is not bumped yet, thus it will not trigger an automatic
boot config update when a new snapd gets installed.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-15 19:17:48 +02:00
Maciej Borzecki
5721e5e8a4 Merge pull request #9921 from bboozzoo/bboozzoo/uc20-recovery-mgmt-boot-set-try
boot: helper for setting up a try recover system
2021-03-08 08:44:20 +01:00
Maciej Borzecki
31a21b60bf bootloader/lkenv: add recovery systems related variables
Add try_recovery_system and recovery_system_status to the boot variables tracked
inside little kernel bootloader's environment.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-03-02 10:58:44 +01:00
Maciej Borzecki
80968beb6c bootloader/bootloadertest: allow setting up a function for mocked SetBootVars errors
This gives slightly more flexibility in mocking different failure modes.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-02-10 15:47:49 +01:00
Ian Johnson
3895e2b6a2 bootloader/uboot.go: add sanity checks that uboot implements the right ifaces 2021-02-02 16:34:09 -06:00
Maciej Borzecki
8f60aa7a2f bootloader: bump copyright year
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-01-26 13:55:42 +01:00
Maciej Borzecki
7d6d28299d bootloader: inject the contents of a marker file, logging tweaks
Allow injecting the contents of the marker file into the command line snippets.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-01-26 11:18:49 +01:00
Maciej Borzecki
bee10210f6 bootloader/assets: support injecting bootloader assets for tests
Add support for injecting bootloader assets and corresponding snippets in test
builds of snapd. The code is only picked up when building with
withbootassetstesting tag.

The snippets are injected only when a specific marker file is present in the
same directory as the snapd binary. This way it is possible to control when a
snapd snap update will trigger an update of boot config assets of the grub
bootloader.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-01-25 14:53:02 +01:00