The phone's userland is NetBSD's own source built with NetBSD's build against glibc, and more and more of src/ asks for libc symbols glibc does not have, so libmxlinux takes them over from the same tree: db(3) (Berkeley DB 1.85, which glibc dropped), md2/md4/rmd160 and the *File/*End helpers the hash tools link, glob(3) (renamed __glob30, so beside glibc's), stringlist, errc/warnc, fmtcheck, shquote, getcap, strtonum, heapsort/merge/radixsort, base64, stresep, and the <db.h>/<md2.h>/<ndbm.h>/<stringlist.h> frames that reach over to src/include. -mx_cdefs.h: __strong_alias/__weak_alias stay off inside libmxlinux (-D_MX_LIBMXLINUX). The libc sources it compiles alias their public names to libc-internal ones in hashhl.c before namespace.h can withdraw the macro, and those names do not exist outside libc -- every program linked against the library had undefined _MD2FileChunk. src/tools/compat builds the same sources without them for the same reason. -mxlinux.h: the feature set is asked for the way NetBSD's <sys/featuretest.h> asks for it. A program with -std=c99 alone asks for no standard, which on NetBSD means _NETBSD_SOURCE (everything); glibc gives ISO C only, so _DEFAULT_SOURCE and _NETBSD_SOURCE are set before the first glibc header. -mobile/conf/mk.conf: the NetBSD subsystems with a NetBSD kernel underneath are off for a Linux target -- MKAUDIO, MKBLUETOOTH, MKUSB, MKNFS, MKYP, MKHESIOD, MKSKEY, MKKERBEROS, MKPAM -- and libpthread is glibc's (LIBDO.pthread=_external), not NetBSD's LWP threads. -mobile/tools/mxsrc.sh: USE_FILEMON=no on the command line, because make(1) decides on filemon before bsd.own.mk reads mk.conf and traces with ktrace(2)/filemon(4), which Linux has neither of. Measured: make src DIR=lib/libmxlinux -> mxsrc lib/libmxlinux exit=0, 0 errors (mobile/build/logs/mxsrc-libmxlinux-2026-11-12-b.log).
78 lines
3.5 KiB
Plaintext
78 lines
3.5 KiB
Plaintext
# mk.conf -- make(1) configuration for building src/ for a Makronix/Linux
|
|
# target (MAKECONF), with the tooldir of tools/mktooldir.sh.
|
|
#
|
|
# The tooldir's gcc is built with -DNETBSD_TOOLS, which drops the sysroot's
|
|
# library directories from its startfile search (gcc.cc:8605,8615); for a
|
|
# NetBSD target gcc's netbsd.h specs name them, for Linux nothing does.
|
|
# NetBSD's own build names them for its .native gcc
|
|
# (src/tools/gcc/Makefile:162, CCADDFLAGS); the same for every link here.
|
|
LDFLAGS+= -B${DESTDIR}/usr/lib/ -L${DESTDIR}/usr/lib
|
|
|
|
# Start files. NetBSD links its own (lib/csu: crt0.o, and gcc's crtbegin
|
|
# out of ${DESTDIR}/usr/lib); on Linux crti.o/crtn.o and Scrt1.o are
|
|
# glibc's (in DESTDIR), crtbegin*.o/crtend*.o gcc's (in the tooldir). All
|
|
# are ?= in src/share/mk/bsd.gcc.mk:6-12 and bsd.prog.mk:61-73.
|
|
_MX_GCCVER!= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc -dumpversion
|
|
_GCC_CRTDIR= ${TOOLDIR}/lib/gcc/${MACHINE_GNU_PLATFORM}/${_MX_GCCVER}
|
|
_GCC_CRTBEGIN= ${_GCC_CRTDIR}/crtbegin.o
|
|
_GCC_CRTBEGINS= ${_GCC_CRTDIR}/crtbeginS.o
|
|
_GCC_CRTEND= ${_GCC_CRTDIR}/crtend.o
|
|
_GCC_CRTENDS= ${_GCC_CRTDIR}/crtendS.o
|
|
LIBCRT0= ${DESTDIR}/usr/lib/Scrt1.o
|
|
|
|
# NetBSD's header additions and libc functions glibc lacks: libmxlinux
|
|
# (src/lib/libmxlinux), its header forced into every compile, its include/
|
|
# (<sys/acl.h>, <sys/extattr.h>) on the path, the library
|
|
# into every program's link -- not into its own.
|
|
CPPFLAGS+= -include ${NETBSDSRCDIR}/lib/libmxlinux/mxlinux.h \
|
|
-I${NETBSDSRCDIR}/lib/libmxlinux/include
|
|
.if !defined(LIB) || ${LIB} != "mxlinux"
|
|
LDADD+= -lmxlinux
|
|
.endif
|
|
|
|
# bsd.sys.mk:88 adds -Wsystem-headers for gcc: NetBSD's headers are clean
|
|
# under it, glibc's are not (bits/stdio2.h, -Wformat-nonliteral in the
|
|
# fortify wrappers; build/logs/srcbin-2026-11-12.log). CPPFLAGS follow
|
|
# CFLAGS on the compile line, so this one wins.
|
|
CPPFLAGS+= -Wno-system-headers
|
|
|
|
# Warnings are not fatal for a Linux target (NOGCCERROR, share/mk/
|
|
# bsd.README:1974): -Werror is written against NetBSD's headers, and
|
|
# glibc's differ (warn_unused_result on write(2), unsigned types ...).
|
|
# 28 warnings in all of src/bin on 2026-11-12
|
|
# (build/logs/mxsrc-bin6-2026-11-12.log); when they are gone, so is this.
|
|
NOGCCERROR= yes
|
|
|
|
# No rump kernels: they are NetBSD's kernel in user space (RUMPPRG, dd's
|
|
# dd_rumpops.c; bsd.prog.mk:341,347), which a Linux target does not have.
|
|
MKRUMP= no
|
|
|
|
# NetBSD subsystems whose kernel side is NetBSD's own, off for a Linux
|
|
# target (mk.conf(5); defaults in share/mk/bsd.own.mk:1297-1378; used by
|
|
# usr.bin/Makefile:41-92 and the like):
|
|
# MKAUDIO audio(4)/mixer(4) ioctls -- Linux has ALSA
|
|
# MKBLUETOOTH NetBSD's Bluetooth stack (btconfig, sdpquery ...) -- the
|
|
# phone runs bluez for now (NETBSD-USERLAND.md L6)
|
|
# MKUSB usb(4) ioctls (usbhidctl ...)
|
|
# MKNFS NetBSD's NFS client/server ioctls and RPC tools
|
|
# MKYP, MKHESIOD NIS and Hesiod name services -- not used by Makronix
|
|
# MKSKEY S/Key one-time passwords -- not used
|
|
# MKKERBEROS, MKPAM Heimdal and OpenPAM: not yet built for this target;
|
|
# login/su/passwd use the plain password database meanwhile
|
|
MKAUDIO= no
|
|
MKBLUETOOTH= no
|
|
MKUSB= no
|
|
MKNFS= no
|
|
MKYP= no
|
|
MKHESIOD= no
|
|
MKSKEY= no
|
|
MKKERBEROS= no
|
|
MKPAM= no
|
|
|
|
# Libraries that are glibc's on a Linux target, not the NetBSD tree's:
|
|
# LIBDPLIBS (bsd.lib.mk:79) then links -l<lib> from the sysroot instead of
|
|
# the object directory of src/lib/<lib> -- bsd.README:1123, "_external".
|
|
# libpthread is NetBSD's threads on its LWP system calls; glibc's threads
|
|
# are in libc.so.6 (libpthread.so.0 for old binaries). (liblzma, 2026-11-12)
|
|
LIBDO.pthread= _external
|