image: remove autologin via mkosi

In mkosi v24 --autologin no longer works for ttyS consoles. Since the CSPs use those exclusively for their serial consoles, we need to replace this with another solution (see next commit)
This commit is contained in:
Leonard Cohnen 2024-09-13 23:23:42 +02:00
parent c6a9c2574b
commit 6a0296701e
3 changed files with 1 additions and 32 deletions

View File

@ -70,8 +70,6 @@ def _mkosi_image_impl(ctx):
args.add("--kernel-command-line", ctx.attr.kernel_command_line)
for key, value in ctx.attr.kernel_command_line_dict.items():
args.add("--kernel-command-line", "{}={}".format(key, value))
if ctx.attr.autologin:
args.add("--autologin", "yes")
info = ctx.toolchains["@constellation//bazel/mkosi:toolchain_type"].mkosi
if not info.valid:
@ -110,7 +108,6 @@ mkosi_image = rule(
implementation = _mkosi_image_impl,
attrs = {
"architecture": attr.string(),
"autologin": attr.bool(),
"base_trees": attr.label_list(allow_files = True),
"distribution": attr.string(),
"env": attr.string_dict(),

View File

@ -1,6 +1,6 @@
load("//bazel/mkosi:mkosi_image.bzl", "mkosi_image")
load("//bazel/osimage:upload_os_images.bzl", "upload_os_images")
load(":variants.bzl", "CSPS", "STREAMS", "VARIANTS", "autologin", "base_image", "constellation_packages", "images_for_csp", "images_for_csp_and_stream", "images_for_stream", "kernel_command_line", "kernel_command_line_dict")
load(":variants.bzl", "CSPS", "STREAMS", "VARIANTS", "base_image", "constellation_packages", "images_for_csp", "images_for_csp_and_stream", "images_for_stream", "kernel_command_line", "kernel_command_line_dict")
[
mkosi_image(
@ -10,11 +10,6 @@ load(":variants.bzl", "CSPS", "STREAMS", "VARIANTS", "autologin", "base_image",
] + glob([
"mkosi.repart/**",
]),
autologin = autologin(
variant["csp"],
variant["attestation_variant"],
stream,
),
base_trees = [
base_image(
variant["csp"],

View File

@ -86,7 +86,6 @@ csp_settings = {
},
},
"qemu": {
"autologin": True,
"kernel_command_line_dict": {
"console": "ttyS0",
"constel.csp": "qemu",
@ -136,10 +135,8 @@ attestation_variant_settings = {
stream_settings = {
"console": {
"autologin": True,
},
"debug": {
"autologin": True,
"kernel_command_line": "constellation.debug",
},
"nightly": {},
@ -181,26 +178,6 @@ def constellation_packages(stream):
"//bootstrapper/cmd/bootstrapper:bootstrapper-package",
] + base_packages
def autologin(csp, attestation_variant, stream):
"""Generates a boolean indicating whether autologin should be enabled for the given csp, attestation_variant and stream.
Args:
csp: The cloud service provider to use.
attestation_variant: The attestation variant to use.
stream: The stream to use.
Returns:
A boolean indicating whether autologin should be enabled.
"""
out = None
for settings in from_settings(csp, attestation_variant, stream):
if not "autologin" in settings:
continue
if out != None and out != settings["autologin"]:
fail("Inconsistent autologin settings")
out = settings["autologin"]
return out
def kernel_command_line(csp, attestation_variant, stream):
cmdline = base_cmdline
for settings in from_settings(csp, attestation_variant, stream, default = {}):