X on the console: /dev/tty0, a palette, and startx that works

Xorg finds its VT through /dev/tty0, and without one ran on none: the
console went on drawing into the framebuffer over the X screen. tty0 is
the terminal on screen, as on Linux. FBIOPUTCMAP succeeds, as it does on
a true-colour Linux framebuffer, instead of 256 logged errors per start.

schos-base gives root a .xserverrc with -dumbSched, Xorg's switch for
input on the main loop: SchOS has no threads, and Xorg crashed in
pthread_join on its input thread when the first client left. It adds
the hostname to /etc/hosts, so xauth can resolve schos:0.

zsh loses PROMPT_SP: on a serial terminal narrower than the console its
padding wrapped and left a # above every prompt. bootcheck knows zsh's
prompt and matches without colour codes, so busybox's ls reads as text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
Nexoniarz 2026-10-24 19:44:10 +02:00
commit 906318f2b6
6 changed files with 51 additions and 4 deletions

View file

@ -97,6 +97,18 @@ mkdir -p "$P/etc/profile.d"
grep -v '^export \(PATH\|HOME\|TERM\)=' "$P/etc/profile" > "$P/etc/profile.d/schos.sh"
rm -f "$P/etc/profile"
# How startx starts the X server for root: Alpine's xserverrc, plus
# -dumbSched. Xorg reads input on a thread of its own, SchOS has no threads
# yet, and the server crashed on its way out the first time a client
# disconnected, in pthread_join on a thread that was never made. -dumbSched is
# Xorg's own switch for input on the main loop. The file is root's own rather
# than /etc/X11/xinit/xserverrc, which belongs to the xinit package.
mkdir -p "$P/root"
cat > "$P/root/.xserverrc" <<'XEOF'
#!/bin/sh
exec /usr/bin/X -nolisten tcp -dumbSched "$@"
XEOF
# Mount points and runtime directories are alpine-baselayout's; an empty
# directory here only duplicates it.
for d in dev proc sys run tmp srv; do
@ -110,6 +122,9 @@ sed -i 's|^\(root:[^:]*:0:0:[^:]*:[^:]*:\)/bin/sh$|\1/bin/zsh|' /etc/passwd
for s in /bin/zsh /bin/mksh; do
grep -qx "$s" /etc/shells 2>/dev/null || echo "$s" >> /etc/shells
done
# The machine's own name, which Alpine's hosts leaves out. Without it xauth
# cannot resolve "schos:0", and startx says "bad display name" four times.
grep -qw schos /etc/hosts || printf '127.0.1.1\tschos\n' >> /etc/hosts
exit 0
EOF
cp "$PKG/post-install" "$PKG/post-upgrade"
@ -157,7 +172,8 @@ ROOT_PI=$ROOT sh -c '
sed -i "s|^\(root:[^:]*:0:0:[^:]*:[^:]*:\)/bin/sh$|\1/bin/zsh|" "$ROOT_PI/etc/passwd"
for s in /bin/zsh /bin/mksh; do
grep -qx "$s" "$ROOT_PI/etc/shells" 2>/dev/null || echo "$s" >> "$ROOT_PI/etc/shells"
done'
done
grep -qw schos "$ROOT_PI/etc/hosts" || printf "127.0.1.1\tschos\n" >> "$ROOT_PI/etc/hosts"'
# The repository goes in too, so the installed system can reinstall and
# upgrade schos-base, and Alpine's are listed for everything else.