Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions BOOT_TEST_PROGRESS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Boot Test Progress Tracker

**Last Updated:** 2026-01-28 (auto-updated by Claude)

## Quick Start - What Can I See Right Now?

### Current Phase: 4 COMPLETE → Ready for Phase 5 (PROGRESS BARS WORK!)

```bash
# GRAPHICAL PROGRESS BARS ARE NOW LIVE!
# Run with graphics to see them:
BREENIX_GRAPHICS=1 ./scripts/run-arm64-qemu.sh

# You'll see a panel like:
# memory [||||||||||||||||||||] 100% PASS
# scheduler [....................] 0% N/A
# ...
```

**What to expect:** More subsystems lighting up as tests are added!

---

## Phase Milestones - When Can I See Something?

| Phase | Status | Runnable? | Command | What You'll See |
|-------|--------|-----------|---------|-----------------|
| 1. Infrastructure | COMPLETE | No | N/A | Module structure only |
| 2. Progress Tracking | COMPLETE | **YES** | `./scripts/run-arm64-qemu.sh` | `[TEST:subsystem:name:PASS]` in serial |
| 3. Graphical Display | COMPLETE | **YES** | `BREENIX_GRAPHICS=1 ./scripts/run-arm64-qemu.sh` | Progress bars on screen! |
| 4a-4l. Tests | IN PROGRESS | **YES** | Same as above | More progress bars filling |
| 5. Polish | PENDING | Yes | Same as above | Beautiful summary screen |

---

## Current Status

### Phase 1: Test Framework Infrastructure - COMPLETE
- [x] Create `kernel/src/test_framework/mod.rs`
- [x] Create `kernel/src/test_framework/registry.rs`
- [x] Create `kernel/src/test_framework/executor.rs`
- [x] Create `kernel/src/test_framework/progress.rs`
- [x] Feature flag in `Cargo.toml`
- [x] Module declaration in `lib.rs`
- [x] Compiles on x86_64
- [x] Compiles on ARM64

### Phase 2: Atomic Progress Tracking - COMPLETE
- [x] Serial output protocol (`[TEST:subsystem:name:PASS]`)
- [x] Call `run_all_tests()` from boot sequence (both architectures)
- [x] Sanity tests registered (framework_sanity, heap_alloc_basic)
- [x] Verify serial markers appear

### Phase 3: Graphical Progress Display - COMPLETE
- [x] Create `kernel/src/test_framework/display.rs`
- [x] Progress bar rendering function (40-char bars)
- [x] Color-coded status (PEND=gray, RUN=blue, PASS=green, FAIL=red)
- [x] Integration with framebuffer (ARM64 VirtIO, x86_64 UEFI GOP)
- [x] Verify progress bars appear on screen

### Phase 4: Adding Tests - COMPLETE ✅
All parallel agents finished successfully:
- [x] 4a: Memory tests - COMPLETE (5 tests)
- [x] 4b: Interrupt tests - COMPLETE (4 tests: controller_init, irq_enable_disable, timer_running, keyboard_setup)
- [x] 4c: Timer tests - COMPLETE (4 tests)
- [x] 4d: Logging tests - COMPLETE (3 tests)
- [x] 4e: System tests - COMPLETE (3 tests)
- [x] 4f: Exception tests - COMPLETE (3 tests)
- [x] 4g: Guard Page tests - COMPLETE (3 tests)
- [x] 4h: Stack Bounds tests - COMPLETE (15 tests!)
- [x] 4i: Async tests - COMPLETE (3 tests: executor_exists, async_waker, future_basics)
- [x] 4j: Process/Syscall tests - COMPLETE (4 tests)
- [x] 4k: Network tests - COMPLETE (4 tests: stack_init, virtio_probe, socket_creation, loopback)
- [x] 4l: Filesystem tests - COMPLETE (4 tests: vfs_init, devfs_mounted, file_open_close, directory_list)

**Total: ~55 tests - All building on both ARM64 and x86_64!**

---

## Test Parity Progress

| Subsystem | Tests | Architecture | Parity |
|-----------|-------|--------------|--------|
| Memory | 5 | Arch::Any | 100% ✅ |
| Interrupts | 4 | Arch::Any | 100% ✅ |
| Timer | 4 | Arch::Any | 100% ✅ |
| Logging | 3 | Arch::Any | 100% ✅ |
| System | 3 | Arch::Any | 100% ✅ |
| Exceptions | 3 | Arch::Any | 100% ✅ |
| Guard Pages | 3 | Arch::Any | 100% ✅ |
| Stack Bounds | 15 | Arch::Any | 100% ✅ |
| Async/Scheduler | 3 | Arch::Any | 100% ✅ |
| Process/Syscall | 4 | Arch::Any | 100% ✅ |
| Network | 4 | Arch::Any | 100% ✅ |
| Filesystem | 4 | Arch::Any | 100% ✅ |
| **TOTAL** | **~55** | | **100%** |

---

## How to Check Progress

