first commit
This commit is contained in:
commit
6f76f9dd9d
9 changed files with 1071 additions and 0 deletions
41
build.zig
Normal file
41
build.zig
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const target = b.resolveTargetQuery(.{
|
||||
.cpu_arch = .riscv64,
|
||||
.os_tag = .freestanding,
|
||||
.abi = .none,
|
||||
});
|
||||
|
||||
const kernel = b.addExecutable(.{
|
||||
.name = "kernel",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.code_model = .medium,
|
||||
}),
|
||||
});
|
||||
|
||||
kernel.setLinkerScript(b.path("linker.ld"));
|
||||
|
||||
b.installArtifact(kernel);
|
||||
|
||||
const run_cmd = b.addSystemCommand(&.{
|
||||
"qemu-system-riscv64",
|
||||
"-machine",
|
||||
"virt",
|
||||
"-bios",
|
||||
"default",
|
||||
"-kernel",
|
||||
});
|
||||
run_cmd.addArtifactArg(kernel);
|
||||
run_cmd.addArgs(&.{
|
||||
"-nographic",
|
||||
});
|
||||
|
||||
const run_step = b.step("run", "Run the kernel in QEMU");
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue