consmirror.c: the BSD notice is replaced (Makronix's own file). Files with
changes of other sessions pending are left for their commit.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
make src DIR=<dir> (mobile/tools/mxsrc.sh) runs the tooldir's
nbmake-evbarm64 in src/<dir> with MAKECONF=mobile/conf/mk.conf and the
sysroot as DESTDIR, objects in build/tools-obj, "obj" first.
libmxlinux grows into what NetBSD's libc and libutil have and glibc
lacks, from NetBSD's own sources reached over by .PATH: vis/unvis,
strmode, setmode, pwcache, reallocarr, strtoi/strtou (BCS_ONLY), fts (its
<fts.h> in front of glibc's; renamed symbols, so the two never meet),
acl(3) (posix1e), extattr(3), and libutil's efun, parsedate,
raise_default_signal, stat_flags, strpct, snprintb. Ours only at the
kernel boundary: extattr onto Linux xattr(7) (user. and trusted.), the
__acl_* calls (EOPNOTSUPP; _PC_ACL_* get values glibc answers EINVAL to),
chflags/undelete (EOPNOTSUPP), lchmod (a link has no mode on Linux),
lpathconf, setpassent, the timezone_t API over TZ (mx_tz.c), sys_siglist.
include/ reaches over <fts.h>, <util.h>, <vis.h>, <tzfile.h>,
<sys/acl.h>, <sys/extattr.h>. stty's mx_termios.h moves here and serves
every program; the old port frame keeps its per-port shims behind
-DMX_PORT_FRAME until they are gone.
libnbcompat is out of the normal build again: its setmode is the host
tools' octal-only stub (src/tools/compat/getmode.c:37), so chmod u+x set
mode 0. mk.conf: NOGCCERROR (28 warnings left in src/bin),
-Wno-system-headers (glibc's fortify headers), MKRUMP=no.
Found on the way: NetBSD's __used macro deleted a member of glibc's
regex_t (<regex.h>:410 pastes "__used") and of posix_spawnattr_t
(<spawn.h>:47); regex_t shrank from 64 to 56 bytes and expr's regexec
read garbage. mxlinux.h now includes both headers before mx_cdefs.h.
Measured: 22 of 34 programs of src/bin build
(mobile/build/logs/mxsrc-bin6-2026-11-12.log); the 18 with a port test
pass all of them under qemu-aarch64 -L build/mxsysroot-hotdogb: cat chmod
cp echo expr hostname kill ln ls mkdir mv pwd rm rmdir sleep stty sync
test. The old frame still builds cat, stty, test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
consmirror (userland/consmirror, a program of Makronix's own built through
the port frame with MX_LOCALSRC) reads the text console from /dev/vcsu1 and
/dev/vcsa1, woken by POLLPRI on every change, and writes it to the USB
serial gadget ttyGS0 as ANSI; what is typed there goes back into the
console through a uinput keyboard. Under X the virtual terminal is not
written, so nothing is mirrored, as asked. Test 3/3 PASS under qemu.
It replaces the agetty on ttyGS0 (runit service consmirror instead of
agetty-ttyGS0), and the kernel no longer writes its messages there itself:
console=ttyGS0 is gone from the cmdline, they reach the serial line through
the mirror of tty0, green as on the display.
userland_stage leaves a program whose port is not done out of the image
instead of failing (another agent may be building it); userland-test.sh
knows MX_LOCALSRC ports.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libmxlinux moves from mobile/userland/lib/mxlinux into src/lib/libmxlinux
with a NetBSD library Makefile (LIB=mxlinux, bsd.lib.mk, shlib_version),
so NetBSD's build makes libmxlinux.so.0 for a Linux target like any other
library of src/. mx_cdefs.h carries the <sys/cdefs.h> additions glibc
lacks, namespace.h stands in for libc's (no __weak_alias on glibc),
mx_progname.c gives getprogname/setprogname, mxlinux.h gains _DIAGASSERT.
mobile/conf/mk.conf forces mxlinux.h into every compile and links
-lmxlinux. The old port frame builds the same sources from there
(mobile/build/logs/userland-cat-2026-11-12.log: cat built, mxcheck ok).
The sysroot steps that were done by hand are in the tools now:
- mkmxheaders.sh installs only the kernel headers (the tooldir's gcc needs
nothing else, and nbmtree does not exist yet);
- mkglibc.sh lays down NetBSD's hierarchy with nbmtree from
NetBSD.dist.base + .aarch64 (1480 directories), installs glibc, and links
the dynamic linker as /lib/ld-linux-aarch64.so.1 and /libexec/ld.elf_so,
the interpreter bsd.prog.mk:69,286 writes into every program;
- mktargetlibs.sh installs libgcc_s.so.1 and libstdc++.so.6 into the
sysroot's /usr/lib.
Measured: src/bin/cat built by nbmake-evbarm64 with this mk.conf (NEEDED
libmxlinux.so.0, libgcc_s.so.1, libc.so.6; interpreter /libexec/ld.elf_so)
passes userland/cat/test.sh 5/5 under qemu-aarch64 -L mxsysroot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/tools/Makefile.host undefines LINKS (its programs are host tools), so
mk/mx.prog.mk reads them from the program's own Makefile beforehand
(make -V '${LINKS}'), maps them onto Void's layout like HOST_BINDIR and
makes hard links after install.host, as NetBSD's install does. /usr/bin/[
is test's inode now. userland_stage accepts a LINKS name as a hard link of
a done port's program. Clean rebuild 28/28, tests 28/28 under qemu
(build/logs/make-userland-links-2026-11-11.log); grep, id, pax, hexdump
... get theirs when they are ported.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
userland/lib/mxlinux: what NetBSD's headers and libc have and glibc lacks,
in one place instead of per port. NetBSD's own sources where they run on
glibc unchanged (getopt, signalname/signalnumber/signalnext,
humanize_number, dehumanize_number, getbsize), ours where Linux's view is
needed (sys_signame from sigabbrev_np, fgetwln, LC_C_LOCALE);
include/mxlinux.h with the NetBSD header line each item stands in for.
The frame forces nbtool_config.h and mxlinux.h into every port and links
libmxlinux.a ahead of libc, so every program gets NetBSD's getopt (glibc's
permutes argv: env -i A=1 failed). SIGINFO is SIGPWR on Makronix,
system-wide (Konrad, 2026-11-11), named INFO in sys_signame: kill -INFO
makes sleep print NetBSD's "Between 2 and 3 seconds left".
The ports shrink to what is theirs: 23 are two lines again; stty keeps its
termios names, sleep -lm, fold _XOPEN_SOURCE, dirname MAN=. Clean rebuild
28/28, no warning; tests 28/28 under qemu and on the phone
(build/logs/userland-{qemu,phone}-mxlinux-2026-11-11.log).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
basename comm dirname echo env fold head hostname kill ln logname nice nohup
paste printenv pwd rev rmdir sleep stty sync tee test tty uniq wc yes, ported
by four opencode agents (deepseek-v4.1-flash) along docs/PORTING-USERLAND.md,
checked and rebuilt here with the toolchain of src/. src/ is unchanged;
what glibc lacks is carried per port and documented with the compiler error
it fixes (kill: sys_signame from sigabbrev_np; stty: NetBSD's termios names
and baud-rate codes; test: timespeccmp; sleep: timespecadd/sub, LC_C_LOCALE,
SIGINFO as SIGPWR; rev: fgetwln) -- libmxlinux material once shared.
Each test.sh carries NetBSD's own src/tests cases where they exist plus the
man page's; 28/28 suites (with cat) pass under qemu and on the phone
(7.0.14-makronix-unstable; build/logs/userland-{qemu,phone}-all-2026-11-11.log).
"[" is not installed yet (Makefile.host undefines LINKS).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/bin/cat unchanged, built by the frame for aarch64 Linux. NetBSD's
t_cat.sh cases (align, nonexistent, se_output) with their data plus two of
the man page pass 5/5 under qemu and on the phone (7.0.14-makronix-unstable,
/tmp/userland-test/cat); it needs only libc.so.6 at versions the phone's
glibc 2.41 has. Not in the image yet (A7).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NetBSD's own host-program machinery, with the phone as the host: build.sh
builds nbcat, nbsed ... for a Linux build host with src/tools/Makefile.host
and libnbcompat; tools/mxmake.sh runs the same with HOST_CC = an aarch64
compiler whose glibc is the phone's.
- tools/mksysroot.sh: the Void rootfs + base/void/sysroot-packages headers
- tools/mktoolchain.sh: Debian's aarch64 gcc, glibc only from the sysroot
(--sysroot alone took Debian's glibc 2.42; the phone has 2.41)
- tools/mxmake.sh: the nbmake-<machine> of the phone (QEMU_LD_PREFIX lets
configure run its tests through binfmt; INSTALL and HOST_MKDEP overrides)
- userland/Makefile: mtree hierarchy, libnbcompat for aarch64, every port
found by its directory; make userland [PROG=x], make userland-test
- userland/mk/mx.prog.mk: two lines per port, Makefile.host unchanged
- tools/mxcheck.sh: no symbol version newer than the phone's libraries
- docs/PORTING-USERLAND.md: how to port one program, with the twelve
pitfalls met on the first one
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>