blob: 8d5f2671c254de1c940a31419139be0365c23250 [file] [log] [blame]
Lorenz Brunad5b47d2021-11-09 13:52:56 +01001load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
Mateusz Zalega8c2c7712022-01-25 19:42:21 +01002load("//metropolis/node/build:def.bzl", "erofs_image", "verity_image")
Lorenz Brunad5b47d2021-11-09 13:52:56 +01003load("//metropolis/node/build:efi.bzl", "efi_unified_kernel_image")
4load("@rules_pkg//:pkg.bzl", "pkg_zip")
5
6erofs_image(
7 name = "rootfs",
8 files = {
9 ":testos": "/init",
10 },
11)
12
Mateusz Zalega8c2c7712022-01-25 19:42:21 +010013verity_image(
14 name = "verity_rootfs",
15 source = ":rootfs",
16)
17
Lorenz Brunad5b47d2021-11-09 13:52:56 +010018efi_unified_kernel_image(
19 name = "kernel_efi",
Lorenz Brunad131882023-06-28 16:42:20 +020020 cmdline = "quiet console=ttyS0 init=/init",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010021 kernel = "//third_party/linux",
Mateusz Zalega8c2c7712022-01-25 19:42:21 +010022 verity = ":verity_rootfs",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010023)
24
25# An intermediary "bundle" format until we finalize the actual bundle format. This is NOT stable until migrated
26# to the actual bundle format.
27# TODO(lorenz): Replace this
28pkg_zip(
29 name = "testos_bundle",
30 srcs = [
31 ":kernel_efi",
Mateusz Zalega8c2c7712022-01-25 19:42:21 +010032 ":verity_rootfs",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010033 ],
Lorenz Brunaadeb792023-03-27 15:53:56 +020034 visibility = ["//visibility:public"],
Lorenz Brunad5b47d2021-11-09 13:52:56 +010035)
36
37go_library(
Lorenz Brund13c1c62022-03-30 19:58:58 +020038 name = "testos_lib",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010039 srcs = ["main.go"],
Mateusz Zalegaedffbb52022-01-11 15:27:22 +010040 importpath = "source.monogon.dev/metropolis/installer/test/testos",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010041 visibility = ["//visibility:private"],
Lorenz Brund13c1c62022-03-30 19:58:58 +020042 deps = ["@org_golang_x_sys//unix"],
Lorenz Brunad5b47d2021-11-09 13:52:56 +010043)
44
45go_binary(
46 name = "testos",
Lorenz Brund13c1c62022-03-30 19:58:58 +020047 embed = [":testos_lib"],
Lorenz Brunad5b47d2021-11-09 13:52:56 +010048 visibility = ["//visibility:public"],
49)