]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Communicate the associated dir in the ESP via /etc/kernel/entry-token
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 16 Jun 2022 21:43:45 +0000 (17:43 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 20 Jun 2022 09:41:31 +0000 (11:41 +0200)
/etc/kernel/entry-token is the new way introduced in systemd v251 to
identify the directory that kernel-install and bootctl should install
their stuff to. If it exists, bootctl and kernel-install will read it
and use the directory inside to install things to.

Currently, in mkosi, we generate a random machine ID during the build
and use that as the directory under the ESP to install things to. Until
all distros we support get support for /etc/kernel/entry-token, we're
limited to using the machine ID as the directory to install stuff under
in the ESP.

Since the machine ID used during the build is scrubbed from the image,
users don't a way to figure out the directory in the ESP associated
with the rootfs after the build is finished. To fix this, let's write
the machine ID to /etc/kernel/entry-token before it is scrubbed so
that users can read the file to figure out which directory in the ESP
that they should look under to find stuff associated with the
corresponding rootfs.

Fixes #686

mkosi/__init__.py

index c717ef5dc1c2b891afedb8b90ae7a742b619c7f2..ff957161f281cd413701564fc082b898f0123cea 100644 (file)
@@ -1842,6 +1842,7 @@ def prepare_tree(args: MkosiArgs, root: Path, do_run_build_script: bool, cached:
             root.joinpath("etc/kernel").mkdir(mode=0o755)
 
             root.joinpath("etc/kernel/cmdline").write_text(" ".join(args.kernel_command_line) + "\n")
+            root.joinpath("etc/kernel/entry-token").write_text(f"{args.machine_id}\n")
 
         if do_run_build_script or args.ssh:
             root_home(args, root).mkdir(mode=0o750)