Microkernel thing OS experiment (Zig ⚡)

fix qemu build not installing kernel in time

We love build.zig...

pci.express 4c810fd8 ced51a0f

verified
Changed files
+13 -10
+13 -10
build.zig
···
});
const ukernel_artifact = ukernel_dep.artifact("ukernel");
const ukernel_inst = b.addInstallFile(ukernel_artifact.getEmittedBin(), arch.kernelExeName());
-
b.default_step.dependOn(&ukernel_inst.step);
+
b.getInstallStep().dependOn(&ukernel_inst.step);
const root_dep = b.dependency("root_server", .{
.arch = arch,
});
const root_artifact = root_dep.artifact("root_server");
const root_inst = b.addInstallFile(root_artifact.getEmittedBin(), arch.rootTaskName());
-
b.default_step.dependOn(&root_inst.step);
+
b.getInstallStep().dependOn(&root_inst.step);
// Run in QEMU
run_blk: {
···
break :blk limine_dep.path("BOOTX64.EFI");
};
+
// Install Required dependencies
const code_install = b.addInstallFile(ovmf_code, "OVMF_CODE_X64.fd");
const vars_install = b.addInstallFile(ovmf_vars, "OVMF_VARS_X64.fd");
const loader_install = b.addInstallFileWithDir(loader_path, .{ .custom = "EFI/BOOT" }, "BOOTX64.EFI");
const config_install = b.addInstallFileWithDir(b.path("assets/limine.conf"), .{ .custom = "limine" }, "limine.conf");
-
const qemu_prepare_step = b.step("qemu_prepare", "Prepare for QEMU run");
-
qemu_prepare_step.dependOn(&code_install.step);
-
qemu_prepare_step.dependOn(&vars_install.step);
-
qemu_prepare_step.dependOn(&loader_install.step);
-
qemu_prepare_step.dependOn(&config_install.step);
+
const qemu_cmd = b.addSystemCommand(&.{ "qemu-system-x86_64", "-smp", "4", "-m", "4G", "-monitor", "stdio", "-drive", "format=raw,file=fat:rw:zig-out", "-drive", "if=pflash,format=raw,readonly=on,file=zig-out/OVMF_CODE_X64.fd", "-drive", "if=pflash,format=raw,file=zig-out/OVMF_VARS_X64.fd" });
+
+
// Depend on the install step (ukernel and root task)
+
qemu_cmd.step.dependOn(b.getInstallStep());
+
// Depend on OVMF code+vars, Limine bootloader, and Limine cfg
+
qemu_cmd.step.dependOn(&code_install.step);
+
qemu_cmd.step.dependOn(&vars_install.step);
+
qemu_cmd.step.dependOn(&loader_install.step);
+
qemu_cmd.step.dependOn(&config_install.step);
-
const qemu_cmd = b.addSystemCommand(&.{ "qemu-system-x86_64", "-smp", "4", "-m", "4G", "-monitor", "stdio", "-drive", "format=raw,file=fat:rw:zig-out", "-drive", "if=pflash,format=raw,readonly=on,file=zig-out/OVMF_CODE_X64.fd", "-drive", "if=pflash,format=raw,file=zig-out/OVMF_VARS_X64.fd" });
+
// Create the actual public callable step and depend on our command
const qemu_step = b.step("qemu", "Run in QEMU");
-
qemu_step.dependOn(b.default_step);
-
qemu_step.dependOn(qemu_prepare_step);
qemu_step.dependOn(&qemu_cmd.step);
}
}