blob: 855621ab2cf109bb3f30d9a3e5024c5edd63dc52 [file] [log] [blame]
Tim Windelschmidt79ffbbe2024-02-22 19:15:51 +01001load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
2load("//metropolis/node/build/mkucode:def.bzl", "cpio_ucode")
3load("//build/static_binary_tarball:def.bzl", "static_binary_tarball")
4load("//metropolis/node/build:def.bzl", "node_initramfs")
5load("//metropolis/node/build/fwprune:def.bzl", "fsspec_linux_firmware")
6
7go_library(
8 name = "takeover_lib",
9 srcs = ["takeover.go"],
10 embedsrcs = [
11 "//third_party/linux", #keep
12 ":ucode", #keep
13 ":initramfs", #keep
14 ],
15 importpath = "source.monogon.dev/cloud/agent/takeover",
16 visibility = ["//visibility:private"],
17 deps = [
18 "//cloud/agent/api",
19 "//metropolis/pkg/bootparam",
20 "//metropolis/pkg/kexec",
21 "//net/dump",
22 "//net/proto",
23 "@com_github_cavaliergopher_cpio//:cpio",
24 "@com_github_klauspost_compress//zstd",
25 "@org_golang_google_protobuf//proto",
26 "@org_golang_x_sys//unix",
27 ],
28)
29
30node_initramfs(
31 name = "initramfs",
32 files = {
33 "//cloud/agent:agent": "/init",
34 "@com_github_coredns_coredns//:coredns": "/kubernetes/bin/coredns",
35 "//metropolis/node/core/network/dns:resolv.conf": "/etc/resolv.conf",
36 "@cacerts//file": "/etc/ssl/cert.pem",
37 },
38 fsspecs = [
39 "//metropolis/node/build:earlydev.fsspec",
40 ":firmware",
41 ],
42 visibility = ["//cloud/agent:__subpackages__"],
43)
44
45go_binary(
46 name = "takeover",
47 embed = [":takeover_lib"],
48 visibility = ["//visibility:public"],
49)
50
51cpio_ucode(
52 name = "ucode",
53 ucode = {
54 "@linux-firmware//:amd_ucode": "AuthenticAMD",
55 "@intel_ucode//:fam6h": "GenuineIntel",
56 },
57)
58
59fsspec_linux_firmware(
60 name = "firmware",
61 firmware_files = ["@linux-firmware//:all_files"],
62 kernel = "//third_party/linux",
63 metadata = "@linux-firmware//:metadata",
64)
65
66# Used by container_images, forces a static build of the test_agent.
67static_binary_tarball(
68 name = "takeover_layer",
69 executable = ":takeover",
70 visibility = ["//visibility:public"],
71)