Twelve login terminals, root only, console fixes, a faster build, a Niveus splash, and X back on evdev

- tty1-tty12 all run login; the image has only root. /dev/tty7..12 could not
  be written (cdev.c knew minors 10-16 only), which sent their jobs into a
  restart storm that took the supervisor down; fixed, and stat reports them as
  Linux's tty7..12.
- Erasing text at a prompt did nothing: erase_one sent a bare backspace, which
  only moves; it and the echo path now send back-blank-back through vt_feed.
- A white cursor block was left at the end of every line of a verbose boot:
  a line feed at the bottom scrolls the pixels, cursor included, and the
  cursor was erased after the scroll. It comes off first now. A blank cell is
  also marked dirty, which it was not.
- ldlsd died with a general protection fault on real hardware in its variadic
  log function: Linux module code calls with an 8-byte-aligned stack and an
  unset %al, and the prologue's movaps faults. LDLS guest code is built with
  -mstackrealign.
- make iso took over a minute for any change, because staging r8169 rewrote
  the same files and every mtime moved; it now replaces files only if their
  contents differ (about 10 s).
- The loader's splash is redrawn in the boot manager's style, and the boot
  manager shows its cursor whenever a pointer device exists.
- xf86-input-libinput is out of the image again: with it Xorg took both
  keyboard and pointer from libinput and, on the user's laptop, neither worked.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EVRhxi9zpdW2uDUN4FVcao
This commit is contained in:
Nexoniarz 2026-10-26 17:43:44 +01:00
commit 2aef583aad
23 changed files with 290 additions and 155 deletions

View file

