Skip to content

Commit 94ca07d

Browse files
Merge pull request #75 from adybag14-cyber/fs55-ethernet-integration
Fs55 ethernet integration
2 parents c8a99a5 + c9026c0 commit 94ca07d

11 files changed

+282
-31
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ ZAR-Zig-Agent-Runtime is the Zig runtime port of OpenClaw, with parity-first del
8787
- `src/baremetal/filesystem.zig` now routes `GET` / `LIST` / `STAT` requests through that overlay while rejecting writes under `/proc` and `/sys`
8888
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now expose the overlay through the existing command and typed service surface without widening the opcode model
8989
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves live `E1000` tool-service reuse for `/`, `/proc/runtime/snapshot`, `/proc/runtime/sessions/<id>`, `/sys/storage/state`, and virtual `STAT` readback on the freestanding PVH path
90+
- fourth delivered adoption slice is a ZAR-native read-only device overlay inspired by ZigOS `devfs`:
91+
- `src/baremetal/virtual_fs.zig` now exposes synthetic `/dev` entries for storage, display, network, and a bounded `/dev/null` sink on top of existing ZAR state
92+
- `src/baremetal/filesystem.zig` now routes `GET` / `LIST` / `STAT` requests through that `/dev` overlay while rejecting writes under `/dev`
93+
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now expose `/dev` through the same command and typed service surface
94+
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves live `E1000` tool-service reuse for `/dev`, `/dev/storage/state`, and the expanded root overlay on the freestanding PVH path
9095
- keyboard/mouse is now strict-closed in [`docs/zig-port/FS5_5_HARDWARE_DRIVERS_SYSTEMS.md`](docs/zig-port/FS5_5_HARDWARE_DRIVERS_SYSTEMS.md)
9196
- `src/baremetal/ps2_input.zig` now contains a real x86 port-I/O backed PS/2 controller path
9297
- `scripts/baremetal-qemu-ps2-input-probe-check.ps1` proves IRQ-driven keyboard/mouse state updates against the freestanding PVH artifact

docs/zig-port/FS5_5_HARDWARE_DRIVERS_SYSTEMS.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This track exists to remove guesswork. It defines the real bare-metal subsystems
1818

1919
## ZigOS Reference Track
2020

21-
Status: `Slices 1-3 delivered`
21+
Status: `Slices 1-4 delivered`
2222

2323
This track uses `Cameron-Lyons/zigos` as a reference architecture and source candidate where it improves ZAR.
2424

@@ -65,7 +65,16 @@ Delivered third adoption slice:
6565
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now expose the overlay through the existing builtin and typed `GET` / `LIST` / `STAT` surface instead of inventing a second management protocol
6666
- host regressions now prove `/proc/runtime/snapshot`, `/proc/runtime/sessions/<id>`, `/sys/storage/state`, root overlay listing, and read-only path rejection
6767
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves the same overlay live over the clean-room `E1000` tool-service path, including `/`, `/proc/runtime/snapshot`, `/sys/storage/state`, and virtual `STAT` readback
68-
- full ZigOS-style VFS, `tmpfs`, `devfs`, `ext2`, and `fat32` remain future redesign work; this slice closes the first bounded introspection layer only
68+
69+
Delivered fourth adoption slice:
70+
71+
- ZAR-native read-only device overlay inspired by ZigOS `devfs`
72+
- `src/baremetal/virtual_fs.zig` now exposes synthetic `/dev` entries for storage, display, network, and a bounded `/dev/null` sink on top of existing ZAR state
73+
- `src/baremetal/filesystem.zig` now routes `readFileAlloc`, `listDirectoryAlloc`, and `statSummary` through that `/dev` overlay and rejects writes under `/dev`
74+
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now expose `/dev` through the same builtin and typed `GET` / `LIST` / `STAT` surface
75+
- host regressions now prove `/dev`, `/dev/storage/state`, `/dev/display/state`, root overlay listing, and read-only path rejection
76+
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves `/`, `/dev`, `/dev/storage/state`, and virtual `STAT` readback live over the `E1000` tool-service path
77+
- full ZigOS-style VFS, `tmpfs`, mount semantics, `ext2`, and `fat32` remain future redesign work; this slice closes the bounded `/dev` overlay only
6978

