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:
@@ -129,6 +129,39 @@ if [ "$BINARIES_FOUND" = "false" ]; then
|
||||
echo "[DEBUG] Make sure to run compile-components.sh before setup-initramfs.sh"
|
||||
fi
|
||||
|
||||
# Install kernel modules for network interfaces
|
||||
echo " Installing essential network kernel modules..."
|
||||
KERNEL_VERSION=$(cat /build/configs/kernel-version)
|
||||
MODULES_DIR="$INITRAMFS_ROOT/lib/modules/${KERNEL_VERSION}-Zero-OS"
|
||||
mkdir -p "$MODULES_DIR/kernel/drivers/net/ethernet"
|
||||
mkdir -p "$MODULES_DIR/kernel/drivers/net"
|
||||
mkdir -p "$MODULES_DIR/kernel/drivers"
|
||||
|
||||
KERNEL_BUILD_DIR="/build/kernel/linux-${KERNEL_VERSION}"
|
||||
if [ -d "$KERNEL_BUILD_DIR" ]; then
|
||||
echo " Copying essential ethernet drivers from kernel build..."
|
||||
|
||||
# Copy essential network driver modules using a more reliable method
|
||||
find "$KERNEL_BUILD_DIR" -name "*.ko" | grep -E "(e1000|r8169|bnx2|tg3|virtio|igb|ixgbe|i40e|ice|atl1|alx|8139|b44|mii|mdio|libphy)" | while read ko; do
|
||||
if [ -f "$ko" ]; then
|
||||
cp "$ko" "$MODULES_DIR/kernel/drivers/net/ethernet/" 2>/dev/null || \
|
||||
cp "$ko" "$MODULES_DIR/kernel/drivers/net/" 2>/dev/null || \
|
||||
cp "$ko" "$MODULES_DIR/kernel/drivers/" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
# Count actual installed modules
|
||||
actual_modules=$(find "$MODULES_DIR" -name "*.ko" 2>/dev/null | wc -l)
|
||||
echo " Installed $actual_modules network driver modules"
|
||||
|
||||
# Create basic module dependency files
|
||||
touch "$MODULES_DIR/modules.dep"
|
||||
touch "$MODULES_DIR/modules.alias"
|
||||
touch "$MODULES_DIR/modules.symbols"
|
||||
else
|
||||
echo " Warning: Kernel build directory not found at $KERNEL_BUILD_DIR"
|
||||
fi
|
||||
|
||||
# Copy other system configurations
|
||||
echo " Setting up system configuration..."
|
||||
|
||||
@@ -162,6 +195,11 @@ export HOME=/root
|
||||
export TERM=linux
|
||||
EOF
|
||||
|
||||
# Set up environment file for PATH
|
||||
cat > "$INITRAMFS_ROOT/etc/environment" << EOF
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
EOF
|
||||
|
||||
# Ensure SSH directory exists
|
||||
mkdir -p "$INITRAMFS_ROOT/etc/ssh"
|
||||
mkdir -p "$INITRAMFS_ROOT/root/.ssh"
|
||||
|
||||
Reference in New Issue
Block a user