Files
zosbuilder/scripts/build-initramfs.sh
Jan De Landtsheer 7eb27ff376 Fix critical build pipeline and update documentation
CRITICAL FIXES:
- Fix build-initramfs.sh early exit preventing zinit installation
- Add binary detection/installation logic to setup-initramfs.sh
- Ensure compiled components are properly installed to initramfs

DOCUMENTATION:
- Update README.md to reflect actual implementation
- Document source compilation approach with git submodules
- Add development workflow and caching documentation
- Remove outdated GitHub releases references

This fixes the 'zinit not found' boot error by ensuring the build
pipeline completes all phases including initramfs assembly.
2025-08-16 21:04:07 +02:00

73 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
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
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!"