mikronix(8) — the system

Mikronix boots in four stages: the boot bootloader hands the machine to the kernel image /mnx, the kernel walks its GENERIC device table, attaches drivers through autoconf, mounts the root filesystem, starts /etc/rc, and hands the console to msh.

The boot chain

boot (flash 0x50000) -> /mnx (kernel ELF, rootfs 0x250000) start_kernel() console_init() register console0 setup_arch() board + CPU + flash parseargs() debug=, console=, drv* mm_init() heap, selftest autoconf_init() alldevs list mainbus_attach() cfdriver walk, probe/attach vfs_mount() / (mikrofs), /dev, /proc, /etc init_main() /etc/rc -> msh

The device model

Everything is a node in /dev, found by class, never by hard name: dev_lookup_class("led"). Drivers register fops and a class; the kernel names instances led0, i2c0, rtc0. Autoconf reports the chain NetBSD-style:

iic0 at mainbus0 rtc0 at iic0 addr 0x51 pmic0 at iic0 addr 0x34

The filesystem

MikroFS is the root: a small log-structured filesystem sized for one SPI-NOR flash, with zoneinfo data shipped as seed. On top: devfs, procfs, sysfs, etcfs, binfs, tmpfs. The fd layer is POSIX-shaped — open/read/write/close/dup2/fstat, per-open-file offsets, short reads at EOF.

Building

make userland # all programs (host + esp32) make kernel MACHINE=host make kernel MACHINE=esp32 BOARD=esp32-c6-amoled206 make rootfs # mikrofs image make boot # boot(8) loader

Acceptance is threefold: it builds, it flashes, the serial log shows the expected lines. A clean compile alone is not "working" — see docs/pitfalls.md.

Man pages

share/man/ carries man1 for userland, man8 for admin (boot(8), rc(8)), and man9 for the kernel (autoconf.9, driver.9, gpio.9, i2c.9, watchdog.9, tty.9, rtc.9, audio.9), written in mdoc, reference quality against the code.