xv6-aarch64-zig/build.zig

30 lines
1,003 B
Zig
Raw Normal View History

2023-12-06 05:56:23 +00:00
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);
}