30 lines
1,003 B
Zig
30 lines
1,003 B
Zig
|
const std = @import("std");
|
||
|
const Builder = @import("std").build.Builder;
|
||
|
const LazyPath = @import("std").build.LazyPath;
|
||
|
const Target = @import("std").Target;
|
||
|
const CrossTarget = @import("std").zig.CrossTarget;
|
||
|
const Feature = @import("std").Target.Cpu.Feature;
|
||
|
|
||
|
pub fn build(b: *Builder) void {
|
||
|
const arch = Target.Cpu.Arch.aarch64;
|
||
|
const tag = Target.Os.Tag.freestanding;
|
||
|
const target = CrossTarget.fromTarget(.{
|
||
|
.cpu = .{
|
||
|
.arch = arch,
|
||
|
.model = Target.Cpu.Model.generic(arch),
|
||
|
.features = Feature.Set.empty,
|
||
|
},
|
||
|
.os = .{ .tag = tag, .version_range = Target.Os.VersionRange.default(tag, arch) },
|
||
|
.ofmt = Target.ObjectFormat.raw,
|
||
|
.abi = Target.Abi.none,
|
||
|
});
|
||
|
|
||
|
const result = b.addExecutable(.{
|
||
|
.name = "kernel.elf",
|
||
|
.root_source_file = .{ .path = "src/entry.zig" },
|
||
|
.target = target,
|
||
|
});
|
||
|
result.setLinkerScript(.{ .path = "src/kernel.ld" });
|
||
|
b.installArtifact(result);
|
||
|
}
|