# /etc/brintos-rc — brintOS dev-machine-2 interactive shell rc (HWJS-C-1). # # busybox ash sources $ENV for EVERY interactive shell. pid 1 here is # `/bin/sh -i` (init=/bin/sh, argv0="/bin/sh" -> NOT a login shell, so it reads # no /etc/profile). We use $ENV=/etc/brintos-rc (set in the machine driver's # initEnvp) to get a hook that runs once, in pid 1, WITHOUT touching pid 1's # own pts/xterm stdio (A-2 stays byte-identical). # # It spawns an ADDITIONAL interactive shell on /dev/tty1 — the foreground # virtual console that fbcon (CONFIG_FRAMEBUFFER_CONSOLE) renders onto the # machine's framebuffer . Keystrokes reach it via canvas -> virtio-input -> # VT keyboard -> tty1 (fg_console). setsid+cttyhack give it its own session # with /dev/tty1 as the controlling terminal (job control, Ctrl-C). TERM=linux # because tty1 is a real VT (the pts shell keeps TERM=dumb). The guard # (BRINTOS_FBCON_STARTED + pid==1) makes this fire exactly once — the tty1 # shell itself re-sources this rc but is skipped. # # Works at ANY machineSpec.cpu, including 1 (2026-07-02 scheduler fix): # blocking tty reads now default to the cooperative -517 coro-park (the # reader yields its pool Worker to co-resident peers) and the kernel-Worker # dispatcher idle-quiesces (arch/wasm32/kernel/sched.c), so two interactive # shells + their fork children multiplex on ONE pool Worker with prompt # latencies. (Historical: the old PINNING tty read starved the two consoles # on a 1-Worker pool — the HWJS-C-1 "crossed wires" wedge, then worked # around with cpu=6; both retired. The pin survives only behind the # explicit `wasm_user_pin` kernel-cmdline fallback.) Canonical copy: # distros/linux-6.12-musl-busybox/tools/fbcon-rc (staged to /etc/brintos-rc; # exercised by hardwarejs/test/dualcon-gate.test.ts at cpu ∈ {1,2,3,8}). if [ -z "${BRINTOS_FBCON_STARTED-}" ] && [ "$$" = 1 ] && [ -c /dev/tty1 ]; then export BRINTOS_FBCON_STARTED=1 TERM=linux PS1='$ ' setsid cttyhack /bin/sh -i <>/dev/tty1 >&0 2>&0 & fi # HWJS-C-2.b: one-shot machine bring-up (static eth0) for the init=/bin/sh # boot shape, where busybox init's ::sysinit never runs. Same pid-1-once # pattern as the fbcon block above; /etc/init.d/rcS is the canonical script # (tools/rcS), and the -x guard keeps synthetic gate rootfs (no rcS staged) # byte-identical in behavior. # NB: invoked as `sh rcS`, not exec'd: `#!` script exec currently fails with # ENOENT on this arch (binfmt_script -> binfmt_wasm re-entry gap, witnessed # live 2026-07-04 — filed as a C-2.b deferral; applets/builtins unaffected). if [ -z "${BRINTOS_RCS_STARTED-}" ] && [ "$$" = 1 ] && [ -x /etc/init.d/rcS ]; then export BRINTOS_RCS_STARTED=1 sh /etc/init.d/rcS fi