build-redbear.sh: relink base-initfs on boot-ABI change (fixes init malloc panic at boot)
redbear-ci / check (push) Waiting to run

The mini ISO built and booted the kernel but pid1 `init` panicked right after
switchroot with "memory allocation of 1343504 bytes failed" (with GBs free) —
a stale-ABI skew. base-initfs is a `custom` recipe that builds the static
boot-critical initfs binaries (init/logd/randd/zerod/acpid/pcid/vesad/fbcond/…),
but its content-hash cache does not track the boot-ABI crates
(relibc/libredox/syscall/redox-scheme). On a boot-ABI change it stayed "cached"
with binaries linked against the old ABI, so init died before login.

Add base-initfs to ABI_CRITICAL_PKGS (relinked with base/redoxfs/userutils when
the boot ABI changes) and to PRECOOK_PKGS (republished via the reliable single
`repo cook` path, ordered after base whose sysroot binaries it stages).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-29 10:51:08 +09:00
parent 65ab28dcc5
commit 0ead042c8a
+11 -4
View File
@@ -9,7 +9,7 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
# REDBEAR_VERSION (which tracks the OS release derived from the git branch).
# Starts at 1.0 and is bumped AUTOMATICALLY on every change by the pre-commit
# git hook (local/scripts/bump-build-version.sh); do not edit the minor by hand.
BUILD_REDBEAR_VERSION="1.5"
BUILD_REDBEAR_VERSION="1.6"
# ── Colorized output ──────────────────────────────────
# Enabled only on a TTY with NO_COLOR unset, so redirected build logs and CI
@@ -865,7 +865,14 @@ if [ "$NO_CACHE" != "1" ]; then
# any driver/acpi/base edit). For a genuine relibc *C-ABI* break — a libc
# struct/inline baked into a compiled consumer, which is rare — force a full
# clean rebuild with `--no-cache`.
ABI_CRITICAL_PKGS="base redoxfs userutils bootstrap"
# base-initfs builds the STATIC boot-critical binaries baked into the initfs
# (init, logd, ramfs, randd, zerod, acpid, pcid, vesad, fbcond, …). It is a
# `custom` recipe whose content-hash cache does NOT track the boot-ABI crates
# (relibc/libredox/syscall/redox-scheme), so a boot-ABI change leaves it
# "cached" with stale binaries — pid1 `init` then dies at boot with a bogus
# "memory allocation failed" (ABI skew), never reaching login. It must relink
# alongside base/redoxfs/userutils whenever the boot ABI changes.
ABI_CRITICAL_PKGS="base base-initfs redoxfs userutils bootstrap"
_boot_abi_changed=0
[ "$relibc_rebuilding" = "1" ] && _boot_abi_changed=1
[ "$USERSPACE_RUNTIME_STALE" = "1" ] && _boot_abi_changed=1
@@ -1060,9 +1067,9 @@ if [ "$CONFIG" = "redbear-full" ]; then
# configure fails ("Could not find a package configuration file provided by
# Qt6Qml"), aborting the whole build. Pre-cook the Qt stack IN ORDER, before
# sddm/kwin, so every Qt6 CMake package is cached in the sysroot first.
PRECOOK_PKGS="relibc base redoxfs userutils icu llvm21 libclc mesa libdrm libepoxy redox-drm lcms2 libdisplay-info libxcvt qtbase qtshadertools qtdeclarative qtsvg qtwayland sddm redbear-compositor redbear-greeter"
PRECOOK_PKGS="relibc base redoxfs userutils base-initfs icu llvm21 libclc mesa libdrm libepoxy redox-drm lcms2 libdisplay-info libxcvt qtbase qtshadertools qtdeclarative qtsvg qtwayland sddm redbear-compositor redbear-greeter"
else
PRECOOK_PKGS="relibc base redoxfs userutils icu"
PRECOOK_PKGS="relibc base redoxfs userutils base-initfs icu"
fi
# NB: base/redoxfs/userutils are added to the pre-cook set so the boot-ABI
# "relink ONLY the static initfs-critical binaries" invalidation above