### Option 1: Watch This File
```bash
# In lazygit, this file updates as phases complete
cat BOOT_TEST_PROGRESS.md
```

### Option 2: Check Git Status
```bash
git status
# Look for new files in kernel/src/test_framework/
```

### Option 3: Try Building (after Phase 1)
```bash
cargo build --release --target aarch64-breenix.json \
-Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem \
-p kernel --bin kernel-aarch64
```

### Option 4: Run with Graphics (after Phase 3)
```bash
BREENIX_GRAPHICS=1 ./scripts/run-arm64-qemu.sh
# You'll see progress bars!
```

---

## Recent Activity Log

```
2026-01-28 - Phase 1 COMPLETE
- Created kernel/src/test_framework/ module
- Files: mod.rs, registry.rs, executor.rs, progress.rs
- Added boot_tests feature flag
- Builds on both x86_64 and ARM64

2026-01-28 - Phase 2 COMPLETE
- Added serial output protocol
- Integrated with boot sequence (main.rs + main_aarch64.rs)
- Added 2 sanity tests to Memory subsystem
- Serial markers: [BOOT_TESTS:START], [TEST:...], [TESTS_COMPLETE:X/Y]

2026-01-28 - Phase 3 COMPLETE
- Created kernel/src/test_framework/display.rs
- Progress bars with color-coded status
- Works on ARM64 (VirtIO GPU) and x86_64 (UEFI GOP)
- TRY IT: BREENIX_GRAPHICS=1 ./scripts/run-arm64-qemu.sh

2026-01-28 - Phase 4 started, multiple Codex agents dispatched in parallel
- Adding tests for all subsystems
- Achieving ARM64/x86_64 parity

2026-01-28 - Phase 4 COMPLETE
- All 12 parallel agents finished successfully
- ~55 tests across 12 subsystems
- All tests use Arch::Any (work on both x86_64 and ARM64)
- Builds verified on both architectures
- Ready for Phase 5: Polish
```
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"

[features]
testing = ["kernel/testing"]
boot_tests = ["kernel/boot_tests"] # Parallel boot test framework
kthread_test_only = ["kernel/kthread_test_only"] # Run only kthread tests and exit
kthread_stress_test = ["kernel/kthread_stress_test"] # Run kthread stress test (100+ kthreads) and exit
workqueue_test_only = ["kernel/workqueue_test_only"] # Run only workqueue tests and exit
Expand Down
158 changes: 110 additions & 48 deletions docs/planning/ARM64_HANDOFF_2026-01-27.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,116 @@
# ARM64 Parity Handoff (2026-01-27)
# ARM64 Parity Handoff (2026-01-27 - Updated)

This is a short, concrete handoff of the current ARM64 parity effort and where it stands.
This document tracks the ARM64 parity effort and current status.

## Current Branch / Status
- Branch: `feature/arm64-parity`
- Work is being executed step-by-step and reflected in the parity docs after each major change.
- Most recent commits:
- `fc6dea8` arm64: expand userspace build list for ext2
- `f5f19fe` arm64: add ext2 disk support for userspace
- `a3b7eae` arm64: init tty at boot and update plan
- `13486d9` arm64: enable devptsfs and refresh parity docs
- `bea6750` arm64: execv/wait4, tcp sockets, ext2 init_shell

## Planning Docs (authoritative)
- `docs/planning/ARM64_FEATURE_PARITY_PLAN.md` (main plan + phased checklist)
- `docs/planning/ARM64_SYSCALL_MATRIX.md` (current syscall parity snapshot)
- `docs/planning/ARM64_SYSCALL_PORTING_CHECKLIST.md` (porting checklist)
- `docs/planning/ARM64_USERPTR_AUDIT.md` (user pointer validation audit)
- `docs/planning/ARM64_MEMORY_LAYOUT_DIFF.md` (ARM64 VA layout notes)

These are kept up to date as parity work progresses.

## What Was Just Completed
- ARM64 execv now supports argv and ext2-backed exec, with test-disk fallback.
- wait4/waitpid wired for ARM64.
- TCP sockets enabled on ARM64 (no longer EAFNOSUPPORT gate).
- devptsfs enabled on ARM64 at boot; TTY subsystem initialized at boot.
- ext2 disk builder now supports ARM64 (`scripts/create_ext2_disk.sh --arch aarch64`).
- ARM64 QEMU script prefers ext2 image if present.
- ARM64 userspace build list expanded to include coreutils + telnetd (best-effort).

## Current Gaps (Still Blocking Full Parity)
- ARM64 userspace binaries installed on ext2 image (coreutils coverage still TBD).
- PTY/TTY behavior unverified under ARM64 userspace load.
- Scheduler/preemption validation under userspace load.
- Memory map + allocator parity (ARM64 still uses bump allocator).
- ARM64 test harness / boot stage parity subset not established.

## How To Continue (Next Concrete Steps)
1) Build ARM64 userspace binaries (best-effort list):
- `cd userspace/tests && ./build-aarch64.sh`
2) Create ARM64 ext2 image with those binaries:
- `./scripts/create_ext2_disk.sh --arch aarch64`
3) Boot ARM64 with ext2 image preferred:
- `./scripts/run-arm64-graphics.sh release`

