Commit Graph
14 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 Sonnet 5.5 945b993f96 AGENTS.md under mobile/: 1797 -> 617 lines, checked against the tree (patches 0001-0026, no void sysroot, make src); the old texts in docs/reference
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-13 14:26:16 +00:00
lotherkandClaude Opus 5.5 315cf540c3 Makronix/Linux: src/ builds for Linux with NetBSD's own build and a mk.conf
The toolchain and sysroot are ours now in LFS's order (Makefile: mxheaders
-> tooldir -> sysroot (glibc) -> targetlibs -> toolchain); the Void-made
sysroot (tools/mksysroot.sh, base/void/sysroot-packages) is gone, the
frame points at build/mxsysroot-<dev>.

conf/mk.conf: what NetBSD's build needs to build src/ for a Linux target,
as MAKECONF, nothing changed in src/: the sysroot's library directories
for the -DNETBSD_TOOLS gcc (as src/tools/gcc/Makefile:162 does), and the
start files -- glibc's Scrt1/crti/crtn, gcc's crtbegin/crtend -- through
the ?= of bsd.gcc.mk and bsd.prog.mk.  With it, src/lib/libz builds
unchanged with bsd.lib.mk through the tooldir's nbmake-evbarm64:
libz.so.1 (soname as on NetBSD), NEEDED only libc.so.6 and
ld-linux-aarch64.so.1, its symbol check against NetBSD's list empty.

Open: programs (bin/cat) need NetBSD's header additions (cdefs,
setprogname): libmxlinux and libnbcompat through the same mk.conf.
make userland (the port frame) waits for libz in the sysroot: libnbcompat's
configure requires zlib.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 02:54:24 +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
lotherk 544ad0b4a8 mobile: system and data apart on userdata (task B)
/system/current holds the system, /data the state that survives an update
(docs/NEXT.md §6, Konrad: "it sucks that with an update we have to configure
everything").  base/initramfs/init mounts the partition once and sets up:

  /            bind of /system/current
  /home /root /var/lib   binds of /data/...
  /etc         overlay: lower = the system's /etc, upper = /data/etc/upper
  /data /system          binds, so the system sees them

An image without /system/current (before 2026-11-09) is still mounted as the
whole partition -- measured on the phone: "layout: whole partition (image
without /system/current)", switch_root at 1.45 s.

