diff --git a/fedac/native/Dockerfile.builder b/fedac/native/Dockerfile.builder index b9f5857abf..d039eb0776 100644 --- a/fedac/native/Dockerfile.builder +++ b/fedac/native/Dockerfile.builder @@ -32,17 +32,13 @@ RUN dnf install -y --setopt=install_weak_deps=False \ && dnf clean all && rm -rf /var/cache/dnf # ── Install Quicklisp + CL dependencies for Lisp build variant ── -RUN sbcl --non-interactive \ - --eval '(require :asdf)' \ - --eval '(load (make-pathname :name "quicklisp" :type "lisp" :defaults (merge-pathnames "quicklisp/" (user-homedir-pathname))))' \ - 2>/dev/null || \ - (curl -sfo /tmp/ql.lisp https://beta.quicklisp.org/quicklisp.lisp && \ - sbcl --non-interactive \ +RUN curl -sfo /tmp/ql.lisp https://beta.quicklisp.org/quicklisp.lisp \ + && sbcl --non-interactive \ --load /tmp/ql.lisp \ --eval '(quicklisp-quickstart:install :path "/opt/quicklisp/")' \ --eval '(ql:quickload (list :cffi :bordeaux-threads :alexandria))' \ - --eval '(sb-ext:save-lisp-and-die "/cache/sbcl-ql.core" :purify t)' && \ - rm /tmp/ql.lisp) + --eval '(sb-ext:save-lisp-and-die "/cache/sbcl-ql.core" :purify t)' \ + && rm /tmp/ql.lisp # ── Pre-download QuickJS + Linux kernel source ── RUN mkdir -p /cache && cd /cache \ diff --git a/fedac/native/initramfs/init b/fedac/native/initramfs/init index 5be0db924f..b500febcb6 100755 --- a/fedac/native/initramfs/init +++ b/fedac/native/initramfs/init @@ -1,5 +1,5 @@ #!/bin/sh -# AC Native OS init — DRM direct boot, cage transition happens in userspace +# AC Native OS init — DRM direct boot with crash recovery mount -t proc proc /proc 2>/dev/null mount -t sysfs sysfs /sys 2>/dev/null @@ -9,35 +9,8 @@ mount -t devpts devpts /dev/pts -o ptmxmode=0666 2>/dev/null mount -t tmpfs tmpfs /dev/shm 2>/dev/null mount -t tmpfs tmpfs /tmp 2>/dev/null mount -t tmpfs tmpfs /run 2>/dev/null -mount -t tracefs tracefs /sys/kernel/tracing 2>/dev/null -mount -t debugfs debugfs /sys/kernel/debug 2>/dev/null mount -t efivarfs efivarfs /sys/firmware/efi/efivars 2>/dev/null -# Restore baked credentials from initramfs rootfs (before tmpfs hid them) -# The build bakes Claude creds at /tmp/.claude/ but tmpfs mount hides them. -# Copy from the initramfs backup location instead. -# Restore baked files from initramfs rootfs (tmpfs mount hid them) -if [ -f /claude-creds.json ]; then - mkdir -p /tmp/.claude - cp /claude-creds.json /tmp/.claude/.credentials.json - cp /claude-state.json /tmp/.claude.json 2>/dev/null - # Seed Claude Code settings — suppresses "installMethod native" startup warning - printf '{\n "permissions": {\n "allow": ["Bash(*)", "Read(*)", "Write(*)", "Edit(*)", "Glob(*)", "Grep(*)", "WebFetch(*)", "WebSearch(*)"]\n },\n "autoUpdates": false,\n "installMethod": "native"\n}\n' > /tmp/.claude/settings.json -fi -# CLAUDE.md working directory for Claude Code -if [ -d /tmp/ac ]; then - # Already baked at /tmp/ac/CLAUDE.md — just needs to survive tmpfs - true -else - mkdir -p /tmp/ac -fi -# Copy CLAUDE.md from initramfs if it was baked there -[ -f /device-claude.md ] && { mkdir -p /tmp/ac; cp /device-claude.md /tmp/ac/CLAUDE.md 2>/dev/null; } - -# Log to /tmp (ac-native copies to USB) -ilog() { echo "ac-init: $*" >> /tmp/ac-init.log 2>/dev/null; } -ilog "start" - # zram swap modprobe zram 2>/dev/null echo 1G > /sys/block/zram0/disksize 2>/dev/null && mkswap /dev/zram0 >/dev/null 2>&1 && swapon /dev/zram0 2>/dev/null @@ -45,31 +18,46 @@ echo 1G > /sys/block/zram0/disksize 2>/dev/null && mkswap /dev/zram0 >/dev/null # Loopback ip link set lo up 2>/dev/null -export PATH="/bin:/sbin:/usr/bin:/usr/sbin" -export SSL_CERT_FILE="/etc/pki/tls/certs/ca-bundle.crt" -export CURL_CA_BUNDLE="/etc/pki/tls/certs/ca-bundle.crt" -export SSL_CERT_DIR="/etc/ssl/certs" +# Restore baked Claude credentials (tmpfs mount hid the originals) +if [ -f /claude-creds.json ]; then + mkdir -p /tmp/.claude + cp /claude-creds.json /tmp/.claude/.credentials.json + cp /claude-state.json /tmp/.claude.json 2>/dev/null + printf '{"permissions":{"allow":["Bash(*)","Read(*)","Write(*)","Edit(*)","Glob(*)","Grep(*)","WebFetch(*)","WebSearch(*)"]},"autoUpdates":false,"installMethod":"native"}\n' > /tmp/.claude/settings.json +fi +mkdir -p /tmp/ac +[ -f /device-claude.md ] && cp /device-claude.md /tmp/ac/CLAUDE.md 2>/dev/null +[ -f /device-score.md ] && cp /device-score.md /tmp/ac/SCORE.md 2>/dev/null -# /etc/group and /etc/passwd needed by seatd (started later by ac-native) +# /etc/group and /etc/passwd needed by seatd echo "root:x:0:" > /etc/group echo "root:x:0:root" > /etc/passwd +# Wait for GPU (up to 3 seconds) +i=0 +while [ ! -e /dev/dri/card0 ] && [ ! -e /dev/dri/card1 ] && [ ! -e /dev/fb0 ] && [ $i -lt 300 ]; do + usleep 10000 2>/dev/null || sleep 1 + i=$((i+1)) +done + # Performance governor for g in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do - echo performance > "$g" 2>/dev/null + echo performance > "$g" 2>/dev/null done -ilog "start-ac-native" +export PATH="/bin:/sbin:/usr/bin:/usr/sbin" +export SSL_CERT_FILE="/etc/pki/tls/certs/ca-bundle.crt" +export CURL_CA_BUNDLE="/etc/pki/tls/certs/ca-bundle.crt" +export SSL_CERT_DIR="/etc/ssl/certs" -# Run ac-native in a loop — if it crashes, show red screen + restart +# Run ac-native in a loop — if it crashes, restart; if clean exit, shutdown CRASH_COUNT=0 while true; do /ac-native /piece.mjs EXIT_CODE=$? - # Clean exit (0) = shutdown requested — don't restart + # Clean exit (0) = shutdown requested if [ "$EXIT_CODE" = "0" ]; then - ilog "ac-native exited cleanly — shutting down" sync poweroff -f 2>/dev/null || reboot -f 2>/dev/null sleep 10 @@ -77,18 +65,11 @@ while true; do fi CRASH_COUNT=$((CRASH_COUNT + 1)) - ilog "ac-native crashed with code $EXIT_CODE (crash #$CRASH_COUNT)" - - # Write crash info to USB if mounted - if [ -d /mnt/usb ]; then - echo "crash #$CRASH_COUNT exit=$EXIT_CODE time=$(date +%s 2>/dev/null || echo ?)" >> /mnt/usb/crash.log - fi - # Flash screen red via framebuffer (if available) + # Flash screen red via framebuffer if [ -c /dev/fb0 ]; then dd if=/dev/zero bs=4096 count=512 2>/dev/null | tr '\0' '\377' > /dev/fb0 2>/dev/null fi sleep 2 - ilog "restarting ac-native..." done diff --git a/fedac/native/kernel/config-minimal b/fedac/native/kernel/config-minimal index df31788717..a8767c51be 100644 --- a/fedac/native/kernel/config-minimal +++ b/fedac/native/kernel/config-minimal @@ -1156,8 +1156,8 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y CONFIG_FW_LOADER=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_EXTRA_FIRMWARE="" -CONFIG_EXTRA_FIRMWARE_DIR="" +CONFIG_EXTRA_FIRMWARE="i915/glk_dmc_ver1_04.bin i915/kbl_dmc_ver1_04.bin iwlwifi-9260-th-b0-jf-b0-46.ucode iwlwifi-cc-a0-77.ucode iwlwifi-QuZ-a0-hr-b0-77.ucode iwlwifi-QuZ-a0-jf-b0-77.ucode" +CONFIG_EXTRA_FIRMWARE_DIR="/workspaces/aesthetic-computer/fedac/native/build/firmware" CONFIG_FW_LOADER_USER_HELPER=y # CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set CONFIG_FW_LOADER_COMPRESS=y