Go 1.19 includes some changes to gofmt which intend to make lists and
heading clearer when rendered (https://go.dev/doc/go1.19). This commit
is the result of running the new gofmt and manually fixing some of it.
This was necessary because the new gofmt assumed lines beginning w/ tabs
to start lists or examples. While this is often true in our codebase,
we occasionally also use tabs to indent the lines after a TODO or FIXME
prefix or in yaml (e.g., excerpts of a snap.yaml). This meant that a lot of the
reformatted comments were broken and had to be fixed manually.
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
The copyright of the auto-generated grub_{recovery,}_cfg_assets.go
file is generated from the current date. This leads to a dirty build
when the year changes. This commit hardcodes the copyright year
to 2022.
Once there is a better go build system (or we use something like
meson) we can re-introduce this because then the generated files
will be no longer in git.
grub's regexp does not change the store variable if there is no match,
so checking for empty variable after the regexp call was not really
working. Instead, check for successful regexp call.
This commit will help the boot speed on most PC devices and
requested by the Taipei team.
The changes to the auto-generated parts are done via:
```
$ cd boot/assets
$ go build -o ./genasset/genasset ./genasset/
$ ./genasset/genasset -in ./data/grub.cfg -out grub_cfg_asset.go -name grub.cfg
```
and the `Snapd-Boot-Config-Edition` for `grub.cfg` was bumped.
Note that no changes for the recovery grub configuration are done
in this commit. I'm happy to do a follwup for this.
* 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