feat: Create minimal Zero-OS initramfs with console support
- Fixed build system to clone source repositories instead of downloading binaries - Enhanced scripts/fetch-github.sh with proper git repo cloning and branch handling - Updated scripts/compile-components.sh for RFS compilation with build-binary feature - Added minimal firmware installation for essential network drivers (73 modules) - Created comprehensive zinit configuration set (15 config files including getty) - Added util-linux package for getty/agetty console support - Optimized package selection for minimal 27MB initramfs footprint - Successfully builds bootable vmlinuz.efi with embedded initramfs - Confirmed working: VM boot, console login, network drivers, zinit init system Components: - initramfs.cpio.xz: 27MB compressed minimal Zero-OS image - vmlinuz.efi: 35MB bootable kernel with embedded initramfs - Complete Zero-OS toolchain: zinit, rfs, mycelium compiled from source
This commit is contained in:
45
README.md
45
README.md
@@ -6,8 +6,8 @@ Modern Alpine Linux based approach to building Zero-OS initramfs with source com
|
||||
|
||||
This system uses:
|
||||
- **Alpine Linux 3.22** as base system with latest packages
|
||||
- **Rust workspace** with git subtrees for Zero-OS Rust components (zinit, mycelium, rfs)
|
||||
- **Unified compilation** via `cargo build --workspace` for all Rust components
|
||||
- **Individual Rust workspaces** with git subtrees for Zero-OS components (zinit, mycelium, rfs)
|
||||
- **Component-based compilation** - each component built in its own workspace
|
||||
- **Alpine packages** for system tools (busybox, openssh, btrfs-progs, etc.)
|
||||
- **Smart caching** with Docker layers and volumes
|
||||
- **Same init flow** as original Zero-OS
|
||||
@@ -16,15 +16,14 @@ This system uses:
|
||||
|
||||
```
|
||||
alpine-initramfs/
|
||||
├── Cargo.toml # Rust workspace configuration
|
||||
├── build/ # Build orchestration
|
||||
│ ├── Dockerfile.alpine # Alpine build environment
|
||||
│ ├── Dockerfile.cached # Multi-stage cached build
|
||||
│ └── docker-compose.yml # Build orchestration with caching
|
||||
├── components/ # Git subtrees (Rust workspace members)
|
||||
│ ├── zinit/ # Init system (Rust subtree)
|
||||
│ ├── mycelium/ # Networking layer (Rust subtree)
|
||||
│ └── rfs/ # Filesystem (Rust subtree)
|
||||
├── components/ # Git subtrees (individual workspaces)
|
||||
│ ├── zinit/ # Init system (Rust subtree with workspace)
|
||||
│ ├── mycelium/ # Networking layer (Rust subtree with workspace)
|
||||
│ └── rfs/ # Filesystem (Rust subtree with workspace)
|
||||
├── configs/ # Configuration files
|
||||
│ ├── packages-alpine.txt # Alpine packages to install
|
||||
│ ├── kernel-version # Kernel version to build
|
||||
@@ -54,7 +53,7 @@ alpine-initramfs/
|
||||
## Build Flow
|
||||
|
||||
1. **Environment Setup**: Alpine Docker container with Rust and build tools
|
||||
2. **Workspace Compilation**: Single `cargo build --workspace` for all Rust components
|
||||
2. **Component Compilation**: Individual cargo builds for each Rust component
|
||||
3. **Binary Downloads**: Download CoreX (Go binary) from GitHub releases
|
||||
4. **Package Installation**: Install Alpine packages to initramfs root
|
||||
5. **Initramfs Assembly**: Create filesystem structure with compiled binaries
|
||||
@@ -79,13 +78,13 @@ cd build/
|
||||
# Interactive development shell
|
||||
docker-compose run dev-shell
|
||||
|
||||
# Build entire workspace
|
||||
cargo build --workspace --release --target x86_64-unknown-linux-musl
|
||||
# Build all components (automated)
|
||||
../scripts/compile-components.sh
|
||||
|
||||
# Build specific component
|
||||
cargo build -p zinit --release --target x86_64-unknown-linux-musl
|
||||
cargo build -p mycelium --release --target x86_64-unknown-linux-musl
|
||||
cargo build -p rfs --release --target x86_64-unknown-linux-musl
|
||||
# Build individual components manually:
|
||||
cd ../components/zinit && cargo build --release --target x86_64-unknown-linux-musl
|
||||
cd ../components/mycelium && cargo build --release --target x86_64-unknown-linux-musl
|
||||
cd ../components/rfs && cargo build --release --target x86_64-unknown-linux-musl
|
||||
```
|
||||
|
||||
### Smart Build (with caching)
|
||||
@@ -96,10 +95,10 @@ docker-compose run builder # Uses build-smart.sh automatically
|
||||
|
||||
## Key Features
|
||||
|
||||
- ✅ **Rust workspace** - Unified build system for all Rust components
|
||||
- ✅ **Component workspaces** - Each component maintains its own workspace
|
||||
- ✅ **Git subtrees** - Source code included, no submodule complexity
|
||||
- ✅ **Single build command** - `cargo build --workspace` builds everything
|
||||
- ✅ **Shared dependencies** - Consistent versions across all components
|
||||
- ✅ **Automated build** - `scripts/compile-components.sh` builds all components
|
||||
- ✅ **Shared target directory** - Efficient build artifact sharing
|
||||
- ✅ **Smart caching** - Docker layer and volume caching for fast rebuilds
|
||||
- ✅ **Alpine packages** - System tools from Alpine repositories
|
||||
- ✅ **Development mode** - Full IDE support and integrated tooling
|
||||
@@ -112,13 +111,13 @@ docker-compose run builder # Uses build-smart.sh automatically
|
||||
cd build/
|
||||
docker-compose run dev-shell
|
||||
|
||||
# Inside container - workspace build:
|
||||
cargo build --workspace --release --target x86_64-unknown-linux-musl
|
||||
# Inside container - build all components:
|
||||
../scripts/compile-components.sh
|
||||
|
||||
# Or build specific packages:
|
||||
cargo build -p zinit --release --target x86_64-unknown-linux-musl
|
||||
cargo build -p mycelium --release --target x86_64-unknown-linux-musl
|
||||
cargo build -p rfs --release --target x86_64-unknown-linux-musl
|
||||
# Or build specific components manually:
|
||||
cd ../components/zinit && cargo build --release --target x86_64-unknown-linux-musl
|
||||
cd ../components/mycelium/myceliumd && cargo build --release --target x86_64-unknown-linux-musl
|
||||
cd ../components/rfs && cargo build --release --target x86_64-unknown-linux-musl
|
||||
```
|
||||
|
||||
### Cleanup
|
||||
|
||||
Reference in New Issue
Block a user