c/takeover: init
Add takeover, a tool which is used to take over machines running any
pretty much any Linux distribution as long as it has kexec support and
one can run the takeover binary on it.
After takeover it launches the cloud agent which can then perform
further work on the machine.
Change-Id: If26015f626f439c44be473221c98b5e9a8fa9adc
Reviewed-on: https://review.monogon.dev/c/monogon/+/1143
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Leopold Schabel <leo@monogon.tech>
diff --git a/cloud/takeover/BUILD.bazel b/cloud/takeover/BUILD.bazel
new file mode 100644
index 0000000..1eb34e2
--- /dev/null
+++ b/cloud/takeover/BUILD.bazel
@@ -0,0 +1,38 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("//metropolis/node/build/mkucode:def.bzl", "cpio_ucode")
+
+go_library(
+ name = "takeover_lib",
+ srcs = ["takeover.go"],
+ embedsrcs = [
+ "//third_party/linux", #keep
+ ":ucode", #keep
+ "//cloud/agent:initramfs", #keep
+ ],
+ importpath = "source.monogon.dev/cloud/takeover",
+ visibility = ["//visibility:private"],
+ deps = [
+ "//cloud/agent/api",
+ "//metropolis/pkg/bootparam",
+ "//metropolis/pkg/kexec",
+ "//net/dump",
+ "@com_github_cavaliergopher_cpio//:cpio",
+ "@com_github_pierrec_lz4_v4//:lz4",
+ "@org_golang_google_protobuf//proto",
+ "@org_golang_x_sys//unix",
+ ],
+)
+
+go_binary(
+ name = "takeover",
+ embed = [":takeover_lib"],
+ visibility = ["//visibility:public"],
+)
+
+cpio_ucode(
+ name = "ucode",
+ ucode = {
+ "@linux-firmware//:amd_ucode": "AuthenticAMD",
+ "@intel_ucode//:fam6h": "GenuineIntel",
+ },
+)