Initial commit
This commit is contained in:
commit
5f2e19904d
9 changed files with 503 additions and 0 deletions
44
build.zig
Normal file
44
build.zig
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.resolveTargetQuery(.{
|
||||
.cpu_arch = std.Target.Cpu.Arch.x86,
|
||||
.ofmt = std.Target.ObjectFormat.elf,
|
||||
.abi = std.Target.Abi.none,
|
||||
.os_tag = std.Target.Os.Tag.freestanding,
|
||||
.cpu_features_sub = std.Target.x86.featureSet(&.{
|
||||
.mmx,
|
||||
.sse,
|
||||
.sse2,
|
||||
.avx,
|
||||
.avx2,
|
||||
}),
|
||||
.cpu_features_add = std.Target.x86.featureSet(&.{
|
||||
.soft_float,
|
||||
}),
|
||||
});
|
||||
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const kernel = b.addExecutable(.{
|
||||
.name = "kernel",
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
}),
|
||||
});
|
||||
kernel.setLinkerScript(b.path("kernel.ld"));
|
||||
|
||||
b.installArtifact(kernel);
|
||||
|
||||
const qemu = b.addSystemCommand(&[_][]const u8{
|
||||
"qemu-system-x86_64",
|
||||
});
|
||||
qemu.addArg("-kernel");
|
||||
qemu.addFileArg(kernel.getEmittedBin());
|
||||
|
||||
const run = b.step("run", "Run QEMU");
|
||||
run.dependOn(&qemu.step);
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue