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>
4.2 KiB
base/ -- the system layer under the userland
What it is for: the root file system's base (glibc) and the initramfs that
mounts it. The base is a bridge: the plan (docs/NETBSD-USERLAND.md, phase L)
is to replace it with our own parts -- src/, then pkgsrc, then LFS-style
recipes from upstream -- so keep what is here small.
What is in it:
void/-- the default (BASE ?= voidin../Makefile). Void's pinned aarch64 glibc ROOTFS plusvoid/packages, built bytools/mkrootfs-void.sh; runit services inbase.conf(VOID_SERVICES).void/rootfs/holds files for every device on Void, copied bytools/mkrootimg.shbefore the SoC's. Void's repository rolls; what was installed goes tobuild/rootfs-void-<device>.lock.debian/-- Debian stable, systemd, the alternative (BASE=debian), built bytools/mkrootfs-debian.shwith mmdebstrap.initramfs/--init(POSIX sh),busybox.conf(pinned source) andbusybox.config; the static busybox is built bytools/build-busybox.sh, packed bytools/mkinitramfs.sh(make initramfs). Nothing in it comes from a distribution (their busyboxes lack udhcpd, telnetd, mountpoint).reboot2.c-- restart with a reboot mode (fastboot); mkrootimg.sh builds it static with the device's cross compiler into/usr/libexec/makronix/reboot2.- The kernel is not the distribution's (
../kernel,tools/build-kernel.sh); its modules go into the root image bytools/mkrootimg.sh. - The userland is not the distribution's: pkgsrc in
/usr/pkg. A package belongs in<base>/packagesonly if the phone cannot work without it.
Build chain (from mobile/):
make rootfs BASE=void build/rootfs-void-<device>.tar
make rootimg BASE=void build/root-void-<device>.img (ext4, ROOT_UUID)
make bootimg the boot image; its cmdline names ROOT_UUID
make flash-root BASE=void fastboot flash the root partition (userdata)
make flash the boot image to the test slot
The root password is ROOT_PASSWORD (default makronix), valid on the console
and over ssh; do not remove it.
The initramfs
init brings up the USB gadget (NCM with 172.16.42.1 and a DHCP lease for the
host, ACM serial in the same configuration), finds the root by UUID
(root=UUID=), sets up the layout below and switch_roots. On any failure,
or with makronix.debug on the command line, it serves telnet 172.16.42.1
instead of halting. Its hash is pinned in device.conf
(INITRAMFS_SHA256_PREFIX); the build is reproducible (fixed mtimes,
SOURCE_DATE_EPOCH of the pinned source), so a change to init or the
busybox config means a new pin, with the measurement.
The root layout: system and data apart
The partition (userdata) holds the system and the state in two places, so an update of the system does not cost the configuration:
/system/current/ the system (tools/mkrootimg.sh writes it,
tools/update-root.sh puts a new tree beside it)
/data/ the state: home/ root/ var/lib/ etc/upper etc/work
When /system/current exists, init makes / a bind of it, /home, /root
and /var/lib binds of /data/..., and /etc an overlay (lower: the system's
/etc, upper: /data/etc/upper), and binds /data and /system in as well.
The partition stays mounted at /sysroot.real and cannot be moved into the new
root (every path in it lies inside it). A partition without /system/current
is mounted at / whole (layout: whole partition in the boot log). Void's
stage 1 and 03-grow-root.sh (void/rootfs/etc/runit/core-services/) work
unchanged on it. Background: docs/NEXT.md section 6.
What may be changed: the files under void/, debian/, initramfs/ and the
scripts that read them, with a boot test on the test slot. What must not:
the pinned Void ROOTFS hash without checking it against Void's signed
sha256sum, and init's rescue path (the telnet fallback is how a phone that
failed to find its root is reached).
Open: firmware blobs (Adreno, modem) and where they come from; the WLAN and
Bluetooth firmware is read from the phone's own partitions at boot
(soc/sm8150/rootfs/etc/makronix/firmware-partitions), none is in an image.