feat: add initial impl of efi-stub and kernel
This commit is contained in:
35
build.zig
Normal file
35
build.zig
Normal file
@@ -0,0 +1,35 @@
|
||||
const std = @import("std");
|
||||
const kernel_build = @import("kernel/build.zig");
|
||||
fn buildImage(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) *std.Build.Step {
|
||||
switch (target.result.cpu.arch) {
|
||||
.x86_64 => {
|
||||
const arch_build = @import("arch/x86/boot/build.zig");
|
||||
return arch_build.buildImage(b, optimize);
|
||||
},
|
||||
else => {
|
||||
@panic("target architecture unsupported");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const kernel_only_step = b.step("kernel", "Build the kernel only");
|
||||
const full_step = b.step("full", "Build the full OS image");
|
||||
const qemu_step = b.step("qemu", "Build and run in QEMU");
|
||||
const target = b.resolveTargetQuery(.{
|
||||
.cpu_arch = .x86_64,
|
||||
.os_tag = .freestanding,
|
||||
.abi = .none
|
||||
});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const kernel_install = kernel_build.buildKernelBin(b, target, optimize);
|
||||
kernel_only_step.dependOn(&kernel_install.step);
|
||||
const image_step = buildImage(b, target, optimize);
|
||||
b.getInstallStep().dependOn(image_step);
|
||||
full_step.dependOn(image_step);
|
||||
|
||||
qemu_step.dependOn(image_step);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user