X runs without -dumbSched; the ISO ships r8169 and the licences

Tried in QEMU on a built ISO: startx brings up Window Maker, xclock and xeyes connect and disconnect, an xterm runs
and exits, Xorg stays up -- the pthread_join crash is gone with threads. -dumbSched is removed from .xserverrc.
make iso now stages Linux's r8169 set first when this machine has the modules (ldls-r8169-if-present), and
sysroot-install puts LICENSE, LICENSE.MIT and NOTICE in /usr/share/licenses/schos.

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 09:20:22 +01:00
commit 6e78bb0d5e
3 changed files with 28 additions and 13 deletions

View file

@ -804,6 +804,7 @@ projects:
# CFLAGS and make cannot see that.
# -----------------------------------------------------------------------
iso:
@$(MAKE) --no-print-directory ldls-r8169-if-present
$(MAKE) RAMROOT=1 schos.iso
# One El Torito entry, pointing at a FAT image holding the loader and kernel.
@ -1427,6 +1428,15 @@ ldls-r8169:
*) cp $$f $(SYSROOT)/lib/firmware/rtl_nic/;; esac; 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
# this machine has the modules and the BTF to stage it from, and say so when it does not.
ldls-r8169-if-present:
@if ls $(LDLS_KDIR)/drivers/net/ethernet/realtek/r8169.ko* >/dev/null 2>&1 && [ -r /sys/kernel/btf/vmlinux ]; then \
$(MAKE) --no-print-directory ldls-r8169; \
else \
echo "iso: no Linux r8169 modules or BTF on this machine ($(LDLS_KDIR)) -- this ISO will not carry them"; \
fi
ldls-unstage:
rm -rf $(SYSROOT)/lib/modules
@echo "removed"
@ -1497,6 +1507,10 @@ etc-install: $(SCHINIT_JOBS) $(ETC_PLAIN) $(ETC_ZSH) $(LOGO_ASCII) $(SRV_FILES)
@mkdir -p $(SYSROOT)/usr/share/hwdata
@rm -f $(SYSROOT)/usr/share/usb.ids
@for f in usb.ids pci.ids; do [ -f dist/$$f ] && cp -p dist/$$f $(SYSROOT)/usr/share/hwdata/; done; true
@# The licences travel with the image: SchOS's, xv6's, and NOTICE, which carries the
@# third-party ones -- including Linux's r8169 modules, whose source offer it records.
@mkdir -p $(SYSROOT)/usr/share/licenses/schos
@cp -p LICENSE LICENSE.MIT NOTICE $(SYSROOT)/usr/share/licenses/schos/
@echo "installed $(words $(ETC_PLAIN)) /etc file(s), $(words $(ETC_ZSH)) zsh file(s) and $(words $(SCHINIT_JOBS)) schinit manifest(s)"
# The mount points. Created here rather than by init, because a mkdir on a
@ -1844,4 +1858,4 @@ distclean: clean
-include $(shell find $(BUILD) \( -path $(BUILD)/aroot -o -path $(BUILD)/iso -o -path $(BUILD)/ports \) -prune -o -type f -name '*.d' -print 2>/dev/null)
FORCE:
.PHONY: FORCE
.PHONY: FORCE ldls-r8169-if-present

View file

@ -40,11 +40,12 @@ the real program is for.
## The four files
- **`/root/.xserverrc`** starts `X` on the VT `startx` was started from (startx works that
out only when `uname -s` says Linux, and SchOS's says SchIFT) with **`-dumbSched`**. Xorg
normally reads input on a thread of its own; when SchOS had no threads the server crashed
the first time a client disconnected, in `pthread_join` on a thread that was never made, and
`-dumbSched` is Xorg's own switch for input on the main loop. Threads exist now; the switch
is still on, and nobody has run the server without it since.
out only when `uname -s` says Linux, and SchOS's says SchIFT). It used to add **`-dumbSched`**,
Xorg's switch for reading input on the main loop, because Xorg normally reads input on a
thread of its own and, when SchOS had no threads, the server crashed the first time a client
disconnected, in `pthread_join` on a thread that was never made. Threads exist now and the switch
is gone: under QEMU, X starts with Window Maker, `xclock` and `xeyes` connect and disconnect, an
`xterm` runs and exits, and the server stays up.
- **`/root/.xinitrc`** is `exec wmaker`. Without it xinit falls back to twm and an xterm, which
are not in the image.
- **`/etc/X11/xorg.conf.d/10-schos.conf`** names the input devices. Alpine's Xorg asks udev for

View file

@ -97,12 +97,12 @@ 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; when SchOS had no threads
# 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. SchOS has threads now (clone, futex), so this may
# no longer be needed -- it has simply not been tried without it. The file is
# How startx starts the X server for root: Alpine's xserverrc. (It used to add
# -dumbSched, Xorg's switch for reading input on the main loop, because when SchOS
# had no threads the server crashed on its way out the first time a client
# disconnected, in pthread_join on a thread that was never made. SchOS has threads
# now; X was run without the switch under QEMU -- clients connecting and
# disconnecting, an xterm starting and exiting -- and it stays up.) The file is
# root's own rather than /etc/X11/xinit/xserverrc, which belongs to the xinit
# package.
mkdir -p "$P/root"
@ -111,7 +111,7 @@ cat > "$P/root/.xserverrc" <<'XEOF'
# The VT X runs on is the one startx was started from. startx works that out
# only when `uname -s` says Linux, and SchOS's says SchIFT.
vt=$(tty | sed -n 's|^/dev/tty\([0-9][0-9]*\)$|vt\1|p')
exec /usr/bin/X -nolisten tcp -dumbSched $vt "$@"
exec /usr/bin/X -nolisten tcp $vt "$@"
XEOF
# What startx runs inside it: Window Maker, which world installs. Without this