7079
`FS5.5` is not complete until each subsystem has:
7180

docs/zig-port/PHASE_CHECKLIST.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Registry status:
99
- `scripts/package-registry-status.ps1` now checks public npmjs/PyPI visibility correctly even when called with only `-ReleaseTag`, so local release diagnostics no longer silently skip the unresolved registry state.
1010
- release evidence now also includes `release-status.json` + `release-status.md`, which snapshot package visibility plus the latest `zig-ci` / `docs-pages` / `release-preview` / `npm-release` / `python-release` workflow state for the target tag.
1111
- `FS5.6` repo-wide license refresh is now strict-closed locally: root/package license files, release evidence, package metadata, and Linux-style SPDX headers now use `GPL-2.0-only` to match the Linux-derived RTL8139 slice.
12-
- ZigOS reference-only integration planning is now tracked in:
1312
- ZigOS integration planning is now tracked in:
1413
- `docs/zig-port/ZAR_VS_ZIGOS_INTEGRATION_PLAN.md`
1514
- `docs/zig-port/ZAR_VS_ZIGOS_E1000_SLICE_PLAN.md`
@@ -20,6 +19,7 @@ Registry status:
2019
- bounded framed tool-service reuse is now closed over `E1000` through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`, and bounded `HTTP` / `HTTPS` transport reuse remains closed through `scripts/baremetal-qemu-e1000-http-post-probe-check.ps1` and `scripts/baremetal-qemu-e1000-https-post-probe-check.ps1`.
2120
- second delivered adoption slice is the hosted benchmark lane through `src/benchmark_suite.zig`, `src/benchmark_main.zig`, and `scripts/benchmark-smoke-check.ps1`, with the current catalog covering DNS, DHCP, TCP, runtime-state queue churn, and tool-service codec parsing.
2221
- third delivered adoption slice is a ZAR-native read-only introspection overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, with `/proc` + `/sys` exported over existing runtime/storage/display/network state, host regressions for `GET` / `LIST` / `STAT` plus write rejection, and live `E1000` tool-service proof through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`.
22+
- fourth delivered adoption slice is a ZAR-native read-only device overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, with `/dev` exported over existing storage/display/network device state, host regressions for `GET` / `LIST` / `STAT` plus write rejection, and live `E1000` tool-service proof through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`.
2323
- `FS5.5` framebuffer/console strict closure is now reached locally: `src/baremetal/framebuffer_console.zig` programs a real Bochs/QEMU BGA linear-framebuffer path with bounded mode support for `640x400`, `800x600`, `1024x768`, `1280x720`, and `1280x1024`, `src/baremetal/pci.zig` discovers the selected PCI display adapter as structured metadata, exposes the framebuffer BAR, and enables decode on that function, `src/baremetal/edid.zig`, `src/baremetal/display_output.zig`, and `src/baremetal/virtio_gpu.zig` now add the first real EDID-backed controller path over `virtio-gpu-pci` including exported capability flags for digital input, preferred timing, CEA, DisplayID, HDMI-vendor-data, and basic-audio metadata when present plus EDID-derived connector inference, bounded per-output entry export, and bounded resource-create/attach/set-scanout/flush behavior, `src/pal/framebuffer.zig` exposes the surface plus supported-mode enumeration and display-output state through the PAL, host regressions in `src/baremetal/framebuffer_console.zig`, `src/baremetal/virtio_gpu.zig`, `src/baremetal_main.zig`, and `src/baremetal/display_output.zig` prove framebuffer state, display-output state, adapter metadata, supported-mode enumeration, glyph pixel updates, bounded mode switching, present counters, non-zero scanout pixels, connector inference from EDID capability flags, and the output-entry table, and the live QEMU+GDB proofs `scripts/baremetal-qemu-framebuffer-console-probe-check.ps1` and `scripts/baremetal-qemu-virtio-gpu-display-probe-check.ps1` now read back real MMIO banner pixels plus BGA adapter metadata and real `virtio-gpu-pci` EDID/controller capability state with non-zero scanout pixels and validated output-entry metadata over the freestanding PVH artifact; real HDMI/DisplayPort connector-specific scanout paths remain future depth and are not claimed here.
2424
- Latest FS5.5 display connector activation slice: `src/baremetal/display_output.zig` now retargets the exported active output from bounded per-output entries, `src/baremetal/tool_exec.zig` now exposes `display-activate <connector>` and uses connector-targeted activation in launch profiles, `src/baremetal/tool_service.zig` now exposes typed `DISPLAYACTIVATE`, host/module validation proves successful activation of the connected connector plus explicit mismatched-connector rejection, and `scripts/baremetal-qemu-virtio-gpu-display-probe-check.ps1` now proves the same success/rejection behavior on the live `virtio-gpu-pci` controller path.
2525
- Latest FS5.5 display output mode slice: `src/baremetal/display_output.zig` and `src/baremetal/virtio_gpu.zig` now support explicit per-output mode retargeting on the real `virtio-gpu-pci` path, `src/pal/framebuffer.zig` and `src/baremetal_main.zig` expose that same bounded control through the PAL and `oc_display_output_set`, `src/baremetal/tool_exec.zig` now exposes `display-output-set <index> <width> <height>`, `src/baremetal/tool_service.zig` now exposes typed `DISPLAYOUTPUTSET`, host/module validation proves the connected output can be driven to `1024x768` while oversized requests are rejected without corrupting the exported state, and `scripts/baremetal-qemu-virtio-gpu-display-probe-check.ps1` now proves the same explicit output-index mode change on the live controller path.

docs/zig-port/PORT_PLAN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Full-stack replacement execution reference:
2525
- bounded framed tool-service reuse is now closed over `E1000` through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`, and bounded `HTTP` / `HTTPS` transport reuse remains closed through host regressions plus `scripts/baremetal-qemu-e1000-http-post-probe-check.ps1` and `scripts/baremetal-qemu-e1000-https-post-probe-check.ps1`
2626
- second delivered adoption slice is the hosted benchmark lane through `src/benchmark_suite.zig`, `src/benchmark_main.zig`, and `scripts/benchmark-smoke-check.ps1`
2727
- third delivered adoption slice is a ZAR-native read-only introspection overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, exposing `/proc` + `/sys` over the existing runtime/storage/display/network state, reusing the existing builtin and typed `GET` / `LIST` / `STAT` tool-service surface, and proving the same overlay live over `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`
28+
- fourth delivered adoption slice is a ZAR-native read-only device overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, exposing `/dev` over the existing storage/display/network device state, reusing the existing builtin and typed `GET` / `LIST` / `STAT` tool-service surface, and proving the same overlay live over `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`
2829
- `FS5.5` hardware-driver pivot update:
2930
- framebuffer/console strict closure is now reached locally.
3031
- real linear-framebuffer path shipped in `src/baremetal/framebuffer_console.zig`:

