load("//build:constraints.bzl", "BARE_METAL")
load("//build:qemu.bzl", "qemu_binary", "qemu_test")
load(":defs.bzl", "k23_flat_image", "k23_uefi_image")

# ── UEFI images ───────────────────────────────────────────────────────────────

k23_uefi_image(
    name = "k23-uefi",
    loader = "//sys/loader-efi:loader-efi",
    kernel = "//sys/kernel:kernel",
    kernel_debuginfo = "//sys/kernel:kernel[debuginfo]",
    target_compatible_with = BARE_METAL,
)

# Test variant: same image shape, but the kernel is built with selftests enabled.
k23_uefi_image(
    name = "k23-uefi-tests",
    loader = "//sys/loader-efi:loader-efi",
    kernel = "//sys/kernel:kernel-tests",
    kernel_debuginfo = "//sys/kernel:kernel-tests[debuginfo]",
    target_compatible_with = BARE_METAL,
)

qemu_binary(name = "k23-uefi-qemu",       image = ":k23-uefi",       target_compatible_with = BARE_METAL, visibility = ["PUBLIC"])
qemu_test(  name = "k23-uefi-qemu-tests", image = ":k23-uefi-tests", target_compatible_with = BARE_METAL)

# ── Flat images ───────────────────────────────────────────────────────────────

k23_flat_image(
    name = "k23-flat",
    loader = "//sys/loader-flat:loader-flat",
    target_compatible_with = BARE_METAL,
    visibility = ["PUBLIC"],
)

k23_flat_image(
    name = "k23-flat-tests",
    loader = "//sys/loader-flat:loader-flat-tests",
    target_compatible_with = BARE_METAL,
)

qemu_binary(name = "k23-flat-qemu",       image = ":k23-flat",       target_compatible_with = BARE_METAL, visibility = ["PUBLIC"])
qemu_test(  name = "k23-flat-qemu-tests", image = ":k23-flat-tests", target_compatible_with = BARE_METAL)
