build: phase 2 pilot — pci-bus builds as a package

build-support gains the domains-based userBinary: the default import set
(the library/kernel concern modules, driver/service clients, mmio,
acpi-ids, xkeyboard-config) is assembled from the domain packages, and
the root shim + user link script come from the kernel package directory.
system/drivers/pci-bus is the first binary package: a ~15-line
declarative build.zig naming only its extras (device-manager-protocol,
pci-class); the root build consumes the artifact for the boot image and
the driver also builds standalone from its own directory. Boot-image
file list unchanged.
This commit is contained in:
Daniel Samson
2026-07-26 22:55:47 +01:00
parent 721288c516
commit 6f4fdc2789
5 changed files with 116 additions and 5 deletions
+20
View File
@@ -0,0 +1,20 @@
//! The pci-bus driver as a binary package (docs/build-packages-plan.md,
//! phase 2): this file names only what is specific to pci-bus — the shared
//! recipe and the default-import wiring live in build-support. The root build
//! consumes the artifact for the boot image.
const std = @import("std");
const build_support = @import("build-support");
pub fn build(b: *std.Build) void {
const exe = build_support.userBinary(b, .{
.name = "pci-bus",
.root_source_file = b.path("pci-bus.zig"),
.domains = build_support.domains(b),
});
// The bus driver reports discovered functions to the device manager, and
// decodes each function's class triple to human names in its boot log.
build_support.programModule(exe).addImport("device-manager-protocol", b.dependency("protocol", .{}).module("device-manager-protocol"));
build_support.programModule(exe).addImport("pci-class", b.dependency("device", .{}).module("pci-class"));
b.installArtifact(exe);
}
+15
View File
@@ -0,0 +1,15 @@
.{
.name = .pci_bus,
.version = "0.0.0",
.fingerprint = 0x283fca121f0bb145, // Changing this has security and trust implications.
.minimum_zig_version = "0.16.0",
.dependencies = .{
.@"build-support" = .{ .path = "../../../build-support" },
.kernel = .{ .path = "../../../library/kernel" },
.device = .{ .path = "../../../library/device" },
.client = .{ .path = "../../../library/client" },
.@"xkeyboard-config" = .{ .path = "../../../library/xkeyboard-config" },
.protocol = .{ .path = "../../../library/protocol" },
},
.paths = .{""},
}