11 Commits
Author SHA1 Message Date
lotherkandClaude Sonnet 5.5 73c9de51a6 licence: the CNCL line in every file Makronix wrote (tools, docs, www, mobile, top level)
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>
2026-11-14 11:50:26 +00:00
lotherkandClaude Opus 5.5 cc4c76c10f Makronix/Linux: df by the normal build; NetBSD's statvfs over statfs and mountinfo
libmxlinux carries NetBSD's statvfs(2) family -- statvfs, fstatvfs,
statvfs1, fstatvfs1, getvfsstat, getmntinfo -- for a Linux kernel: the
numbers from statfs(2), the names NetBSD keeps in its mount structure
(f_fstypename, f_mntonname, f_mntfromname) from /proc/self/mountinfo,
matched exactly by statx(2)'s STATX_MNT_ID.  Linux ST_* flags become
MNT_*; MNT_LOCAL unless the type is a network file system, MNT_ROOTFS
for "/", MNT_IGNORE for mounts without blocks (proc, sysfs, cgroup ...),
which NetBSD's df would otherwise list.

Headers, reached over: <sys/statvfs.h> in front of glibc's (NetBSD's
struct; its functions are renamed __statvfs90 ..., so they never meet
glibc's), <sys/fstypes.h> with NetBSD's fsid_t renamed in place (it is
not glibc's struct), a <machine/ansi.h> that needs nothing on glibc, and
a <sys/mount.h> that keeps glibc's underneath (#include_next) and adds
fstypes, statvfs and MNAMELEN (mount.h:63) as NetBSD's does.

Measured under qemu-aarch64: df -h lists the host's mounts with the
numbers GNU df gives for /, /boot, /boot/efi, /run; -i, -l, -k work.
(/dev and /tmp show the root's numbers there because qemu's -L redirects
those paths into the sysroot's own directories.)  28 of 34 programs of
src/bin build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 08:53:53 +00:00
lotherkandClaude Opus 5.5 86ae867ea6 Makronix/Linux: ksh, ed, dd, pax by the normal build; libcrypt, librmt
27 of the 34 programs of src/bin build now.  New libraries by the same
normal build: lib/libcrypt (NetBSD's crypt: DES, MD5, blowfish, sha1,
argon2 -- glibc 2.44 has no libcrypt) and lib/librmt.

libmxlinux, NetBSD's own sources: md5c, sha1, sha2 (with <md5.h>,
<sha1.h>, <sha2.h> and their <sys/...> names, as sys/sys/Makefile:57-61
installs them), explicit_memset, strsuftoll, fparseln.  fts.c and
fparseln.c take their own portable branch (HAVE_NBTOOL_CONFIG_H with an
empty config in portable/, which only they see).  Ours: fgetln over
getline, fchroot (fchdir + chroot(".")), sysctl's hw.* subtree from
sysconf/uname (ncpu, pagesize, physmem64/usermem64 -- argon2 sizes itself
by it).  mxlinux.h: CLK_TCK as NetBSD's __sysconf(39), O_DIRECT,
O_SHLOCK/O_EXLOCK/O_ALT_IO/O_NOSIGPIPE as 0 (no Linux counterpart; ksh's
history opens without its lock), _PASSWORD_*, des_*, pwcache_*db,
UID_MAX/GID_MAX, _PATH_DEFTAPE /dev/nst0.  <rmt.h> is read without
NetBSD's ssp layer; glibc fortifies read(2) itself.

mx_termios.h no longer includes <sys/ioctl.h>: forced into every compile
it exposed TIOCSTI to ksh's emacs.c:1309, which compiles only where that
is hidden (it names an undefined TTY), as on NetBSD.

Measured under qemu-aarch64 -L build/mxsysroot-hotdogb: crypt(3) gives
abJnggxhB/yWI for DES, the openssl MD5 hash, and openwall's $2a$05$
U*U vector; pax writes ustar that GNU tar extracts to the same tree and
extracts GNU tar's archive with modes, mtimes and symlinks; ksh
arithmetic and arrays, ed s///+w, dd copy/skip work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 08:50:56 +00:00
lotherkandClaude Opus 5.5 b18945f578 Makronix/Linux: NetBSD's /bin/sh, libedit and libterminfo by the normal build
make src DIR=lib/libterminfo, lib/libedit, share/terminfo, bin/sh: the
"includes" pass first as in build.sh (curses.h, term.h), terminfo.cdb
compiled by the tooldir's nbtic, libraries into /lib (USE_SHLIBDIR).

libmxlinux, NetBSD's own sources reached over: cdb(3) (cdbr, cdbw,
mi_vector_hash) for terminfo.cdb.  Headers: <sys/endian.h> (glibc's
<endian.h> plus NetBSD's encoders/decoders, endian.h:190-230 -- NetBSD's
whole header would turn ntohl into a macro under glibc's prototypes),
<sys/bitops.h>, <sys/cdbr.h>/<cdbr.h> (sys/sys/Makefile:54),
<cdbw.h>, <sys/stdint.h>, and a <sys/sysctl.h> with NetBSD's MIB numbers
(the real one pulls in sys/proc.h and UVM).  Ours at the kernel boundary:
sysctl(3) answering the user.* subtree as NetBSD's libc does
(sysctl.c:106) from confstr/sysconf -- sh asks user.cs_path;
fcntl F_MAXFD/F_CLOSEM (as 10/11 they are F_SETSIG/F_GETSIG to Linux, so
they get unknown values and never reach the kernel), funopen/funopen2
over fopencookie, setproctitle via PR_SET_NAME, issetugid from AT_SECURE.
mxlinux.h: BSD/BSD4_3/BSD4_4 (sys/param.h:49-51; sh includes <sys/wait.h>
only #ifdef BSD), __va_list, <string.h> as NetBSD's <strings.h> has it,
<stddef.h>, dup3; mx_termios.h: TCSASOFT 0 (any other value makes Linux's
tcsetattr fail).

src/lib/libedit/config.h: HAVE_STRUCT_DIRENT_D_NAMLEN only without
__GLIBC__ -- libedit's own portable branch, its autoconf answer for glibc.

Measured: sh runs under qemu-aarch64 -L build/mxsysroot-hotdogb
(functions, arithmetic, command substitution, kill -l, trap ... INFO with
kill -INFO); the port tests of cat chmod cp echo ln ls mkdir mv rm rmdir
test kill pass with this sh as their interpreter; expr's "lang" case
reports that the sysroot has no glibc locales (sh's own setlocale
message, var.c:1948).  23 of 34 programs of src/bin build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 08:41:27 +00:00
lotherkandClaude Opus 5.5 4c89941778 Makronix/Linux: src/bin by NetBSD's normal build, libmxlinux from NetBSD's own sources
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>
2026-11-12 08:21:44 +00:00
lotherkandClaude Opus 5.5 b2de49bb97 Makronix/Linux: our own sysroot -- our kernel's headers and glibc 2.44
Void is dropped (Konrad, 2026-11-11): src/ first, then pkgsrc recipes, then
LFS-style from upstream for what neither has; the whole system under our
control, the phone first, a desktop variant on the Linux kernel later.
docs/NETBSD-USERLAND.md has the new goal and phase L (the base from our own
parts, replacing phase D).

L1: make mxheaders -- headers_install of our kernel tree (7.0.14) into
build/mxsysroot-<dev>, with the usr-merged links.
L2: make glibc -- ext/src/glibc/mx/Makefile, LFS's cross "Glibc" recipe,
compiled with the tooldir's gcc 14.4.0 of src/; host tools borrowed for now:
GNU make >= 4.0, python3, bison, gawk.

Measured: glibc 2.44 built and installed (mkglibc exit=0,
build/logs/glibc-2026-11-11.log; .comment GCC: (NetBSD nb4 20260926)
14.4.0); a C program linked only against it runs under qemu with
build/mxsysroot-hotdogb as its root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 23:00:38 +00:00
lotherkandClaude Opus 5.5 5187ae1a8e mobile: A7 -- the NetBSD userland goes into the phone's image
tools/lib.sh userland_stage stages build/userland/<dev>/destdir (without
METALOG) and our libstdc++.so.6.0.33 + libgcc_s.so.1 (stripped, from the
tooldir), and refuses a program whose port is not "state: done";
assemble-rootfs.sh lays it over the Void packages, before base/ and soc/.
make roottar / rootimg / update-root carry it from now on.

On the phone (/system/current since 2026-11-11): cat, sleep, kill, env, test,
wc, ln, head, tee ... are NetBSD's (gcc 14.4.0 of src/), libstdc++.so.6 is
ours, kill -INFO makes sleep answer, WLAN/battery/all 20 services up.

Bluetooth, A/B on the same phone (build/logs/ab-bt-{new,old}-2026-11-11.log):
NetBSD userland 4/5, the tree before 3/5 -- every failure is the kernel's
"QCA TLV response size mismatch" retry, with either userland; not A7.  Since
the kernel moved to 7.0.14 it fails in about 3 boots of 10 (7.0.0: 1 of 15,
bt-flush-2026-11-10.log), and bt-address's re-probe then hangs in the kernel
(qca_serdev_remove -> flush_work, D state): a kernel matter, open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 19:14:48 +00:00
lotherkandClaude Opus 5.5 081646b002 mobile: userland: libmxlinux, and SIGINFO is SIGPWR system-wide
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>
2026-11-11 18:35:19 +00:00
lotherkandClaude Opus 5.5 f0f267eadf mobile: the phone's toolchain from src/ -- build.sh tools for aarch64-linux-gnu
make tooldir runs build.sh tools unchanged with -m evbarm64, the phone's
sysroot as -D, and -V MACHINE_GNU_PLATFORM=aarch64-linux-gnu (bsd.own.mk:1065
sets it with ?=): gcc 14.4.0 and binutils 2.46.0 of src/external/gpl3,
configured as NetBSD configures its own (c c++ objc fortran, no Ada), plus
nbmake, nbmtree, install for the host -- the phone no longer borrows the
desktop's tooldir nor Debian's cross compiler.

make targetlibs does what NetBSD does with its own Makefiles, and meets four
NetBSD particulars (PORTING-USERLAND.md section 8): gcc's headers are not
copied by NetBSD's gcc (Makefile.in:3308 "if false"); -DNETBSD_TOOLS needs
the -B/-L of src/tools/gcc/Makefile:162; the libstdc++ import has no "src"
in SUBDIRS and no po/; NetBSD's locale_facets_nonio.h:339 needs a locale
model glibc's "gnu" one is not -- libstdc++ uses "generic" (a finding).

The frame (mxmake.sh, mktoolchain.sh, mxcheck.sh) uses the tooldir's gcc,
binutils and make.  Measured: C and C++ run under qemu against the phone's
glibc 2.41 with libstdc++.so.6.0.33; all 28 ports rebuilt with it pass
28/28 under qemu and on the phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 18:12:15 +00:00
lotherkandClaude Opus 5.5 0d4901af1e mobile: the frame for porting src/ programs to the phone
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>
2026-11-11 17:07:07 +00:00
lotherkandClaude Opus 5.5 dd7c192079 mobile: plan for Makronix on a Linux kernel (NetBSD userland, rc, pkgsrc)
docs/NETBSD-USERLAND.md cuts Konrad's goal of 2026-11-11 ("use as much as
possible from our makronix/netbsd source on top of the linux kernel") into
items for parallel agents: the frame (sysroot, toolchain, libnbcompat for
aarch64, mobile/userland/), libmxlinux for the BSD interfaces Linux lacks,
the programs in tiers by a scan of their sources, NetBSD rc instead of
runit, Void removed piece by piece, pkgsrc cross Linux->Linux to /usr/pkg.
It rests on what is measured: build.sh already builds ~70 NetBSD programs
for this Linux host through src/tools/compat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:06:26 +00:00