Initial commit: Alpine Zero-OS initramfs build system with cleaned Docker configuration

This commit is contained in:
2025-08-15 22:11:44 +02:00
commit 9b14d94bbe
34 changed files with 12864 additions and 0 deletions

74
scripts/build-initramfs.sh Executable file
View File

@@ -0,0 +1,74 @@
#!/bin/sh
set -e
echo "====================================="
echo "= Alpine Zero-OS Initramfs Build ="
echo "====================================="
echo ""
# DIAGNOSTIC: Check critical dependencies before starting
echo "[DEBUG] Checking critical dependencies..."
echo "[DEBUG] Current directory: $(pwd)"
echo "[DEBUG] Available disk space: $(df -h /build | tail -1)"
echo "[DEBUG] Available memory: $(free -h)"
echo "[DEBUG] Network connectivity: $(ping -c 1 8.8.8.8 >/dev/null 2>&1 && echo 'OK' || echo 'FAILED')"
echo "[DEBUG] GitHub API access: $(curl -s https://api.github.com/repos/threefoldtech/zinit/releases/latest >/dev/null 2>&1 && echo 'OK' || echo 'FAILED')"
echo "[DEBUG] Zinit config mount check: $(ls -la /mnt/zinit 2>/dev/null | wc -l) files"
echo "[DEBUG] APK repositories: $(apk update >/dev/null 2>&1 && echo 'OK' || echo 'FAILED')"
echo ""
# Source configuration
if [ -f /build/build.conf ]; then
. /build/build.conf
else
echo "Error: build.conf not found"
exit 1
fi
echo "[+] Build mode: $BUILDMODE"
echo "[+] Target arch: $TARGETARCH"
echo "[+] Output directory: $OUTPUT_DIR"
echo ""
# Ensure output directory exists
mkdir -p "$OUTPUT_DIR"
# Phase 1: Install Alpine packages to initramfs
echo "[+] Installing Alpine packages..."
/build/scripts/install-packages.sh
# Phase 2: Compile Zero-OS components from source (replaces problematic fetch-github)
echo "[+] Compiling Zero-OS components..."
if [ -f /build/scripts/build-smart.sh ]; then
# Use smart build if available (with caching)
/build/scripts/build-smart.sh
exit $?
else
# Fallback to direct component compilation
/build/scripts/compile-components.sh
fi
# Phase 3: Setup initramfs structure
echo "[+] Setting up initramfs structure..."
/build/scripts/setup-initramfs.sh
# Phase 4: Build kernel with embedded initramfs
echo "[+] Building kernel..."
/build/scripts/build-kernel.sh
echo ""
echo "[+] Build completed successfully!"
echo "[+] Output files:"
ls -la "$OUTPUT_DIR/"
# Verify output
if [ -f "$OUTPUT_DIR/vmlinuz.efi" ]; then
size=$(stat -c%s "$OUTPUT_DIR/vmlinuz.efi")
echo "[+] Kernel size: $size bytes"
else
echo "[-] Error: vmlinuz.efi not found!"
exit 1
fi
echo ""
echo "[+] Alpine Zero-OS initramfs build complete!"