fix: major build system improvements and container output issues
- Fix container output visibility with proper TTY handling and debug mode - Fix build order: kernel modules built before initramfs creation - Implement two-stage kernel build to resolve chicken-and-egg dependency - Fix sed command issues in kernel configuration with direct execution - Add diffutils package to container for proper kernel build support - Enhance NIC module/firmware correlation with intelligent selection - Fix module staging logic: all NICs loaded in stage1 before network up - Add smart firmware installation based on module requirements - Create comprehensive function documentation (scripts/functionlist.md) - Add debug container script for troubleshooting Major fixes: * Container builds now show real-time output * Kernel builds work with proper GNU diff support * Module/firmware selection optimized for common hardware * Build process handles dependencies correctly * Documentation provides complete function reference
This commit is contained in:
104
config/init
Executable file
104
config/init
Executable file
@@ -0,0 +1,104 @@
|
||||
#!/bin/sh
|
||||
# Alpine-based Zero-OS Init Script
|
||||
# Maintains identical flow to original busybox version
|
||||
|
||||
echo ""
|
||||
echo "============================================"
|
||||
echo "== ZERO-OS ALPINE INITRAMFS =="
|
||||
echo "============================================"
|
||||
|
||||
echo "[+] creating ram filesystem"
|
||||
mount -t proc proc /proc
|
||||
mount -t sysfs sysfs /sys
|
||||
mount -t tmpfs tmpfs /mnt/root -o size=1536M
|
||||
mount -t devtmpfs devtmpfs /dev
|
||||
|
||||
echo "[+] building ram filesystem"
|
||||
target="/mnt/root"
|
||||
|
||||
# Copy Alpine filesystem to tmpfs (same as original)
|
||||
echo " copying /bin..."
|
||||
cp -ar /bin $target
|
||||
echo " copying /etc..."
|
||||
cp -ar /etc $target
|
||||
echo " copying /lib..."
|
||||
cp -ar /lib* $target
|
||||
echo " copying /usr..."
|
||||
cp -ar /usr $target
|
||||
echo " copying /root..."
|
||||
cp -ar /root $target
|
||||
echo " copying /sbin..."
|
||||
cp -ar /sbin $target
|
||||
echo " copying /tmp..."
|
||||
cp -ar /tmp $target
|
||||
echo " copying /var..."
|
||||
cp -ar /var $target
|
||||
echo " copying /run..."
|
||||
cp -ar /run $target
|
||||
|
||||
# Create essential directories
|
||||
mkdir -p $target/dev
|
||||
mkdir -p $target/sys
|
||||
mkdir -p $target/proc
|
||||
mkdir -p $target/mnt
|
||||
|
||||
# Mount filesystems in tmpfs
|
||||
mount -t proc proc $target/proc
|
||||
mount -t sysfs sysfs $target/sys
|
||||
mount -t devtmpfs devtmpfs $target/dev
|
||||
|
||||
# Mount devpts for terminals
|
||||
mkdir -p $target/dev/pts
|
||||
mount -t devpts devpts $target/dev/pts
|
||||
|
||||
echo "[+] setting environment"
|
||||
export PATH
|
||||
|
||||
echo "[+] probing drivers"
|
||||
# Use Alpine's udev instead of busybox udevadm
|
||||
if [ -x /sbin/udevd ]; then
|
||||
echo " starting udevd..."
|
||||
udevd --daemon
|
||||
|
||||
echo " triggering device discovery..."
|
||||
udevadm trigger --action=add --type=subsystems
|
||||
udevadm trigger --action=add --type=devices
|
||||
udevadm settle
|
||||
|
||||
echo " stopping udevd..."
|
||||
kill $(pidof udevd) || true
|
||||
else
|
||||
echo " warning: udevd not found, skipping hardware detection"
|
||||
fi
|
||||
|
||||
echo "[+] loading essential drivers"
|
||||
# Load core drivers for storage and network
|
||||
modprobe btrfs 2>/dev/null || true
|
||||
modprobe fuse 2>/dev/null || true
|
||||
modprobe overlay 2>/dev/null || true
|
||||
|
||||
# Load storage drivers
|
||||
modprobe ahci 2>/dev/null || true
|
||||
modprobe nvme 2>/dev/null || true
|
||||
modprobe virtio_blk 2>/dev/null || true
|
||||
modprobe virtio_scsi 2>/dev/null || true
|
||||
modprobe virtio_pci 2>/dev/null || true
|
||||
|
||||
# Load network drivers
|
||||
modprobe virtio_net 2>/dev/null || true
|
||||
modprobe e1000 2>/dev/null || true
|
||||
modprobe e1000e 2>/dev/null || true
|
||||
|
||||
# Unmount init filesystems
|
||||
umount /proc 2>/dev/null || true
|
||||
umount /sys 2>/dev/null || true
|
||||
|
||||
echo "[+] checking for debug files"
|
||||
if [ -e /init-debug ]; then
|
||||
echo " executing debug script..."
|
||||
sh /init-debug
|
||||
fi
|
||||
|
||||
echo "[+] switching root"
|
||||
echo " exec switch_root /mnt/root /sbin/zinit init"
|
||||
exec switch_root /mnt/root /sbin/zinit init
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,52 +1,34 @@
|
||||
# 2-stage module loading specification for Zero-OS Alpine initramfs
|
||||
# Based on existing configs/modules-essential.list
|
||||
# Format: STAGE:MODULE_NAME:FIRMWARE_FILES (optional)
|
||||
# Module loading specification for Zero-OS Alpine initramfs
|
||||
# Format: STAGE:MODULE_NAME:FIRMWARE_PACKAGE (optional)
|
||||
# Focus on most common NIC modules to ensure networking works on most hardware
|
||||
|
||||
# Stage 1: Critical boot modules (loaded early for basic functionality)
|
||||
stage1:virtio_net
|
||||
stage1:virtio_scsi
|
||||
stage1:virtio_blk
|
||||
stage1:virtio_pci
|
||||
stage1:e1000
|
||||
stage1:e1000e
|
||||
stage1:scsi_mod
|
||||
stage1:sd_mod
|
||||
stage1:ahci
|
||||
stage1:nvme
|
||||
# Stage 1: ALL networking and essential boot modules
|
||||
# All NICs must be loaded BEFORE network can come up
|
||||
stage1:virtio_net:none # Virtio network (VMs, cloud)
|
||||
stage1:virtio_scsi:none # Virtio SCSI (VMs, cloud)
|
||||
stage1:virtio_blk:none # Virtio block (VMs, cloud)
|
||||
stage1:virtio_pci:none # Virtio PCI bus
|
||||
stage1:e1000:linux-firmware-intel # Intel E1000 (very common)
|
||||
stage1:e1000e:linux-firmware-intel # Intel E1000E (very common)
|
||||
stage1:r8169:linux-firmware-realtek # Realtek (most common desktop/server)
|
||||
stage1:igb:linux-firmware-intel # Intel Gigabit (servers)
|
||||
stage1:ixgbe:linux-firmware-intel # Intel 10GbE (servers)
|
||||
stage1:i40e:linux-firmware-intel # Intel 40GbE (modern servers)
|
||||
stage1:ice:linux-firmware-intel # Intel E800 series (latest)
|
||||
stage1:8139too:none # Realtek 8139 (legacy)
|
||||
stage1:8139cp:none # Realtek 8139C+ (legacy)
|
||||
stage1:bnx2:linux-firmware-bnx2 # Broadcom NetXtreme
|
||||
stage1:bnx2x:linux-firmware-bnx2 # Broadcom NetXtreme II
|
||||
stage1:tg3:none # Broadcom Tigon3
|
||||
stage1:b44:none # Broadcom 44xx
|
||||
stage1:atl1:none # Atheros L1
|
||||
stage1:atl1e:none # Atheros L1E
|
||||
stage1:atl1c:none # Atheros L1C
|
||||
stage1:alx:none # Atheros Alx
|
||||
stage1:scsi_mod:none # SCSI subsystem
|
||||
stage1:sd_mod:none # SCSI disk support
|
||||
stage1:ahci:none # SATA AHCI
|
||||
stage1:nvme:none # NVMe storage
|
||||
stage1:tun:none # TUN/TAP for networking
|
||||
stage1:overlay:none # OverlayFS for containers
|
||||
|
||||
# Stage 2: Extended hardware support (loaded after initial boot)
|
||||
stage2:igb
|
||||
stage2:ixgbe
|
||||
stage2:i40e
|
||||
stage2:ice
|
||||
stage2:r8169
|
||||
stage2:8139too
|
||||
stage2:8139cp
|
||||
stage2:bnx2
|
||||
stage2:bnx2x
|
||||
stage2:tg3
|
||||
stage2:b44
|
||||
stage2:atl1
|
||||
stage2:atl1e
|
||||
stage2:atl1c
|
||||
stage2:alx
|
||||
|
||||
# Tunnel and container support
|
||||
stage2:tun
|
||||
stage2:overlay
|
||||
|
||||
# Control Groups (cgroups) - essential for container management
|
||||
stage2:cgroup_pids
|
||||
stage2:cgroup_freezer
|
||||
stage2:cgroup_perf_event
|
||||
stage2:cgroup_device
|
||||
stage2:cgroup_cpuset
|
||||
stage2:cgroup_bpf
|
||||
stage2:memcg
|
||||
stage2:blkio_cgroup
|
||||
stage2:cpu_cgroup
|
||||
stage2:cpuacct
|
||||
stage2:hugetlb_cgroup
|
||||
stage2:net_cls_cgroup
|
||||
stage2:net_prio_cgroup
|
||||
stage2:devices_cgroup
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
# Core system (essential only)
|
||||
alpine-baselayout
|
||||
alpine-baselayout-data
|
||||
busybox
|
||||
musl
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Git repositories to clone and build
|
||||
git zinit https://github.com/threefoldtech/zinit master build_zinit
|
||||
git mycelium https://github.com/threefoldtech/mycelium v0.6.1 build_mycelium
|
||||
git rfs https://github.com/threefoldtech/rfs development build_rfs
|
||||
|
||||
# Pre-built releases to download
|
||||
release rfs https://github.com/threefoldtech/rfs/releases/download/v2.0.6/rfs v2.0.6 install_rfs
|
||||
release corex https://github.com/threefoldtech/corex/releases/download/2.1.4/corex-2.1.4-amd64-linux-static 2.1.4 install_corex rename=corex
|
||||
@@ -1,2 +1,2 @@
|
||||
exec: /sbin/getty -L 9600 console
|
||||
restart: always
|
||||
exec: sh /etc/zinit/init/cgroup.sh
|
||||
oneshot: true
|
||||
Reference in New Issue
Block a user