boot,bootloader: add support for shim fallback and setting EFI boot variables on install#13511
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #13511 +/- ##
==========================================
- Coverage 78.85% 78.84% -0.02%
==========================================
Files 1043 1044 +1
Lines 134592 134848 +256
==========================================
+ Hits 106137 106321 +184
- Misses 21839 21896 +57
- Partials 6616 6631 +15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
a17eb93 to
32f0cfc
Compare
bd393d0 to
bfc91a6
Compare
a9b1628 to
9c899fb
Compare
|
@valentindavid @pedronis changed this to target 2.63 as agreed. |
222b8e9 to
4a062d2
Compare
9fb4819 to
54eefa6
Compare
54eefa6 to
4d43110
Compare
4d43110 to
ac21dff
Compare
|
@olivercalder Could you have a look at the commits that are on top of your two commits and see if that makes sense to you. The main one is 7be3e78 The rest is just some refactoring. Of the tests specially. And I can squash it later. |
|
Not ready for 2.63, moving to 2.64 |
olivercalder
left a comment
There was a problem hiding this comment.
Looks really great, thanks for all your work on this! A few questions/comments, but really nothing major.
There was a problem hiding this comment.
Potentially, should the check if assetPath != "" occur within SetEfiBootVariables, so that each caller doesn't need to make the check? I think SetEfiBootVariables currently assumes assetPath is non-nil, might be safer if it were the one to check.
There was a problem hiding this comment.
This file is no longer changed, so no need to update copyright date?
pedronis
left a comment
There was a problem hiding this comment.
thank you, did a pass, main remark is that new code needs more unit testing
There was a problem hiding this comment.
even if not exported it would be good when possible to start with the function name here
There was a problem hiding this comment.
this comment still applies
There was a problem hiding this comment.
this is exported mostly for testing via spread tests? maybe the doc should remark that is usually not meant to be called directly
There was a problem hiding this comment.
can the uni tests check something about this?
There was a problem hiding this comment.
changes in assets.go don't have matching unit tests afaict
There was a problem hiding this comment.
There should be TestUpdateBootEntryOnInstall and TestUpdateBootEntryOnUpdate in boot/assets_test.go.
There was a problem hiding this comment.
Ah sorry, that was an older comment.
There was a problem hiding this comment.
unit tests strangely don't seem to reach these bits
There was a problem hiding this comment.
Added 3 tests (no error, error in constructLoadOption, error in setEfiBootOptionVariable)
The test checks that EFI boot variables exist for the following: 1. A Boot#### variable pointing to the shim file path. 2. A BootOrder variable with the #### from the above Boot#### as first. Since the layout of EFI assets is dependent on the gadget snap, the test downloads and unpacks the gadget, then modifies the contents so that one variant has the shim and grub binaries in `EFI/boot/` and another variant has the shim and grub binaries in `EFI/ubuntu/` and the fallback binary in `EFI/boot/`. After building a core image around that modified gadget, the VM is booted and the test checks that the EFI variables are set correctly. Then, the test modifies the gadget to match the other variant's initial layout, and then installs the newly modified gadget. This should trigger re-setting EFI boot variables as well. Signed-off-by: Oliver Calder <oliver.calder@canonical.com> tests: fix problems in spread test for setting EFI boot variables Signed-off-by: Oliver Calder <oliver.calder@canonical.com> tests: disabled TPM on EFI boot vars test and separated gadget script Signed-off-by: Oliver Calder <oliver.calder@canonical.com> tests: fixed EFI vars test to use correct toolbox and include all EFI assets Signed-off-by: Oliver Calder <oliver.calder@canonical.com> tests: modify-gadget.sh re-use existing gadget so edition is incremented Signed-off-by: Oliver Calder <oliver.calder@canonical.com> tests: fix mangled EFI var search string and other improvements Signed-off-by: Oliver Calder <oliver.calder@canonical.com> tests: polish tests for setting EFI boot variables Notably, allow tests/nested/core/core20-set-efi-boot-variables to run on arm64 as well as amd64, simplify setefivars.go to search for multiple assets on multiple architectures, and allow tests/nested/manual/core20-set-efi-boot-vars to run on any ubuntu-2*. Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
…bles ... so we can reuse the script in other tests
… with UC available
9677738 to
e6c9868
Compare
|
@alfonsosanchezbeato, please do a final pass |
alfonsosanchezbeato
left a comment
There was a problem hiding this comment.
LGTM, thanks for the changes
This is #13205 rebased onto #13412