-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
36 lines (32 loc) · 1.27 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const std = @import("std");
pub fn build(b: *std.Build) void {
// Target a freestanding environment which uses just the general purpose registers.
const target = std.zig.CrossTarget{
.cpu_arch = .x86_64,
.cpu_features_add = blk: {
const add_features = std.Target.Cpu.Feature.Set.empty;
// TODO: add features.
break :blk add_features;
},
.cpu_features_sub = blk: {
const sub_features = std.Target.Cpu.Feature.Set.empty;
// TODO: remove features.
break :blk sub_features;
},
.os_tag = std.Target.Os.Tag.freestanding,
.abi = std.Target.Abi.none,
};
// Use the standard optimization options. I'll probably build using -Doptimize=ReleaseSmall
// because I haven't figured out how to make use of debug info yet.
const optimize = b.standardOptimizeOption(.{});
// kernel elf executable
const kernel = b.addExecutable(.{
.name = "kernel.elf",
.root_source_file = .{ .path = "kernel/main.zig" },
.target = target,
.optimize = optimize,
});
// Use custom linker script to load to the higher half, among other things.
kernel.setLinkerScript(.{ .path = "linker.ld" });
b.installArtifact(kernel);
}