@ -1120,22 +1120,30 @@ $(BUILD)/lib/%.o: lib/%.S
# own -- a specific rule beats the pattern one below. ldls/ko.c, btf.c and
# stub.c are freestanding and build unchanged for either side, which is the
# whole point of having written them that way.
# A Linux module is compiled with an 8-byte-aligned stack and, being kernel
# code, never sets %al for a variadic call -- so it arrives in this code with
# the stack off by eight and %al garbage. Any function here that takes `...`
# then opens with `movaps %xmm0, -0xb0(%rbp)`, which faults on a misaligned
# address: that was the general-protection fault in ldlsd on real hardware, in
# the log function, the moment the first driver message was printed.
# -mstackrealign makes every function re-align its own stack on entry.
LDLS_ALIGN = -mstackrealign
LDLS_GUEST = $(addprefix $(BUILD)/ldls/guest/, ko.o btf.o stub.o) \
$(addprefix $(BUILD)/ldls/guest/kpi/, kpi.o pci.o io.o net.o skb.o string.o work.o thunk.o base.o)
$(BUILD)/ldls/guest/%.o: ldls/%.c ldls/ko.h ldls/btf.h ldls/stub.h
@mkdir -p $(BUILD)/ldls/guest
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) $(LDLS_ALIGN) -c $< -o $@
# The KPI -- the Linux symbols, implemented. Guest-only: it reaches /dev/pci
# and /dev/netdev, which exist on SchOS and nowhere else.
$(BUILD)/ldls/guest/kpi/%.o: ldls/kpi/%.c ldls/kpi/kpi.h ldls/kpi/link_modes.inc
@mkdir -p $(BUILD)/ldls/guest/kpi
$(CC) $(CFLAGS) -I./ldls -c $< -o $@
$(CC) $(CFLAGS) $(LDLS_ALIGN) -I./ldls -c $< -o $@
$(BUILD)/cmd/ldlsd: cmd/ldlsd/main.c $(ULIB) $(LDLS_GUEST)
@mkdir -p $(BUILD)/cmd
$(CC) $(CFLAGS) -I./ldls -c $< -o $(BUILD)/cmd/ldlsd.o
$(CC) $(CFLAGS) $(LDLS_ALIGN) -I./ldls -c $< -o $(BUILD)/cmd/ldlsd.o
$(LD) $(LDFLAGS) $(LD_LOWBASE) -e _start -Ttext 0x4000 -o $@ \
$(BUILD)/cmd/ldlsd.o $(LDLS_GUEST) $(ULIB)
$(OBJCOPY) -S $@
@ -1427,21 +1435,33 @@ LDLS_FWDIR ?= /run/current-system/firmware
LDLS_R8169 = drivers/net/phy/mdio-bus drivers/net/phy/libphy \
drivers/net/phy/mdio_devres drivers/net/phy/realtek/realtek \
drivers/net/ethernet/realtek/r8169
# Every file is replaced only if its contents differ. sysroot.stamp records the
# mtime of each staged file, `make iso` runs this every time, and rewriting the
# same bytes moved every mtime -- which rebuilt the root image and compressed it
# at zstd -19 (a minute) after a one-line kernel change.
ldls-r8169:
@mkdir -p $(SYSROOT)/lib/modules $(SYSROOT)/lib/firmware/rtl_nic
@set -e; list=; for m in $(LDLS_R8169); do \
f=$$(ls $(LDLS_KDIR)/$$m.ko* | head -1); n=$$(basename $$m).ko; \
case $$f in *.xz) xz -dc $$f;; *.zst) zstd -qdc $$f;; *) cat $$f;; esac \
> $(SYSROOT)/lib/modules/$$n; \
t=$(SYSROOT)/lib/modules/$$n; \
case $$f in *.xz) xz -dc $$f;; *.zst) zstd -qdc $$f;; *) cat $$f;; esac > $$t.new; \
if cmp -s $$t.new $$t; then rm -f $$t.new; else mv -f $$t.new $$t; fi; \
list=$$list$${list:+,}/lib/modules/$$n; done; \
cp /sys/kernel/btf/vmlinux $(SYSROOT)/lib/modules/btf; \
if ! cmp -s /sys/kernel/btf/vmlinux $(SYSROOT)/lib/modules/btf; then \
cp /sys/kernel/btf/vmlinux $(SYSROOT)/lib/modules/btf; fi; \
printf '#!/bin/sh\nmkdir -p /var/log\nexec /bin/ldlsd %s /lib/modules/btf > /var/log/ldls-r8169.log 2>&1\n' \
"$$list" > $(SYSROOT)/lib/modules/ldls-r8169.sh
"$$list" > $(SYSROOT)/lib/modules/ldls-r8169.sh.new; \
if cmp -s $(SYSROOT)/lib/modules/ldls-r8169.sh.new $(SYSROOT)/lib/modules/ldls-r8169.sh; then \
rm -f $(SYSROOT)/lib/modules/ldls-r8169.sh.new; \
else mv -f $(SYSROOT)/lib/modules/ldls-r8169.sh.new $(SYSROOT)/lib/modules/ldls-r8169.sh; fi
@for f in $(LDLS_FWDIR)/rtl_nic/rtl8168*.fw*; do \
n=$$(basename $$f); case $$n in \
*.zst) zstd -qdc $$f > $(SYSROOT)/lib/firmware/rtl_nic/$${n%.zst};; \
*.xz) xz -dc $$f > $(SYSROOT)/lib/firmware/rtl_nic/$${n%.xz};; \
*) cp $$f $(SYSROOT)/lib/firmware/rtl_nic/;; esac; done
*.zst) out=$${n%.zst}; zstd -qdc $$f > $(SYSROOT)/lib/firmware/rtl_nic/$$out.new;; \
*.xz) out=$${n%.xz}; xz -dc $$f > $(SYSROOT)/lib/firmware/rtl_nic/$$out.new;; \
*) out=$$n; cp $$f $(SYSROOT)/lib/firmware/rtl_nic/$$out.new;; esac; \
d=$(SYSROOT)/lib/firmware/rtl_nic/$$out; \
if cmp -s $$d.new $$d; then rm -f $$d.new; else mv -f $$d.new $$d; fi; done
@echo "staged Linux r8169 ($(shell uname -r)) into $(SYSROOT)"
# `make iso` runs this first: the ISO ships Linux's r8169 set (NOTICE), so stage it whenever