blob: c8f1c3fa42fe86d57fe1f61804907fb5f3883cf9 [file] [log] [blame]
Lorenz Brunad5b47d2021-11-09 13:52:56 +01001load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
Tim Windelschmidt156248b2025-01-10 00:27:45 +01002load("@rules_pkg//:pkg.bzl", "pkg_zip")
Tim Windelschmidtbed76d92025-02-18 03:04:14 +01003load("//osbase/build/mkerofs:def.bzl", "erofs_image")
4load("//osbase/build/mkpayload:def.bzl", "efi_unified_kernel_image")
5load("//osbase/build/mkverity:def.bzl", "verity_image")
Lorenz Brunad5b47d2021-11-09 13:52:56 +01006
7erofs_image(
8 name = "rootfs",
9 files = {
Tim Windelschmidt24bf6fd2025-02-12 04:48:24 +010010 "/init": ":testos",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010011 },
12)
13
Mateusz Zalega8c2c7712022-01-25 19:42:21 +010014verity_image(
15 name = "verity_rootfs",
16 source = ":rootfs",
17)
18
Lorenz Brunad5b47d2021-11-09 13:52:56 +010019efi_unified_kernel_image(
20 name = "kernel_efi",
Lorenz Brunad131882023-06-28 16:42:20 +020021 cmdline = "quiet console=ttyS0 init=/init",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010022 kernel = "//third_party/linux",
Mateusz Zalega8c2c7712022-01-25 19:42:21 +010023 verity = ":verity_rootfs",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010024)
25
26# An intermediary "bundle" format until we finalize the actual bundle format. This is NOT stable until migrated
27# to the actual bundle format.
28# TODO(lorenz): Replace this
29pkg_zip(
30 name = "testos_bundle",
31 srcs = [
32 ":kernel_efi",
Mateusz Zalega8c2c7712022-01-25 19:42:21 +010033 ":verity_rootfs",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010034 ],
Lorenz Brunaadeb792023-03-27 15:53:56 +020035 visibility = ["//visibility:public"],
Lorenz Brunad5b47d2021-11-09 13:52:56 +010036)
37
38go_library(
Lorenz Brund13c1c62022-03-30 19:58:58 +020039 name = "testos_lib",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010040 srcs = ["main.go"],
Mateusz Zalegaedffbb52022-01-11 15:27:22 +010041 importpath = "source.monogon.dev/metropolis/installer/test/testos",
Lorenz Brunad5b47d2021-11-09 13:52:56 +010042 visibility = ["//visibility:private"],
Lorenz Brund13c1c62022-03-30 19:58:58 +020043 deps = ["@org_golang_x_sys//unix"],
Lorenz Brunad5b47d2021-11-09 13:52:56 +010044)
45
46go_binary(
47 name = "testos",
Lorenz Brund13c1c62022-03-30 19:58:58 +020048 embed = [":testos_lib"],
Lorenz Brunad5b47d2021-11-09 13:52:56 +010049 visibility = ["//visibility:public"],
50)