aboutsummaryrefslogtreecommitdiff
path: root/tools/make_iso.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/make_iso.bzl')
-rw-r--r--tools/make_iso.bzl41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/make_iso.bzl b/tools/make_iso.bzl
new file mode 100644
index 0000000..5ff20f5
--- /dev/null
+++ b/tools/make_iso.bzl
@@ -0,0 +1,41 @@
+def make_iso(**kwargs):
+ _make_iso(
+ image = "{name}.iso".format(**kwargs),
+ **kwargs
+ )
+
+def _make_iso_impl(ctx):
+ inputs = []
+ outputs = []
+ args = ctx.actions.args()
+
+ args.add("-c", ctx.file.bootloader.path)
+ inputs.append(ctx.file.bootloader)
+ args.add("-k", ctx.file.kernel.path)
+ inputs.append(ctx.file.kernel)
+
+ args.add("-o", ctx.outputs.image.path)
+ outputs.append(ctx.outputs.image)
+
+ ctx.actions.run(
+ inputs = inputs,
+ outputs = outputs,
+ arguments = [args],
+ executable = ctx.executable._generator,
+ progress_message = "Generating ISO image %s" % ctx.label.name,
+ )
+
+_make_iso = rule(
+ attrs = {
+ "bootloader": attr.label(allow_single_file = True),
+ "kernel": attr.label(allow_single_file = True),
+ "image": attr.output(),
+ "_generator": attr.label(
+ default = Label(":make_iso"),
+ executable = True,
+ allow_files = True,
+ cfg = "exec",
+ ),
+ },
+ implementation = _make_iso_impl,
+)