wires

summary refs log tree commit diff
path: root/build.zig
diff options
context:
space:
mode:
authorwires <wires@noreply.wires.systems>2025-10-05 20:33:50 -0400
committerwires <wires@noreply.wires.systems>2025-10-05 20:33:50 -0400
commitbca2ad46164acd33b2b49c628acc271edce3f2e4 (patch)
treeee2809959523c1195a1e81ad8da5283c3f3e2edd /build.zig
parentupdate README (diff)
downloadzosimos-bca2ad46164acd33b2b49c628acc271edce3f2e4.tar.gz
get building on 0.15.1
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig19
1 files changed, 11 insertions, 8 deletions
diff --git a/build.zig b/build.zig
index 2c55128..fd55a4b 100644
--- a/build.zig
+++ b/build.zig
@@ -8,24 +8,27 @@ pub fn build(b: *std.Build) void {
 
     const optimize = b.standardOptimizeOption(.{});
 
-    const kernel = b.addExecutable(.{
-        .name = "kernel.elf",
+    const kernel_mod = b.addModule("kernel", .{
         .root_source_file = b.path("src/main.zig"),
         .target = target,
         .optimize = optimize,
     });
+
+    const kernel = b.addExecutable(.{
+        .name = "kernel.elf",
+        .root_module = kernel_mod,
+    });
     kernel.setLinkerScript(b.path("src/Link.ld"));
-    kernel.addIncludePath(b.path("include"));
     kernel.addAssemblyFile(b.path("src/startup.s"));
 
     b.installArtifact(kernel);
 
-    const kernel_bin = b.addObjCopy(kernel.getEmittedBin(), .{
-        .format = .bin,
-        .basename = "kernel.img",
-    });
+    const kernel_copy = b.addSystemCommand(&.{ "llvm-objcopy", "-O", "binary" });
+    kernel_copy.addArtifactArg(kernel);
+    const kernel_bin = kernel_copy.addOutputFileArg("kernel.img");
+
     const install_kernel = b.addInstallFile(
-        kernel_bin.getOutput(),
+        kernel_bin,
         "boot/kernel8.img",
     );
     b.getInstallStep().dependOn(&install_kernel.step);