docs/zig-port/ZAR_VS_ZIGOS_INTEGRATION_PLAN.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Status
44

5-
This document tracks the strict, reference-only integration plan for ideas and feature targets observed in `Cameron-Lyons/zigos`.
5+
This document tracks the strict integration plan for ideas, adapted code, and feature targets observed in `Cameron-Lyons/zigos`.
66

77
Current posture:
88

99
- ZigOS upstream is now explicitly `MIT` licensed.
1010
- ZAR can legally study, adapt, or import ZigOS code when that is the right engineering choice.
1111
- Current delivered slices remain ZAR-owned implementations with ZAR-native tests, probes, and release gates.
12-
- Delivered ZigOS-inspired slices: `3`
12+
- Delivered ZigOS-inspired slices: `4`
1313

1414
## Source Baseline
1515

@@ -42,11 +42,11 @@ That removes the previous legal blocker, but it does not remove ZAR's engineerin
4242

4343
Any ZAR slice influenced by ZigOS must satisfy all of the following:
4444

45-
1. ZAR-owned implementation only
46-
2. ZAR-owned tests only
47-
3. ZAR-owned live probe coverage only
48-
4. no imported upstream text beyond short factual references
49-
5. explicit tracking note that the slice is `reference-inspired`, not imported
45+
1. implementation is either ZAR-owned or explicitly tracked as adapted/imported ZigOS code
46+
2. tests remain ZAR-owned
47+
3. live probe coverage remains ZAR-owned
48+
4. provenance stays explicit in docs and issue tracking
49+
5. each slice is labeled as `reference-inspired`, `adapted`, or `imported`
5050

