aboutsummaryrefslogtreecommitdiff
path: root/tools/qemu.bzl
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2024-03-08 17:24:49 +0200
committeraqua <aqua@iserlohn-fortress.net>2024-03-08 22:00:07 +0200
commit20b97ea7c0dbbdc13800e12ff5c86c00c4a342ec (patch)
tree473281e5fc8b256827ce1a678573444e1aa5f669 /tools/qemu.bzl
parentGenerate src/conf.h (diff)
downloadkernel-20b97ea7c0dbbdc13800e12ff5c86c00c4a342ec.tar.xz
Bazel build
Diffstat (limited to 'tools/qemu.bzl')
-rw-r--r--tools/qemu.bzl33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/qemu.bzl b/tools/qemu.bzl
new file mode 100644
index 0000000..9493306
--- /dev/null
+++ b/tools/qemu.bzl
@@ -0,0 +1,33 @@
+load("//toolchains:i386_qemu.bzl", qemu_i386 = "qemu_wrapper")
+
+def qemu(**kwargs):
+ _qemu(
+ wrapper_content = select({
+ "@platforms//cpu:i386": qemu_i386(),
+ "//conditions:default": "/bin/false",
+ }),
+ **kwargs
+ )
+
+def _qemu_impl(ctx):
+ print(ctx)
+ print(ctx.attr)
+
+ wrapper = ctx.actions.declare_file("%s_wrapper" % ctx.label.name)
+ wrapper_content = ctx.attr.wrapper_content.format(
+ cdrom = ctx.file.cdrom.basename,
+ )
+ ctx.actions.write(wrapper, wrapper_content, is_executable = True)
+
+ runfiles = ctx.runfiles(files = [ctx.file.cdrom])
+
+ return [DefaultInfo(executable = wrapper, runfiles = runfiles)]
+
+_qemu = rule(
+ implementation = _qemu_impl,
+ attrs = {
+ "cdrom": attr.label(allow_single_file = True),
+ "wrapper_content": attr.string(),
+ },
+ executable = True,
+)