Building axeberg
Instructions for building and running axeberg.
Prerequisites
- Rust: Latest stable (1.80+)
- wasm-pack: For building WASM
- Modern browser: Chrome, Firefox, Safari, or Edge
Installing Rust
Installing wasm-pack
Project Structure
axebergos/
├── src/
│ ├── lib.rs # Library entry point
│ ├── boot.rs # Boot sequence
│ ├── kernel/ # Kernel components
│ │ ├── mod.rs
│ │ ├── syscall.rs # Syscall interface (300+)
│ │ ├── process.rs # Process management
│ │ ├── memory.rs # Memory (COW, mmap)
│ │ ├── executor.rs # Single-threaded scheduler
│ │ ├── work_stealing/ # Parallel scheduler
│ │ ├── signal.rs # POSIX-like signals
│ │ ├── users.rs # Users, groups, capabilities
│ │ ├── wasm/ # WASM loader + WASI
│ │ ├── pkg/ # Package manager
│ │ ├── ipc.rs # Channels, pipes
│ │ ├── uds.rs # Unix domain sockets
│ │ ├── flock.rs # File locking
│ │ ├── msgqueue.rs # Message queues
│ │ ├── semaphore.rs # Semaphores
│ │ └── ...
│ ├── shell/ # Command interpreter
│ │ ├── parser.rs # Shell parsing
│ │ ├── executor.rs # Pipeline execution
│ │ ├── builtins.rs # Built-in commands
│ │ └── programs/ # Shell commands (80+)
│ ├── vfs/ # Virtual filesystem
│ │ ├── mod.rs
│ │ ├── memory.rs # In-memory FS
│ │ ├── layered.rs # Union filesystem
│ │ └── persist.rs # OPFS persistence
│ ├── compositor/ # WebGPU compositor
│ └── bin/
│ └── serve.rs # Dev server
├── index.html # Browser entry point
├── docs/ # Documentation
├── man/ # Man pages (scdoc)
├── tests/ # Integration tests
├── Cargo.toml
└── README.md
Building for Web
Debug Build
Output in pkg/:
- axeberg.js - JavaScript glue
- axeberg_bg.wasm - WebAssembly binary
- axeberg.d.ts - TypeScript definitions
Release Build
Smaller, faster WASM binary.
Running the Dev Server
axeberg includes a built-in dev server:
Then open: http://localhost:8080
The server:
- Serves static files from project root
- Serves WASM from pkg/
- Supports hot reload (rebuild and refresh)
Development Workflow
- Make changes to Rust code
- Rebuild WASM:
wasm-pack build --target web - Refresh browser
Or use watch mode:
# Terminal 1: Watch and rebuild
cargo watch -s "wasm-pack build --target web"
# Terminal 2: Serve
cargo run --bin serve
Running Tests
Unit Tests
Running Specific Tests
# Run tests matching a pattern
cargo test syscall
# Run a specific test
cargo test test_mem_alloc_free
# Show output
cargo test -- --nocapture
Test Coverage
Note: cargo-watch and cargo-tarpaulin are optional development tools that can enhance the development workflow but are not required for building or testing the project.
Code Quality
Formatting
Linting
Documentation
Troubleshooting
WASM build fails
Ensure wasm-pack is installed:
"Can't find wasm file"
Make sure you ran wasm-pack build:
Canvas not found
Check that index.html has the canvas element:
Console errors
Open browser DevTools (F12) to see JavaScript errors.
Configuration
Cargo.toml
Key settings:
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = [...] }
js-sys = "0.3"
futures = "0.3"
wasm-bindgen-futures = "0.4"
web-sys Features
Required features for browser APIs:
[dependencies.web-sys]
version = "0.3"
features = [
"Window",
"Document",
"HtmlCanvasElement",
"CanvasRenderingContext2d",
"MouseEvent",
"KeyboardEvent",
# ...
]
Next Steps
- Testing - Test suite details
- Contributing - Development guidelines