Measured on the host (2026-11-09): the mount sequence works; a /etc write
lands in /data/etc/upper; remount,ro on the bind flips the whole file
system (so Void's stage 1 fsck still checks the partition) and remount,rw
undoes it; /proc/mounts names the device for /, so 03-grow-root.sh keeps
working.  The partition mount cannot be moved into the new root -- the
target lies inside the source (the bind makes it so) -- so it stays at
/sysroot.real without a path after switch_root; the overlay and the binds
hold it.

Kernel: CONFIG_OVERLAY_FS=y (was m; the initramfs loads no modules).

tools/mkrootimg.sh writes /system/current/ and keeps /data out of the
image; the tree assembly is tools/assemble-rootfs.sh, shared with the new
tools/mkroottar.sh (make roottar) and tools/update-root.sh (make
update-root VERSION=...; unpack into /system/<v>, rename current, /data
untouched).  update-root is written and syntax-checked, not yet measured.

Initramfs pin renewed: 6d1bd30b2a6fd815 (4950e286679ca4fa before).

Measured on the phone (hotdogb, 2026-11-09): flash-root of the new image,
first boot creates /data and copies /var/lib and /root, file system grown
to 96 GiB; after restoring the phone's /etc/NetworkManager, /etc/ssh and
/var/lib state into /data: WLAN reconnects with the saved profile
(192.168.1.127), the ssh host key is the old one, rtc-offset and the clock
survive a reboot, upper has the profile, the keys and runit's supervise
dirs.
2026-11-09 23:12:26 +00:00
lotherkandClaude Opus 5.5 45125223af mobile: hotdogb stable WLAN address; display test tools
- wlan-address (udev) and NetworkManager's conf.d: a WLAN address derived
  from the serial number, kept across boots.  With a random one per boot
  the router's DHCP pool ran out after a day of test boots; with it the
  phone got its lease at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:34:34 +00:00
lotherkandClaude Opus 5.5 7cb8370e98 mobile: hotdogb "switched off" explained: power key, and a hang when the modem stops under ath10k
- elogind: a short press on the power key no longer powers the phone off
  (base/void/rootfs, logind.conf.d).
- runit stage 3: ath10k is unloaded before rmtfs stops the modem; with it
  loaded the system hung after "stopped remote processor modem" and the
  watchdog left it in crash-dump mode (05c6:900e).
- kernel/patches/0018: qcom_scm clears the bootloader's download-mode bit.

Measured: reboot-mode bootloader with WLAN connected reaches fastboot in
12 s; make flash end to end on 7.0.0-sm8150-g6b20b1b06323, WLAN
reconnects by itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:25:37 +00:00
lotherkandClaude Opus 5.5 4ea31d69c1 mobile: hotdogb modem, WLAN, charger and fuel gauge
- kernel/patches 0014-0016: ath10k keeps the WCN powered from probe
  (qcom,keep-powered); the modem with its firmware from the phone's
  partition, WLAN, rmtfs outside the TZ region; charger and the bq27411
  fuel gauge.
- firmware-partitions maps the modem partition too;
  /usr/lib/firmware/qcom/sm8150/partitions links there for tqftpserv.
- wlan-board and ath10k-board: the phone's own WLAN board data from
  persist, as board-2.bin under /run, before ath10k loads.
- qcom_pd_mapper in stage 1, so the modem's WLAN domain starts.
- base/void: rmtfs, tqftpserv (services), linux-firmware-network.

Measured: wlan0 up, a scan finds 12 networks, Bluetooth alongside, the
charger charges, the gauge reads 4.433 V / 100 %.  Open: the display
white in some boots, and one sysrq reboot that ended switched off
(devices/hotdogb/AGENTS.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:17:42 +00:00
lotherkandClaude Opus 5.5 68c3b65b20 mobile: hotdogb Bluetooth, firmware from the phone's own partitions
- kernel/patches/0013: WCN3998 on uart13 in the DTS.
- firmware-partitions (soc/sm8150/rootfs, stage 1 before udev): mounts the
  partitions /etc/makronix/firmware-partitions names, of the active slot,
  read-only under /run and puts them first in firmware_class.path; the
  vendor's signed firmware stays on the phone and out of our images.
- bt-address (udev rule): a stable, locally administered address from the
  serial number for a controller that has none.
- base/void: bluez, bluetoothd.

Measured: firmware loaded from bluetooth_a, setup complete at 3.3 s, the
same address after a reboot, a scan finds 14 devices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:21:21 +00:00
lotherkandClaude Opus 5.5 d29094e24f mobile: our initramfs replaces pmOS's in the boot image
- base/initramfs/init builds the gadget with NCM and ACM at once: the root's
  stage 1 no longer rebinds it, so the host keeps its link and address and
  netconsole runs from 1.5 s.
- The root grows itself online to its partition
  (base/void/rootfs/.../03-grow-root.sh), which the pmOS initramfs did;
  tools/mkrootimg.sh copies base/<base>/rootfs/ before the SoC's files.
- tools/build-busybox.sh: SOURCE_DATE_EPOCH of the pinned source, so the
  initramfs is reproducible; pinned in device.conf (4950e286679ca4fa).
- Makefile: INITRAMFS defaults to ours; bootimg checks the pins after the
  inputs are built.

Measured on hotdogb: switch_root at 1.27 s (pmOS: about 3.5 s), a fresh
root grown from 281468 to 25493504 blocks, 10 of 10 warm reboots, no
WARNING, make flash end to end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:45:42 +00:00
lotherkandClaude Opus 5.5 b9c0affdb8 mobile: hotdogb stable state: msm built in, display warnings fixed, self-flashing, serial console
Kernel (7.0.0-sm8150-g1299aab93171):
- msm DRM built in again: up at 0.6-0.8 s instead of 4.2 s, safe since
  0003 and 0004.
- 0005: CLK_OPS_PARENT_ENABLE on the pixel RCGs (as sdm845): "rcg didn't
  update its configuration" is gone.
- 0006: dsi_err_worker reported every error as status=4, a FIFO error
  that was none (lane FIFOs empty) and hid the ACK error (bit 0); it now
  reads status=40 ack_err=..., the panel's report on the first read after
  the takeover.
- ftrace (dynamic, function_graph), Landlock.

Without a button: the DTB gets the PON's mode-bootloader/mode-recovery
(fdtput on the pinned binary until the DTS moves in; new pin), Void gets
reboot-mode(1) and a runit stage-3 hook that restarts with the mode
(base/reboot2.c, built static by mkrootimg.sh).  flash.sh and
flash-root.sh reboot a running phone into fastboot themselves and wait for
ABL without ever cutting a command off or resetting the device -- two
usbresets after the userdata flash crashed it into 05c6:900e.  Writing the
fallback slot no longer makes it active.

Access: dnsmasq (DHCP only) on usb0, so the host keeps 172.16.42.2 after
the initramfs; an ACM function next to NCM with the kernel console and a
login on ttyGS0; phone_addr falls back to IPv6 link-local;
tools/reboot-loop.sh for boot races.  zram swap (half the RAM, zstd).

Measured: 20 of 20 warm reboots reachable; the self-flash
(build/logs/selfflash3-2026-11-08.log).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 09:52:05 +00:00
lotherkandClaude Opus 5.5 c134e25c2b mobile: our initramfs (own busybox), display-init defect measured
base/initramfs/init (POSIX sh) and a static busybox built from pinned
upstream source (tools/build-busybox.sh), packed by tools/mkinitramfs.sh:
USB NCM + DHCP lease, root=UUID= read-only, switch_root, telnetd rescue.
Not yet booted.  mkbootimg.sh appends root=UUID= and takes EXTRA_CMDLINE for
test images; the pmOS initramfs pin is retired.

Measured on hotdogb: the pinned kernel is fine -- with
initcall_blacklist=msm_drm_register it boots to Void.  msm DRM with the
panel handoff garbles the panel and blocks the boot for every boot image
but the baseline one (devices/hotdogb/AGENTS.md has the table).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 12:46:37 +00:00
lotherkandClaude Opus 5.5 0cf14ec379 mobile: root image on userdata, Void (runit) boots on hotdogb
tools/mkrootimg.sh makes an ext4 image with the device's ROOT_UUID from the
base's rootfs tar, the kernel modules, fstab, a usb0 profile and the root
password (ROOT_PASSWORD, default makronix); tools/flash-root.sh writes it to
ROOT_PARTITION (userdata).  mkbootimg.sh appends pmos_root_uuid=$ROOT_UUID;
the pmOS UUIDs left the cmdline.  BASE defaults to void.

Measured: Void reaches "void login:" with runit, sshd and NetworkManager, with
the baseline kernel on slot a.  The pinned kernel tree's build garbles the
display and does not reach the initramfs (devices/hotdogb/AGENTS.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:30:02 +00:00
lotherkandClaude Sonnet 5.5 26258166df mobile: kernel as pin + patches, glibc base (Debian and Void rootfs)
kernel/PIN and kernel/patches replace the external kernel tree: make linux
fetches the pinned commit and applies the patches (source tree identical to
the one that runs on the phone). base/debian and base/void build a glibc
aarch64 root file system without root (mmdebstrap / unshare + xbps).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 11:03:38 +00:00