5151
## Capability Inventory
5252

@@ -63,7 +63,7 @@ The table below is the current strict classification for every realistic ZigOS a
6363
| `VGA path` | `src/kernel/drivers/vga.zig` | Low | Already covered conceptually | Reference only |
6464
| `VFS core` | `src/kernel/fs/vfs.zig` | High | Major redesign | ZAR-native VFS design doc first |
6565
| `tmpfs` | `src/kernel/fs/tmpfs.zig` | Medium-high | Adapt later | Rebuild concept over ZAR runtime/package/workspace state |
66-
| `devfs` | `src/kernel/fs/devfs.zig` | Medium-high | Adapt later | Rebuild concept over ZAR bare-metal devices |
66+
| `devfs` | `src/kernel/fs/devfs.zig` | Medium-high | Adapt now | First bounded read-only `/dev` overlay delivered; broader device/VFS model remains later |
6767
| `procfs` | `src/kernel/fs/procfs.zig` | Medium-high | Adapt now | First bounded read-only `/proc` overlay delivered; broader VFS remains later |
6868
| `sysfs` | `src/kernel/fs/sysfs.zig` | Medium-high | Adapt now | First bounded read-only `/sys` overlay delivered; broader VFS remains later |
6969
| `ext2` | `src/kernel/fs/ext2.zig` | Medium | Major redesign | Only after ZAR VFS exists |
@@ -85,7 +85,7 @@ The table below is the current strict classification for every realistic ZigOS a
8585

8686
## Integration Order
8787

88-
The order below is strict. It favors bounded clean-room wins before any redesign-heavy GP-OS work.
88+
The order below is strict. It favors bounded, low-risk wins before any redesign-heavy GP-OS work.
8989

9090
### Z0. Provenance Discipline
9191

