tools/objtool del kernel enlaza -lelf (libelf+gelf.h); venía de `apk add elfutils-dev`. Ahora recipes/elfutils.toml construye SÓLO libelf (0.194, lo que objtool necesita — no libdw/libdwfl/src) desde fuente, wired como deps.build del kernel. Con esto NINGÚN build-dep del kernel viene de Alpine: el camino del kernel es 100% hammer-from-source. elfutils es glibc-céntrico; musl no trae <error.h>/<argp.h>/<libintl.h>/fts/ obstack/rawmemchr. En vez del parche completo de Alpine, shims mínimos en compat/ (vía CPPFLAGS/-include): error.h y argp.h (sólo los usan color.c/printversion.c, cuyos .o van en libeu.a pero objtool NO referencia ⇒ basta que compilen); libintl no-op (+ --disable-nls); rawmemchr inline; y libargp/libfts/libobstack.a stubs para pasar los AC_SEARCH_LIBS del configure (símbolos inertes para libelf). CC=gcc. bootstrap-devfs.sh: elfutils-dev fuera del NEEDED. Validado: purgué elfutils-dev del devfs, rebuild → objtool linkea el libelf hammer (sin gelf.h Alpine), y HAMMER_KERNEL=1 verify → ✓ REPRODUCIBLE bit a bit, DRIVER_RC=0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
76 lines
4.8 KiB
TOML
76 lines
4.8 KiB
TOML
# Linux kernel 6.16.12 — frente kernel-from-source (soberanía del bootstrap).
|
|
#
|
|
# Hoy la VM del selfhost-verify bootea un kernel importado pinned (/boot/vmlinuz-linux del host). Esta
|
|
# receta lo construye desde fuente con hammer: el último eslabón del bootstrap que no era hammer-built.
|
|
# Misma versión que recipes/linux-headers.toml (6.16.12) ⇒ coherencia headers↔kernel.
|
|
#
|
|
# Criterio de éxito: el bzImage hammer-built bootea el builder de selfhost-verify y la corrida da
|
|
# ✓ REPRODUCIBLE (KERNEL=<este bzImage> ./scripts/selfhost-verify.sh).
|
|
#
|
|
# Compilador: CC=gcc/HOSTCC=gcc (NO zig) — el kernel es el binario más grande del lab y zig 0.16
|
|
# miscompila binarios grandes (lesson binutils/python/cmake/flex); el kernel se compila con la GNU
|
|
# toolchain estándar (gcc + binutils as/ld del toolchain). No es input del 4/4 (es el kernel que
|
|
# BOOTEA la VM, no algo que el 4/4 enlace), así que el compilador da igual mientras el kernel bootee.
|
|
#
|
|
# Config: defconfig x86_64 (base PC booteable en QEMU: 8250 serial, initrd, PCI) + ajustes monolíticos
|
|
# - E1000/OVERLAY_FS/USER_NS =y (built-in): el builder usa e1000 (vendoring) + overlay (sandbox bwrap)
|
|
# + user namespaces (bwrap). Built-in ⇒ sin inyección de .ko ni version-magic.
|
|
# - MODULE_SIG/DEBUG_INFO_BTF off: evitan firma de módulos y pahole (BTF), ausente del toolchain.
|
|
# - UNWINDER_FRAME_POINTER en vez de ORC: reduce objtool pero NO lo elimina — en x86_64 las
|
|
# mitigaciones (RETHUNK/retpoline-validation) seleccionan CONFIG_OBJTOOL igual, y objtool necesita
|
|
# libelf (gelf.h). Además el defconfig fuerza CONFIG_SYSTEM_DATA_VERIFICATION=y (cadena KEYS←NFS/
|
|
# integrity/dns_resolver, no apagable sin desarmar media config) ⇒ su host-tool certs/extract-cert
|
|
# #incluye openssl. Por eso libelf + openssl se proveen como BOOTSTRAP-LIBS apk en bootstrap-devfs.sh
|
|
# (status g++/zlib-dev; SEGUROS para el of_tree: hammerd no usa openssl, arje-zero va preseeded).
|
|
# deps.build=[flex,bison,m4] son hammer-built; libelf/openssl quedan de-Alpinizables luego con
|
|
# recipes/{elfutils,openssl}.toml.
|
|
# - FANOTIFY + OVERLAY_FS_{REDIRECT_DIR,INDEX,XINO_AUTO,METACOPY}: el defconfig los deja off; el
|
|
# kernel que booteaba (Arch/Artix) los tiene =y. FANOTIFY: hammerd lo usa para el watcher del
|
|
# diario (sin él: WARN ENOSYS, no fatal). Los overlay sub-features: hipótesis para el bwrap del
|
|
# sandbox (`--tmp-overlay /` falló con "pivot_root: Invalid argument" en el 1er boot).
|
|
# [WIP 2026-06-19: el bzImage BOOTEA (console ttyS0, arje-zero PID1, hammerd, red e1000 vendorea OK);
|
|
# falta que el sandbox bwrap pivote — iterando config. Build ~35min (defconfig grande, a optimizar).]
|
|
|
|
name = "linux"
|
|
version = "6.16.12"
|
|
|
|
[source]
|
|
tarball = "https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-6.16.12.tar.gz"
|
|
sha256 = "ffc6af80b014ddebd55e116aa29a9f7a5256c87a29a8a9dd97270b6d49625109"
|
|
|
|
[build]
|
|
compiler = "zig-cc"
|
|
target = "x86_64-linux-musl"
|
|
link = "dynamic"
|
|
|
|
[deps]
|
|
# flex (lexer kconfig) + bison (parser kconfig) + m4 (bison lo invoca en runtime) + openssl (libcrypto
|
|
# estática para certs/extract-cert). Se materializan como capa overlay en /usr (binarios en /usr/bin,
|
|
# skeletons de bison en /usr/share/bison, libcrypto.a + headers + pkgconfig en /usr/{lib,include}).
|
|
# openssl + elfutils de-Alpinizan los build-deps que antes venían de `apk add openssl-dev elfutils-dev`.
|
|
# elfutils.toml construye SÓLO libelf (lo que objtool enlaza) con shims musl (argp/error/libintl/fts/
|
|
# obstack/rawmemchr); ver su cabecera. Todo el camino del kernel es ahora hammer-from-source.
|
|
build = ["flex", "bison", "m4", "openssl", "elfutils"]
|
|
|
|
[build.phases]
|
|
configure = """
|
|
make ARCH=x86_64 defconfig && \
|
|
scripts/config -d MODULE_SIG -d MODULE_SIG_ALL -d DEBUG_INFO_BTF -d DEBUG_INFO \
|
|
-d UNWINDER_ORC -e UNWINDER_FRAME_POINTER \
|
|
-e BLK_DEV_INITRD -e DEVTMPFS -e DEVTMPFS_MOUNT -e TMPFS \
|
|
-e E1000 -e OVERLAY_FS -e USER_NS -e NAMESPACES \
|
|
-e FANOTIFY -e FANOTIFY_ACCESS_PERMISSIONS \
|
|
-e OVERLAY_FS_REDIRECT_DIR -e OVERLAY_FS_INDEX -e OVERLAY_FS_XINO_AUTO -e OVERLAY_FS_METACOPY \
|
|
-d DRM -d AGP -d FB -d BACKLIGHT_CLASS_DEVICE -d SOUND -d SND \
|
|
-d USB_SUPPORT -d MEDIA_SUPPORT -d INFINIBAND -d BT -d NFC -d CAN \
|
|
-d WLAN -d WIRELESS -d CFG80211 -d MAC80211 -d RFKILL \
|
|
-d HID_SUPPORT -d HID -d INPUT_MOUSE -d INPUT_JOYSTICK -d INPUT_TABLET -d INPUT_TOUCHSCREEN \
|
|
-d WATCHDOG -d THUNDERBOLT -d FIREWIRE -d HWMON -d POWER_SUPPLY -d MEMSTICK -d MMC \
|
|
-d ATA -d SCSI -d NVME_CORE -d MD -d STAGING -d IIO -d PPS -d PTP_1588_CLOCK \
|
|
-d EXT4_FS -d XFS_FS -d BTRFS_FS -d F2FS_FS -d JFS_FS -d REISERFS_FS -d GFS2_FS -d NTFS3_FS \
|
|
-d DRM_I915 -d DRM_AMDGPU -d DRM_NOUVEAU -d DRM_RADEON && \
|
|
make ARCH=x86_64 olddefconfig
|
|
"""
|
|
compile = "make ARCH=x86_64 CC=gcc HOSTCC=gcc -j\"$(nproc)\" bzImage"
|
|
install = "mkdir -p /out/boot && cp arch/x86/boot/bzImage /out/boot/bzImage && cp .config /out/boot/config-6.16.12"
|