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
··· 9 9 }); 10 10 const ukernel_artifact = ukernel_dep.artifact("ukernel"); 11 11 const ukernel_inst = b.addInstallFile(ukernel_artifact.getEmittedBin(), arch.kernelExeName()); 12 - b.default_step.dependOn(&ukernel_inst.step); 12 + b.getInstallStep().dependOn(&ukernel_inst.step); 13 13 14 14 const root_dep = b.dependency("root_server", .{ 15 15 .arch = arch, 16 16 }); 17 17 const root_artifact = root_dep.artifact("root_server"); 18 18 const root_inst = b.addInstallFile(root_artifact.getEmittedBin(), arch.rootTaskName()); 19 - b.default_step.dependOn(&root_inst.step); 19 + b.getInstallStep().dependOn(&root_inst.step); 20 20 21 21 // Run in QEMU 22 22 run_blk: { ··· 34 34 break :blk limine_dep.path("BOOTX64.EFI"); 35 35 }; 36 36 37 + // Install Required dependencies 37 38 const code_install = b.addInstallFile(ovmf_code, "OVMF_CODE_X64.fd"); 38 39 const vars_install = b.addInstallFile(ovmf_vars, "OVMF_VARS_X64.fd"); 39 40 const loader_install = b.addInstallFileWithDir(loader_path, .{ .custom = "EFI/BOOT" }, "BOOTX64.EFI"); 40 41 const config_install = b.addInstallFileWithDir(b.path("assets/limine.conf"), .{ .custom = "limine" }, "limine.conf"); 41 42 42 - const qemu_prepare_step = b.step("qemu_prepare", "Prepare for QEMU run"); 43 - qemu_prepare_step.dependOn(&code_install.step); 44 - qemu_prepare_step.dependOn(&vars_install.step); 45 - qemu_prepare_step.dependOn(&loader_install.step); 46 - qemu_prepare_step.dependOn(&config_install.step); 43 + 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" }); 44 + 45 + // Depend on the install step (ukernel and root task) 46 + qemu_cmd.step.dependOn(b.getInstallStep()); 47 + // Depend on OVMF code+vars, Limine bootloader, and Limine cfg 48 + qemu_cmd.step.dependOn(&code_install.step); 49 + qemu_cmd.step.dependOn(&vars_install.step); 50 + qemu_cmd.step.dependOn(&loader_install.step); 51 + qemu_cmd.step.dependOn(&config_install.step); 47 52 48 - 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" }); 53 + // Create the actual public callable step and depend on our command 49 54 const qemu_step = b.step("qemu", "Run in QEMU"); 50 - qemu_step.dependOn(b.default_step); 51 - qemu_step.dependOn(qemu_prepare_step); 52 55 qemu_step.dependOn(&qemu_cmd.step); 53 56 } 54 57 }