@@ -165,12 +165,15 @@ Current delivered scope:
165165
- `src/baremetal/filesystem.zig` now routes `readFileAlloc`, `listDirectoryAlloc`, and `statSummary` through that overlay and rejects writes under `/proc` / `/sys`
166166
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` reuse the existing builtin and typed `GET` / `LIST` / `STAT` surface for the overlay
167167
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves the overlay live on the clean-room `E1000` tool-service path
168+
- `src/baremetal/virtual_fs.zig` now also exposes a bounded read-only `/dev` overlay over existing ZAR storage, display, and network device state
169+
- `src/baremetal/filesystem.zig` now routes `readFileAlloc`, `listDirectoryAlloc`, and `statSummary` through that `/dev` overlay and rejects writes under `/dev`
170+
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now reuse the same builtin and typed `GET` / `LIST` / `STAT` surface for `/dev`
171+
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves `/`, `/dev`, and `/dev/storage/state` live on the `E1000` tool-service path
168172

169173
Still intentionally out of scope for this slice:
170174

171175
- full VFS mount model
172176
- `tmpfs`
173-
- `devfs`
174177
- external on-disk filesystems such as `ext2` / `fat32`
175178
- userspace-facing path semantics beyond the current read-only introspection tree
176179

@@ -251,7 +254,7 @@ These are explicitly not part of the first ZigOS reference track:
251254

252255
Any ZigOS-inspired ZAR slice must satisfy all of the following:
253256

254-
1. implementation is ZAR-owned and clean-room
257+
1. implementation has explicit provenance and review
255258
2. host regression coverage exists
256259
3. live bare-metal proof exists where hardware semantics matter
257260
4. `zig build test --summary all` is green

scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,75 @@ function Resolve-CompilerRtArchive {
124124
return $null
125125
}
126126

127-
$candidate = Get-ChildItem -Path $objRoot -Recurse -Filter 'libcompiler_rt.a' -ErrorAction SilentlyContinue |
128-
Sort-Object LastWriteTime -Descending |
129-
Select-Object -First 1
127+
$candidates = Get-ChildItem -Path $objRoot -Recurse -Filter 'libcompiler_rt.a' -ErrorAction SilentlyContinue |
128+
Sort-Object LastWriteTime -Descending
130129

131-
if ($null -ne $candidate) {
132-
return $candidate.FullName
130+
foreach ($candidate in $candidates) {
131+
if (Test-CompilerRtArchiveElf -ArchivePath $candidate.FullName) {
132+
return $candidate.FullName
133+
}
133134
}
134135

135136
return $null
136137
}
137138

139+
function Resolve-TemporaryRoot {
140+
$candidates = @(
141+
$env:TEMP,
142+
$env:TMPDIR,
143+
$env:TMP,
144+
[System.IO.Path]::GetTempPath()
145+
)
146+
147+
foreach ($candidate in $candidates) {
148+
if (-not [string]::IsNullOrWhiteSpace($candidate)) {
149+
return $candidate
150+
}
151+
}
152+
153+
throw 'Temporary directory is not available.'
154+
}
155+
156+
function Test-CompilerRtArchiveElf {
157+
param(
158+
[string] $ArchivePath
159+
)
160+
161+
if (-not (Test-Path $ArchivePath)) {
162+
return $false
163+
}
164+
165+
$memberName = (& $zig ar t $ArchivePath 2>$null | Select-Object -First 1)
166+
if ([string]::IsNullOrWhiteSpace($memberName)) {
167+
return $false
168+
}
169+
170+
$scratchRoot = Join-Path (Resolve-TemporaryRoot) 'zar-zig-probe-compiler-rt'
171+
$scratchDir = Join-Path $scratchRoot ([System.Guid]::NewGuid().ToString('N'))
172+
New-Item -ItemType Directory -Force -Path $scratchDir | Out-Null
173+
try {
174+
Push-Location $scratchDir
175+
try {
176+
& $zig ar x $ArchivePath $memberName 2>$null | Out-Null
177+
} finally {
178+
Pop-Location
179+
}
180+
$memberPath = Join-Path $scratchDir $memberName
181+
if (-not (Test-Path $memberPath)) {
182+
return $false
183+
}
184+
$bytes = [System.IO.File]::ReadAllBytes($memberPath)
185+
if ($bytes.Length -lt 4) {
186+
return $false
187+
}
188+
return ($bytes[0] -eq 0x7F -and $bytes[1] -eq 0x45 -and $bytes[2] -eq 0x4C -and $bytes[3] -eq 0x46)
189+
} finally {
190+
if (Test-Path $scratchDir) {
191+
Remove-Item -Force -Recurse $scratchDir
192+
}
193+
}
194+
}
195+
138196
function New-RawDiskImage {
139197
param(
140198
[string] $Path,

0 commit comments

Comments
 (0)