treewide: use architecture-specific UEFI boot path

The default UEFI boot path depends on the architecture. This change is
needed for aarch64 support.

Change-Id: I69916ac5063e963b67ecdcdd814b0678c61da9fb
Reviewed-on: https://review.monogon.dev/c/monogon/+/4195
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
diff --git a/osbase/build/mkimage/def.bzl b/osbase/build/mkimage/def.bzl
index 33323d7..b8239f5 100644
--- a/osbase/build/mkimage/def.bzl
+++ b/osbase/build/mkimage/def.bzl
@@ -3,6 +3,8 @@
 
     arguments = ctx.actions.args()
     arguments.add_all([
+        "-architecture",
+        ctx.attr.architecture,
         "-efi",
         ctx.file.kernel.path,
         "-system",
@@ -31,13 +33,14 @@
 
     return [DefaultInfo(files = depset([img_file]), runfiles = ctx.runfiles(files = [img_file]))]
 
-node_image = rule(
+_node_image = rule(
     implementation = _node_image_impl,
     doc = """
         Build a disk image from an EFI kernel payload, ABLoader and system partition
         contents. See //osbase/build/mkimage for more information.
     """,
     attrs = {
+        "architecture": attr.string(mandatory = True),
         "kernel": attr.label(
             doc = "EFI binary containing a kernel.",
             mandatory = True,
@@ -70,3 +73,18 @@
         ),
     },
 )
+
+def _node_image_macro_impl(**kwargs):
+    _node_image(
+        architecture = select({
+            "@platforms//cpu:x86_64": "x86_64",
+            "@platforms//cpu:aarch64": "aarch64",
+        }),
+        **kwargs
+    )
+
+node_image = macro(
+    inherit_attrs = _node_image,
+    attrs = {"architecture": None},
+    implementation = _node_image_macro_impl,
+)