(Testing not run in this handoff; these are only provided as next steps.)
- **Status: Feature parity achieved** - All core functionality working

## Notes / Constraints
- Do not modify Tier 1/Tier 2 prohibited files without explicit approval.
- Avoid adding logging to interrupt/syscall hot paths.
- Keep parity docs updated after each milestone (plan + syscall matrix).
## Recent Commits (newest first)
- `382c34d` arm64: fix VirtIO network header size for legacy mode
- `144b251` arm64: add network stack initialization and infrastructure
- `22824e4` arm64: enable full PTY/TTY support for userspace
- `27582a7` arm64: fix signal syscalls by adding spawn_as_current
- `266be31` arm64: wire scheduler to IRQ and syscall return paths
- `c10ced1` arm64: fix setup_mmu link register preservation
- `c81dea1` arm64: unify kernel heap allocator and fix userspace entry

## Completed Tasks

### Task 1-3: Userspace Build & Boot
- ARM64 userspace binaries build successfully (init_shell, coreutils, telnetd)
- ARM64 ext2 disk image creation works
- init_shell launches from ext2 and executes userspace code

### Task 4: Kernel Heap
- ARM64 uses unified kernel heap allocator (not bump allocator)
- Full dynamic memory allocation available

### Task 5: Scheduler & Preemption
- Timer interrupts fire correctly at 100Hz
- Preemptive scheduling works under userspace load
- Context switches between kernel and user threads work

### Task 6: Signals
- Signal delivery works (SIGTERM, SIGCHLD, etc.)
- sigreturn restores user context correctly
- spawn_as_current fix enables proper thread registration

### Task 7: PTY/TTY
- devptsfs mounted at /dev/pts
- TTY subsystem initialized at boot
- PTY allocation and I/O functional

### Task 8: Network Stack
- **VirtIO network driver fixed** - header size corrected from 12 to 10 bytes for legacy mode
- ARP resolution works: `52:55:0a:00:02:02` (gateway MAC)
- ICMP ping to gateway succeeds
- UDP/TCP infrastructure ready

### Task 10: Graphics / VirtIO GPU
- VirtIO GPU MMIO driver works on ARM64
- Headed QEMU mode available via `BREENIX_GRAPHICS=1` or `run-arm64-graphics.sh`
- Split-screen UI (graphics demo + terminal) renders correctly
- VirtIO keyboard provides input in graphics mode

## Key Fix: VirtIO Network Header

The VirtIO network driver was sending malformed packets because the header
included a `num_buffers` field (2 bytes) that is only valid when the
MRG_RXBUF feature is negotiated. For legacy VirtIO (v1) without this feature:

**Before (broken):** 12-byte header → packets shifted by 2 bytes → SLIRP drops
**After (fixed):** 10-byte header → packets correctly formed → ARP/ICMP work

## Build Status
- ARM64 kernel: **Warning-free**
- ARM64 userspace: **Builds successfully**
- x86_64 kernel: Unaffected by ARM64 changes

## Planning Docs
- `docs/planning/ARM64_FEATURE_PARITY_PLAN.md` - Main plan
- `docs/planning/ARM64_SYSCALL_MATRIX.md` - Syscall parity
- `docs/planning/ARM64_SYSCALL_PORTING_CHECKLIST.md` - Porting checklist

## Remaining Work

### Task 9: CI/Test Parity (In Progress)
1. ✅ ARM64 builds are warning-free
2. Define ARM64 test subset (what tests should pass)
3. Add ARM64 QEMU smoke runs to test infrastructure
4. Create boot stages equivalent for ARM64
5. Document ARM64-specific test exceptions

## How to Test ARM64

```bash
# Build kernel
cargo build --release --target aarch64-breenix.json -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem -p kernel --bin kernel-aarch64

# Build userspace (if needed)
cd userspace/tests && ./build-aarch64.sh

# Create ext2 image (if needed)
./scripts/create_ext2_disk.sh --arch aarch64

# Run QEMU (headless - serial only)
./scripts/run-arm64-qemu.sh

# Run QEMU with graphics (headed QEMU window + VirtIO GPU)
BREENIX_GRAPHICS=1 ./scripts/run-arm64-qemu.sh

# Alternative: use dedicated graphics script
./scripts/run-arm64-graphics.sh
```

### Graphics Mode
The ARM64 port supports headed QEMU with VirtIO GPU for a full graphical experience:
- Native QEMU window (Cocoa on macOS, SDL on Linux)
- VirtIO GPU framebuffer with split-screen UI (graphics demo + terminal)
- VirtIO keyboard for input
- Serial output to terminal (Ctrl-A X to exit)

## Notes / Constraints
- Do not modify Tier 1/Tier 2 prohibited files without explicit approval
- Avoid adding logging to interrupt/syscall hot paths
- Keep parity docs updated after each milestone
Loading
Loading