c/agent: add initramfs build
The agent will be used directly on top of a Monogon kernel as an
initamfs. Add build rules for generating said initramfs.
Change-Id: I960fb3d82d4a7f227db48ca0714c48c63958d31f
Reviewed-on: https://review.monogon.dev/c/monogon/+/1142
Tested-by: Leopold Schabel <leo@monogon.tech>
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/cloud/agent/BUILD.bazel b/cloud/agent/BUILD.bazel
index dbf3603..775dd12 100644
--- a/cloud/agent/BUILD.bazel
+++ b/cloud/agent/BUILD.bazel
@@ -1,4 +1,6 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+load("//metropolis/node/build/fwprune:def.bzl", "fsspec_linux_firmware")
+load("//metropolis/node/build:def.bzl", "node_initramfs")
go_library(
name = "agent_lib",
@@ -36,3 +38,23 @@
"@com_github_stretchr_testify//assert",
],
)
+
+fsspec_linux_firmware(
+ name = "firmware",
+ firmware_files = ["@linux-firmware//:all_files"],
+ kernel = "//third_party/linux",
+ metadata = "@linux-firmware//:metadata",
+)
+
+node_initramfs(
+ name = "initramfs",
+ files = {
+ ":agent": "/init",
+ "@cacerts//file": "/etc/ssl/cert.pem",
+ },
+ fsspecs = [
+ "//metropolis/node/build:earlydev.fsspec",
+ ":firmware",
+ ],
+ visibility = ["//cloud:__subpackages__"],
+)
diff --git a/cloud/agent/main.go b/cloud/agent/main.go
index 210739a..704b252 100644
--- a/cloud/agent/main.go
+++ b/cloud/agent/main.go
@@ -7,6 +7,7 @@
)
func main() {
+ fmt.Println("Monogon BMaaS Agent started")
report, errs := gatherHWReport()
// Just print the report for now
fmt.Println(prototext.Format(report))