m/p/efivarfs: refactor
This accomplishes three things:
First, split out the variable access layer from the rest of the code.
This cleans up the attribute handling, which is now done centrally as
well as making the high-level functions very short and clean. They now
also return better errors.
Second this introduces proper types for LoadOption, which can now also
be unmarshaled which was a requirement for A/B updates. This required
implementation of EFI's DevicePath structure.
While refactoring the higher-level functions for this, this also
fixes a bug where the variable index (the 4 hex nibbles at the end) were
improperly generated as lowercase hex.
Third, this adds new high-level functions for interacting with more
boot-related variables needed for the A/B effort.
Change-Id: I53490fa4898a5e7a5498ecc05a9078bd2d66c26e
Reviewed-on: https://review.monogon.dev/c/monogon/+/1855
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/metropolis/installer/main.go b/metropolis/installer/main.go
index 7dc1da9..2515f53 100644
--- a/metropolis/installer/main.go
+++ b/metropolis/installer/main.go
@@ -315,7 +315,7 @@
}
// Create an EFI boot entry for Metropolis.
- en, err := efivarfs.CreateBootEntry(be)
+ en, err := efivarfs.AddBootEntry(be)
if err != nil {
panicf("While creating a boot entry: %v", err)
}