third_party/efistub: init

Adds the EFI stub from systemd-boot, built using our new EFI toolchain.
This allows us to bundle kernels, command lines and other data into
single EFI payloads and also sign them later.

A rules to build these unified EFI payloads is coming later.

Change-Id: I789e893ff88541f3dc9e7400ccd2565ae414e554
Reviewed-on: https://review.monogon.dev/c/monogon/+/335
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/third_party/efistub/external.bzl b/third_party/efistub/external.bzl
new file mode 100644
index 0000000..f5fc095
--- /dev/null
+++ b/third_party/efistub/external.bzl
@@ -0,0 +1,19 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+def efistub_external(name, version):
+    sums = {
+        "3542da2442d8b29661b47c42ad7e5fa9bc8562ec": "021c135bee39ca7346d1f09923be7c044a3d35866ff411a7c9626702ff4c9523",
+    }
+
+    http_archive(
+        name = name,
+        build_file = "@//third_party/efistub:efistub.bzl",
+        sha256 = sums[version],
+        strip_prefix = "systemd-%s" % version,
+        patch_args = ["-p1"],
+        patches = [
+            "//third_party/efistub/patches:use-sysv-for-kernel.patch",
+            "//third_party/efistub/patches:remove-wrong-cmdline-assertion.patch",
+        ],
+        urls = ["https://github.com/systemd/systemd/archive/%s.zip" % version],
+    )