* b/piboot.go: check EEPROM version for RPi4
Check EEPROM version for RPi4 to make sure that tryboot is
supported. If the EEPROM need updating, return an error when
installing the kernel.
* bootloader: add unit tests for detection of RPi4 EEPROM
* bootloader/piboot: use osutil instead of using directly os.Stat
* bootloader: address review comments
This is the same fix as commit 17fbdc7c, but in other tests.
The current code will mock the `amd64` architecture when running some
tests but it does not mock the `grub.cfg:static-cmdline` or the
`grub-recovery.cfg:static-cmdline`. This is needed because the
`bootloader/asserts` package registers the cmdline via `init()` so
this happens before the architecture is mocked in the testing
code. Hence the tests will fail when inspecting the command line on
non amd64/i386 machines.
This commit makes the mocking explicit. An alternative approach would
be to move the snippet registration out of `init()` and run it on
first boot but that has it's own problems so this other approach was
followed.
snapd_*_cmdline_args only apply to TrustedAssetsBootloader interface,
that is not implemented by piboot. Also, rename a couple of methods
with better names.
This commit replaces the use of "sanity" with more inclusive
naming. When `// sanity` is used to check if an interface is
implemented the comment `expected interface is implemented`
is used.
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.