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>
95 lines
5.0 KiB
Markdown
95 lines
5.0 KiB
Markdown
# AGENTS.md -- how work happens in mobile/
|
|
|
|
Makronix Mobile Edition, **Makronix/Linux** on phones: kernel.org's Linux plus
|
|
our patch series, NetBSD's userland from `../src` on glibc, pkgsrc in
|
|
`/usr/pkg`. Read `GOAL.md` first, then the plan `docs/NETBSD-USERLAND.md`
|
|
(sections 2 and 3 before porting anything). The rules of `../AGENTS.md` apply
|
|
wherever they make sense for Linux: measurements beat claims, docs before code,
|
|
changes to imported sources only as patches. Building is cross and native,
|
|
never in a VM; a VM only tests. The root `Makefile` has no mobile target;
|
|
`mobile/Makefile` has its own (run `make` from `mobile/`).
|
|
|
|
## One tree
|
|
|
|
`mobile/` is a subtree of the `makronix` repository. Userland sources (pkgsrc,
|
|
the package lists, `PINS`) are shared with the desktop and live once, at the
|
|
root; `mobile/` does not copy or fork them. Where the phone differs from the
|
|
PC, the difference is a variable or an entry in `soc.conf` / `device.conf`,
|
|
never a second copy of a file. A change in shared code is made in the shared
|
|
place and proved by the PC build.
|
|
|
|
Userland packages come from `../pkgsrc` (pinned in `../PINS`), built for
|
|
aarch64, with the one distfiles cache of the root. The list is
|
|
`../packages.list` with `ARCH=aarch64` (`PKG_ARCH=aarch64`, from
|
|
`soc.conf`); a package only the phone needs gets `@aarch64` on its line there.
|
|
There is no `mobile/packages.list`. Platform differences are pkgsrc options
|
|
or `device.conf` variables (`PKG_OPTIONS`). pkgsrc's `OPSYS` is Linux on the
|
|
phone; where a package does not build there, the fix goes to the shared place.
|
|
|
|
## The device is the unit
|
|
|
|
The phone in your hand decides which tree and which sequence is right. **Check
|
|
`DEVICE_NAME` before you build or flash.** hotdogb is the OnePlus 7T; hotdog,
|
|
the 7T Pro, has a different panel and init sequence, garbles the 7T's display,
|
|
and is not supported here.
|
|
|
|
## Layout
|
|
|
|
soc/<soc>/soc.conf what every phone with this SoC shares
|
|
soc/<soc>/rootfs/ files for its root image, any base (tools/mkrootimg.sh)
|
|
soc/<soc>/rootfs-<base>/ the same, for one base (runit services on void)
|
|
devices/<codename>/ one phone: device.conf, kernel.config, cmdline
|
|
kernel/ PIN (the kernel pin), patches/ (the series),
|
|
patches-7.4/ (history, not applied)
|
|
base/ the root file system's base and the initramfs
|
|
(base/AGENTS.md)
|
|
userland/ NetBSD programs of src/ for the phone
|
|
(userland/AGENTS.md)
|
|
conf/mk.conf MAKECONF for building src/ for Linux (make src)
|
|
tools/ POSIX sh; lib.sh loads soc.conf then device.conf
|
|
docs/ PORTING.md (new phone), BOOT.md, NEXT.md,
|
|
NETBSD-USERLAND.md, PORTING-USERLAND.md, HANDOFF.md
|
|
build/ output, ignored
|
|
../refs/linux/<version> the shared Linux source (submodule, read-only)
|
|
|
|
`patches/` and `pkgsrc/` here are empty and unused.
|
|
|
|
## Rules
|
|
|
|
- No tool knows a device by name. A new phone is a new `devices/<codename>/`
|
|
and, for a new SoC, a `soc/<soc>/soc.conf`. An `if` on a device name in a
|
|
tool means the setting belongs in a `.conf`.
|
|
- `tools/` is POSIX `sh`: no Python, no bashisms, no prebuilt binaries that
|
|
need a foreign libc.
|
|
- Pins (`INITRAMFS_SHA256_PREFIX`; `DTB_SHA256_PREFIX` for a binary `DTB`)
|
|
make a build reproducible; `make check` enforces them. A DTB built from the
|
|
kernel tree (`KERNEL_DTB`) is pinned by `kernel/PIN` and the patches. Move
|
|
a pin only together with the measurement that justifies it.
|
|
- Flashing: the test slot (a) first. The fallback slot (b) holds the last
|
|
image known to boot and is written only with `FORCE_FALLBACK=1`, never made
|
|
active by the tool.
|
|
- The phone keeps ssh open with root/password on the WLAN (the network is
|
|
Konrad's); do not close it.
|
|
|
|
## The kernel
|
|
|
|
Source: `../refs/linux/7.0.14` (kernel.org stable v7.0.14, shallow submodule,
|
|
read-only, the commit in `kernel/PIN`). Ours: `kernel/patches/`, applied in
|
|
filename order -- 0001-0004 are what hotdogb needs from the qualcomm-sm8150
|
|
fork (`../refs/linux/7.0.0`, reference only), 0005-0026 are ours, the DTS of
|
|
hotdogb among them. There is no binary DTB.
|
|
|
|
`make linux` clones the shared tree (hardlinks) into `build/linux-<device>`,
|
|
checks out the pin and applies the patches; `make kernel` builds Image,
|
|
modules and the DTB. The build tree is output: change it with commits, then
|
|
export them into `kernel/patches/` (`git format-patch --start-number N`).
|
|
The shared tree is never edited. A pin moves by updating the submodule and
|
|
`kernel/PIN` together; a drift between them is an error
|
|
(`tools/fetch-kernel.sh`).
|
|
|
|
Known: mainline after 7.0 does not boot hotdogb with our config yet (7.3.4:
|
|
ftrace hangs before the console, without it the phone freezes hard later;
|
|
`docs/NEXT.md` 9c). `kernel/patches-7.4` is history.
|
|
|
|
<!-- License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. -->
|