metropolis: implement and use A/B preloader
This switches over from using the EFI built-in bootloader for A/B
updates to using our own EFI preloader due to significant issues with
in-the-wild EFI implementations. It is a very minimal design relying
on a single Protobuf state file instead of EFI variables.
Change-Id: Ieebd0a8172ebe3f44c69b3e8c278c53d3fe2eeb4
Reviewed-on: https://review.monogon.dev/c/monogon/+/2203
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/metropolis/installer/BUILD.bazel b/metropolis/installer/BUILD.bazel
index 17fd8c7..400b98e 100644
--- a/metropolis/installer/BUILD.bazel
+++ b/metropolis/installer/BUILD.bazel
@@ -9,6 +9,9 @@
"log.go",
"main.go",
],
+ embedsrcs = [
+ "//metropolis/node/core/abloader", #keep
+ ],
importpath = "source.monogon.dev/metropolis/installer",
visibility = ["//visibility:private"],
deps = [
diff --git a/metropolis/installer/main.go b/metropolis/installer/main.go
index 5481c3f..8aa8836 100644
--- a/metropolis/installer/main.go
+++ b/metropolis/installer/main.go
@@ -21,6 +21,8 @@
import (
"archive/zip"
+ "bytes"
+ _ "embed"
"errors"
"fmt"
"io/fs"
@@ -38,6 +40,9 @@
"source.monogon.dev/metropolis/pkg/sysfs"
)
+//go:embed metropolis/node/core/abloader/abloader_bin.efi
+var abloader []byte
+
const mib = 1024 * 1024
// mountPseudoFS mounts efivarfs, devtmpfs and sysfs, used by the installer in
@@ -228,6 +233,7 @@
},
SystemImage: systemImage,
EFIPayload: FileSizedReader{efiPayload},
+ ABLoader: bytes.NewReader(abloader),
NodeParameters: FileSizedReader{nodeParameters},
}
// Calculate the minimum target size based on the installation parameters.