Complete Phase 1 implementation of KubeSolo OS — an immutable, bootable Linux distribution built on Tiny Core Linux for running KubeSolo single-node Kubernetes. Build system: - Makefile with fetch, rootfs, initramfs, iso, disk-image targets - Dockerfile.builder for reproducible builds - Scripts to download Tiny Core, extract rootfs, inject KubeSolo, pack initramfs, and create bootable ISO/disk images Init system (10 POSIX sh stages): - Early mount (proc/sys/dev/cgroup2), cmdline parsing, persistent mount with bind-mounts, kernel module loading, sysctl, DHCP networking, hostname, clock sync, containerd prep, KubeSolo exec Shared libraries: - functions.sh (device wait, IP lookup, config helpers) - network.sh (static IP, config persistence, interface detection) - health.sh (containerd, API server, node readiness checks) - Emergency shell for boot failure debugging Testing: - QEMU boot test with serial log marker detection - K8s readiness test with kubectl verification - Persistence test (reboot + verify state survives) - Workload deployment test (nginx pod) - Local storage test (PVC + local-path provisioner) - Network policy test - Reusable run-vm.sh launcher Developer tools: - dev-vm.sh (interactive QEMU with port forwarding) - rebuild-initramfs.sh (fast iteration) - inject-ssh.sh (dropbear SSH for debugging) - extract-kernel-config.sh + kernel-audit.sh Documentation: - Full design document with architecture research - Boot flow documentation covering all 10 init stages - Cloud-init examples (DHCP, static IP, Portainer Edge, air-gapped) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# extract-kernel-config.sh — Pull kernel config from Tiny Core rootfs
|
|
# Usage: ./hack/extract-kernel-config.sh [path-to-core.gz]
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
ROOTFS_DIR="${ROOTFS_DIR:-$PROJECT_ROOT/build/rootfs-work}"
|
|
|
|
COREGZ="${1:-$ROOTFS_DIR/rootfs}"
|
|
OUTPUT="$PROJECT_ROOT/build/cache/kernel-config"
|
|
|
|
if [ -d "$COREGZ" ]; then
|
|
# Rootfs already extracted
|
|
ROOTFS="$COREGZ"
|
|
elif [ -f "$COREGZ" ]; then
|
|
# Extract core.gz
|
|
TMPDIR=$(mktemp -d)
|
|
cd "$TMPDIR"
|
|
zcat "$COREGZ" | cpio -idm 2>/dev/null
|
|
ROOTFS="$TMPDIR"
|
|
fi
|
|
|
|
# Try /proc/config.gz in rootfs
|
|
if [ -f "$ROOTFS/proc/config.gz" ]; then
|
|
zcat "$ROOTFS/proc/config.gz" > "$OUTPUT"
|
|
echo "==> Extracted kernel config to: $OUTPUT"
|
|
"$PROJECT_ROOT/build/config/kernel-audit.sh" "$OUTPUT"
|
|
else
|
|
echo "Kernel config not found in rootfs /proc/config.gz"
|
|
echo ""
|
|
echo "Alternative: Boot the Tiny Core ISO in QEMU and run:"
|
|
echo " zcat /proc/config.gz > /tmp/kernel-config"
|
|
echo " # Then copy it out"
|
|
echo ""
|
|
echo "Or check if /boot/config-* exists in the ISO"
|
|
|
|
# Try looking in /boot
|
|
for f in "$ROOTFS"/boot/config-*; do
|
|
[ -f "$f" ] || continue
|
|
cp "$f" "$OUTPUT"
|
|
echo "==> Found boot config: $f → $OUTPUT"
|
|
"$PROJECT_ROOT/build/config/kernel-audit.sh" "$OUTPUT"
|
|
exit 0
|
|
done
|
|
fi
|
|
|
|
[ -d "${TMPDIR:-}" ] && rm -rf "$TMPDIR"
|