velxio/backend/app/services/boot_images
davidmonterocrespo24 4b13662657 fix(pi3): velxio-init v2 — wait for /dev/ttyAMA1, exec on /dev/console
The previous velxio-init was racing devtmpfs population: its bash
redirect '</dev/ttyAMA1 >/dev/ttyAMA1' fired before the kernel had
enumerated the PL011 driver and populated the device node, so PID 1's
fd 0/1/2 redirect failed and the `while true` loop spun on
"No such file or directory" forever.

Two fixes baked into the SD image:

1. Wait up to 12 s for /dev/ttyAMA1 to appear (200 ms poll × 60).
   On real bare-metal Pi the node is there at init time, but
   under QEMU emulation the PL011 probe races.

2. Exec the shell with </dev/console >/dev/console — /dev/console is
   set up by the kernel (no race) and points at the last `console=`
   arg from the cmdline, which is ttyAMA1. Also wrap in `setsid -c`
   so bash gets a controlling terminal and behaves interactively.

Verified end-to-end with a live QEMU boot against the patched .img:
shell prompt `root@raspberrypi:/#` appears within ~50 s wall (most
of that is the kernel waiting on the second SD slot mmc1 timeout
twice = 20 s).
2026-05-16 08:39:37 +02:00
..
__init__.py feat(sim): boot_images module + Pi 3 emulation restored 2026-05-16 05:41:46 +02:00
downloader.py feat(sim): boot_images module + Pi 3 emulation restored 2026-05-16 05:41:46 +02:00
errors.py feat(sim): boot_images module + Pi 3 emulation restored 2026-05-16 05:41:46 +02:00
integrity.py feat(sim): boot_images module + Pi 3 emulation restored 2026-05-16 05:41:46 +02:00
manifest.json fix(pi3): velxio-init v2 — wait for /dev/ttyAMA1, exec on /dev/console 2026-05-16 08:39:37 +02:00
manifest.py feat(sim): boot_images module + Pi 3 emulation restored 2026-05-16 05:41:46 +02:00
provider.py fix(pi3): show kernel boot + autologin SD + sidecar cache invalidation 2026-05-16 06:23:22 +02:00