hammer-bootstrap: userland Rust en el producto + adelgazar busybox (Etapa C)
Extiende la capa de producto con el userland Rust-nativo ADOPTADO, fuera del núcleo blindado (sigue sin tocar STAGE1_COMPONENTS ni el of_tree). - USERLAND_COMPONENTS = [uutils, findutils, findutils-xargs, diffutils, ripgrep]: se hidratan sobre el 4/4 DESPUÉS de busybox ⇒ sus symlinks en /usr/bin ensombrecen los applets busybox. - ADELGAZAR BUSYBOX (determinista, sin depender del PATH del shell): por cada nombre que el userland Rust provee en /usr/bin, se RETIRA el symlink homónimo de busybox en /bin, /sbin, /usr/sbin (busybox suele dejar `ls` en /bin, fuera del /usr/bin ya ensombrecido). La tool Rust queda ÚNICA en PATH. El binario busybox y lo no reemplazado (sh/ash, tar, mount) se preservan. - product_rootfs_hash v2 (incluye userland); build_components() helper; assemble_product_rootfs hidrata base→userland→servicios. - 36 tests verde (nuevo: ensombrecido + retiro de applet + sh/busybox quedan). Validado in-VM (product-boot-test.sh sobre el product-rootfs de la ruta real): ls = "uutils coreutils 0.9.0" (/usr/bin/ls), find = "find (Rust) 0.9.1", rg = "ripgrep 14.1.1"; /bin/ls y /bin/cat retirados, /bin/sh + busybox preservados. SSH sigue verde. "Adelgazar busybox" cerrado en el producto. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -42,10 +42,13 @@ chmod 0600 "$RFS/root/.ssh/authorized_keys"
|
||||
|
||||
# sanity: el árbol de producto trae lo que esperamos (sin ensamblarlo acá)
|
||||
echo "==> chequeo de contenido del artefacto:"
|
||||
for f in usr/sbin/sshd usr/bin/netup etc/ssh/sshd_config etc/passwd ente/seed.card.json; do
|
||||
for f in usr/sbin/sshd usr/bin/netup usr/bin/coreutils usr/bin/find usr/bin/rg etc/ssh/sshd_config etc/passwd ente/seed.card.json; do
|
||||
[ -e "$RFS/$f" ] && echo " ok $f" || { echo " FALTA $f"; exit 1; }
|
||||
done
|
||||
grep -q '"label": "sshd"' "$RFS/ente/seed.card.json" && echo " ok card sshd en la seed" || { echo " FALTA card sshd"; exit 1; }
|
||||
# adelgazar busybox: /usr/bin/ls debe apuntar a coreutils (Rust), no a busybox
|
||||
lstgt=$(readlink "$RFS/usr/bin/ls" 2>/dev/null || true)
|
||||
[ "$lstgt" = coreutils ] && echo " ok /usr/bin/ls → coreutils (ensombrece busybox)" || echo " !! /usr/bin/ls → ${lstgt:-?}"
|
||||
|
||||
# empaquetar (root-owned) y bootear
|
||||
( cd "$RFS" && find . -print0 | cpio --null -o -H newc -R 0:0 2>/dev/null | gzip -1 ) > "$WORK/initramfs.cpio.gz"
|
||||
@@ -63,7 +66,10 @@ start=$(date +%s); ok=0
|
||||
while [ $(( $(date +%s) - start )) -lt "$DEADLINE" ]; do
|
||||
kill -0 $QPID 2>/dev/null || { echo "!! QEMU murió"; break; }
|
||||
if out=$(ssh "${SSHOPTS[@]}" root@localhost \
|
||||
'echo PRODUCT_SSH_OK uid=$(id -u); cat /ente/seed.card.json | grep -o "\"label\": \"[a-z-]*\"" | tr "\n" " "; echo; uname -sr' 2>/dev/null); then
|
||||
'echo PRODUCT_SSH_OK uid=$(id -u); uname -sr;
|
||||
printf "ls: "; command -v ls; ls --version 2>&1 | head -1;
|
||||
printf "find: "; find --version 2>&1 | head -1;
|
||||
printf "rg: "; rg --version 2>&1 | head -1' 2>/dev/null); then
|
||||
echo "============== RESPUESTA DEL GUEST =============="; echo "$out"; echo "================================================"
|
||||
echo "$out" | grep -q PRODUCT_SSH_OK && ok=1; break
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user