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:
2025-08-16 23:25:59 +02:00
parent 446eb02fb3
commit bf62e887e8
109 changed files with 7645 additions and 1945 deletions

View File

@@ -179,13 +179,52 @@ install_github_binary() {
fi
}
# Function to clone source repository for compilation
clone_source_repo() {
local repo="$1"
local target_dir="$2"
echo " Cloning source: $repo -> $target_dir"
# Check if directory already exists and is a git repo
if [ -d "$target_dir/.git" ]; then
echo " Repository already exists, updating..."
cd "$target_dir"
git fetch origin
git reset --hard HEAD
cd - >/dev/null
else
# Remove any existing non-git directory
if [ -d "$target_dir" ]; then
echo " Removing existing non-git directory..."
rm -rf "$target_dir"
fi
# Clone repository (use default branch)
echo " Cloning https://github.com/$repo.git..."
git clone "https://github.com/$repo.git" "$target_dir"
fi
echo " ✓ Source repository cloned: $target_dir"
}
# Install each component
echo ""
# Zinit - Init system
install_github_binary "threefoldtech/zinit" "zinit" "/sbin" "linux-x86_64"
# Clone source repositories for compilation
COMPONENTS_DIR="/build/components"
mkdir -p "$COMPONENTS_DIR"
# Core-X - Container control (skip if repo doesn't exist)
# Zinit - Clone source for compilation
clone_source_repo "threefoldtech/zinit" "$COMPONENTS_DIR/zinit"
# Mycelium - Clone source for compilation
clone_source_repo "threefoldtech/mycelium" "$COMPONENTS_DIR/mycelium"
# RFS - Clone source for compilation
clone_source_repo "threefoldtech/rfs" "$COMPONENTS_DIR/rfs"
# Core-X - Container control (still download binary as it's not in compile-components.sh)
echo " Checking: threefoldtech/core-x"
if install_github_binary "threefoldtech/core-x" "core-x" "/usr/bin" "linux.*amd64"; then
echo " Core-X installed successfully"
@@ -193,23 +232,34 @@ else
echo " Warning: Core-X repository not found or no releases available - continuing without it"
fi
# Seektime - Disk detection
# Seektime - Disk detection (still download binary as it's not in compile-components.sh)
install_github_binary "threefoldtech/seektime" "seektime" "/usr/bin" "linux-amd64"
# RFS - Rust filesystem (direct binary, no architecture in name)
install_github_binary "threefoldtech/rfs" "rfs" "/usr/bin" "rfs"
echo ""
echo "[+] GitHub components installed successfully"
echo "[+] GitHub components setup completed"
# Show cloned source repositories
echo ""
echo "[+] Cloned source repositories:"
for repo in "zinit" "mycelium" "rfs"; do
if [ -d "$COMPONENTS_DIR/$repo/.git" ]; then
echo " $repo (source cloned for compilation)"
else
echo " $repo (MISSING)"
fi
done
# Show installed binaries info
echo ""
echo "[+] Installed components:"
for binary in "/sbin/zinit" "/usr/bin/core-x" "/usr/bin/seektime" "/usr/bin/rfs"; do
echo "[+] Downloaded binary components:"
for binary in "/usr/bin/core-x" "/usr/bin/seektime"; do
if [ -x "$INITRAMFS_ROOT$binary" ]; then
size=$(stat -c%s "$INITRAMFS_ROOT$binary" 2>/dev/null || echo "unknown")
echo " $binary (${size} bytes)"
else
echo " $binary (MISSING)"
fi
done
done
echo ""
echo "[+] Note: zinit, mycelium, and rfs will be compiled from source using compile-components.sh"