feat(loader, kernel): impl part of loader and initialize kernel structure

This commit is contained in:
2026-04-11 09:42:09 +08:00
parent 1233ae9e9b
commit 34ccf69569
53 changed files with 1743 additions and 777 deletions

View File

@@ -0,0 +1,26 @@
const std = @import("std");
const Step = std.Build.Step;
const boot_build = @import("boot/build_boot.zig");
fn buildKernel(b: *std.Build, optimize: std.builtin.OptimizeMode) *Step.Compile {
const target = b.resolveTargetQuery(.{
.cpu_arch = .x86_64,
.os_tag = .freestanding,
.abi = .none,
});
const kernel = b.addExecutable(.{
.name = "kernel",
.root_module = b.addModule("kernel", .{
.root_source_file = b.path("kernel/main.zig"),
.target = target,
.optimize = optimize,
}),
});
kernel.entry = .{ .symbol_name = "start_kernel" };
return kernel;
}
pub fn buildImage(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const kernel = buildKernel(b, optimize);
boot_build.buildBootImage(b, kernel);
}