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:
2025-09-03 14:06:44 +02:00
parent 6d44575860
commit b9f94105cf
23 changed files with 1072 additions and 4310 deletions

59
scripts/debug-container.sh Executable file
View File

@@ -0,0 +1,59 @@
#!/bin/bash
# Debug script to test container output behavior
set -euo pipefail
# Script directory and project root detection
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
echo "=== HOST DEBUG TEST ==="
echo "SCRIPT_DIR: $SCRIPT_DIR"
echo "PROJECT_ROOT: $PROJECT_ROOT"
echo "PWD: $(pwd)"
echo "USER: $(whoami)"
# Source common functions
source "${SCRIPT_DIR}/lib/common.sh"
echo "=== AFTER SOURCING COMMON.SH ==="
log_info "Testing log_info function"
log_warn "Testing log_warn function"
log_error "Testing log_error function"
echo "=== TESTING SAFE_EXECUTE ==="
safe_execute echo "Testing safe_execute with simple command"
safe_execute ls -la "${SCRIPT_DIR}"
echo "=== TESTING IN_CONTAINER ==="
if in_container; then
log_info "Running inside container"
else
log_info "Running on host"
fi
echo "=== CHECKING DOCKER FUNCTIONS ==="
source "${SCRIPT_DIR}/lib/docker.sh"
if command_exists "podman" || command_exists "docker"; then
log_info "Container runtime available, testing container run"
docker_detect_runtime
# Test minimal container run
log_info "Testing minimal container echo"
if [[ -n "${CONTAINER_RUNTIME:-}" ]]; then
echo "Running: ${CONTAINER_RUNTIME} run --rm alpine:3.22 echo 'Container test successful'"
${CONTAINER_RUNTIME} run --rm alpine:3.22 echo "Container test successful"
echo "Running: ${CONTAINER_RUNTIME} run --rm alpine:3.22 sh -c 'echo First line; echo Second line; echo Third line'"
${CONTAINER_RUNTIME} run --rm alpine:3.22 sh -c 'echo First line; echo Second line; echo Third line'
echo "Testing with TTY:"
${CONTAINER_RUNTIME} run --rm -it alpine:3.22 sh -c 'echo TTY test line 1; echo TTY test line 2'
fi
else
log_warn "No container runtime available"
fi
echo "=== DEBUG TEST COMPLETE ==="