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>
569 lines
29 KiB
Markdown
569 lines
29 KiB
Markdown
# NEXT.md -- continuing the work on Makronix Mobile (hotdogb)
|
|
|
|
Written 2026-11-09 for whoever continues, in particular a local model with
|
|
less context. It is deliberately explicit. Read it top to bottom once,
|
|
then work one task at a time. `docs/HANDOFF.md` is the short version;
|
|
`devices/hotdogb/AGENTS.md` holds every measurement with its log file.
|
|
|
|
------------------------------------------------------------------------
|
|
## 0. Ground rules (binding -- they come from AGENTS.md and from Konrad)
|
|
|
|
1. **No claim without a measurement.** Every "it works" needs a command
|
|
output, a log line or a boot series. Write the measurement into
|
|
`devices/hotdogb/AGENTS.md` with the log file name.
|
|
2. **Read before you change.** The top comment of every file says what it
|
|
is for. Read `AGENTS.md` (this directory), `../AGENTS.md` (the
|
|
repository), `GOAL.md`.
|
|
3. **Tools in `tools/` are POSIX sh.** No bash-isms, no Python. Check
|
|
every script with `dash -n FILE` before committing.
|
|
4. **The kernel is changed only through patches** (`kernel/patches/`,
|
|
see section 3). Never edit `build/linux-hotdogb` without committing
|
|
there and exporting the patch.
|
|
5. **Never on the phone:**
|
|
- `usbreset` or cutting a running `fastboot` command (crashed the
|
|
phone into Qualcomm crash-dump mode, USB 05c6:900e, screen dark);
|
|
- writing slot b (`FORCE_FALLBACK=1`) without Konrad's explicit OK;
|
|
- writing the modem partitions (`modemst1`, `modemst2`, `fsg`,
|
|
`fsc`) or `persist`. rmtfs runs read-only on purpose.
|
|
6. **Commit after every working step**, with a message that says what was
|
|
measured. End commit messages with the attribution line the session
|
|
uses (look at `git log`).
|
|
7. **Ask Konrad** before anything that cannot be undone (slot b, wiping
|
|
userdata when he has data there, router settings).
|
|
8. Konrad's decisions to keep: Void + runit is the base; ssh stays open
|
|
with root/password also on WLAN (his network); the phone is always on.
|
|
|
|
------------------------------------------------------------------------
|
|
## 1. The setup
|
|
|
|
### Machines
|
|
|
|
- Host: Konrad's laptop, Debian, user `lotherk`, repository
|
|
`~/src/makronix`, this subtree `~/src/makronix/mobile`. `sudo` is
|
|
allowed for installing host packages (never restart `rpcbind`).
|
|
- Phone: OnePlus 7T, codename **hotdogb** (NOT hotdog = 7T Pro), SM8150.
|
|
Connected by USB-C to the laptop permanently. A USB webcam
|
|
(`/dev/video4`, "Creative Live! Cam") points at its screen.
|
|
|
|
### Reaching the phone
|
|
|
|
cd ~/src/makronix/mobile
|
|
. tools/lib.sh
|
|
a=$(phone_addr) # 172.16.42.1, or the IPv6 link-local fallback
|
|
phone_ssh "$a" 'uname -r' # root / makronix
|
|
|
|
- USB network: phone 172.16.42.1, laptop 172.16.42.2 (DHCP from the
|
|
phone's dnsmasq, service `usb0-dhcp`). When the laptop has no IPv4 on
|
|
the USB link, `phone_addr` finds the phone over IPv6 (`fe80::...%enx...`).
|
|
- WLAN: the phone is 192.168.1.127 on `deadbeef_5G` (fixed MAC
|
|
ce:c4:60:1e:a8:cd). `ssh root@192.168.1.127` works too.
|
|
- Serial console: `/dev/ttyACM0` on the laptop (kernel console + login).
|
|
- Kernel log of every boot, streamed: `build/logs/netconsole-2026-11-07.log`
|
|
(listener: `sh tools/netconsole-listen.sh LOG`, socat on UDP 6666; it
|
|
may still be running -- check with `pgrep -af socat`). It misses the
|
|
first seconds of a boot.
|
|
- The phone has internet over WLAN: `xbps-install -S <pkg>` works on it
|
|
directly (Void repository).
|
|
|
|
### Buttons (only Konrad can press them)
|
|
|
|
- Power short press: ignored (elogind config).
|
|
- Power 15 s: hard off / out of crash-dump mode.
|
|
- Power + Vol Up + Vol Down: fastboot.
|
|
|
|
### Fastboot from Linux, no buttons
|
|
|
|
phone_ssh "$a" 'reboot-mode bootloader' # fastboot in ~12 s
|
|
fastboot devices
|
|
fastboot reboot # back to slot a
|
|
|
|
------------------------------------------------------------------------
|
|
## 2. Build and flash
|
|
|
|
All from `~/src/makronix/mobile`:
|
|
|
|
make kernel # build/linux-hotdogb: Image, modules, DTB
|
|
make initramfs # build/initramfs-hotdogb.cpio.gz (our /init)
|
|
make bootimg # build/boot_hotdogb.img (checks pins)
|
|
make flash # boot image to slot a; restarts the phone into
|
|
# fastboot itself, flashes, set_active a, reboots
|
|
make rootfs # Void rootfs tar (needs network; slow)
|
|
make rootimg # build/root-void-hotdogb.img (ext4, ROOT_UUID)
|
|
make flash-root # writes userdata -- WIPES the phone's root
|
|
# (see task B for why that is bad today)
|
|
|
|
Test boot image without changing the default (e.g. a kernel parameter):
|
|
|
|
EXTRA_CMDLINE="some.param=1" sh tools/mkbootimg.sh devices/hotdogb \
|
|
build/linux-hotdogb/arch/arm64/boot/Image \
|
|
build/initramfs-hotdogb.cpio.gz build/boot_hotdogb-test.img
|
|
sh tools/flash.sh devices/hotdogb build/boot_hotdogb-test.img a
|
|
|
|
**Modules after a kernel change.** Every kernel commit changes the
|
|
release name (`7.0.0-sm8150-g<hash>`), and the root on the phone only has
|
|
modules for the old one. Before `make flash`, copy the new modules:
|
|
|
|
. tools/lib.sh; load_device devices/hotdogb; a=$(phone_addr)
|
|
S=$PWD/build/tmp/mods; rm -rf $S
|
|
make -s -C build/linux-hotdogb ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE \
|
|
INSTALL_MOD_PATH=$S INSTALL_MOD_STRIP=1 modules_install
|
|
tar -C $S/lib/modules --owner=0 --group=0 -cf - . |
|
|
sshpass -p makronix ssh -o StrictHostKeyChecking=no \
|
|
-o UserKnownHostsFile=/dev/null root@$a 'tar -C /usr/lib/modules -xf -; sync'
|
|
make flash
|
|
|
|
Afterwards remove old module directories on the phone
|
|
(`ls /usr/lib/modules`, keep `$(uname -r)`).
|
|
|
|
**Files for the root image, copied onto the running phone without
|
|
reflashing** (what this session did all the time):
|
|
|
|
tar -C soc/sm8150/rootfs-void --owner=0 --group=0 -cf - etc/sv/foo |
|
|
sshpass -p makronix ssh ... root@$a 'tar -C / -xf -; sync'
|
|
|
|
Where root-image files live:
|
|
- `base/void/rootfs/` -- every device on Void (elogind, NetworkManager
|
|
config, grow-root);
|
|
- `soc/sm8150/rootfs/` -- every SM8150 phone, any base (scripts in
|
|
`/usr/libexec/makronix/`, udev rules, rtc-offset, firmware config);
|
|
- `soc/sm8150/rootfs-void/` -- SM8150 on Void (runit services, stage 1
|
|
and stage 3 hooks);
|
|
- `base/void/packages` -- Void packages; `base/void/base.conf` --
|
|
`VOID_SERVICES` enabled in the image.
|
|
`tools/mkrootimg.sh` copies these in that order.
|
|
|
|
------------------------------------------------------------------------
|
|
## 3. The kernel series
|
|
|
|
- Upstream pin: `kernel/PIN`. Patches: `kernel/patches/0001-...0019`.
|
|
- Work tree: `build/linux-hotdogb` (a git repository; build output).
|
|
- To change the kernel:
|
|
|
|
cd build/linux-hotdogb
|
|
# edit
|
|
git add FILE && git commit -m "subsystem: what and why (measured: ...)"
|
|
cd ../..
|
|
git -C build/linux-hotdogb format-patch -q --start-number 20 -1 HEAD \
|
|
-o $PWD/kernel/patches
|
|
make kernel
|
|
|
|
- Device tree of the phone: `arch/arm64/boot/dts/qcom/sm8150-oneplus-hotdogb.dts`
|
|
in that tree. For a DT-only test you may build just the DTB
|
|
(`make -s ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- qcom/sm8150-oneplus-hotdogb.dtb`
|
|
in the tree) and pack it with the current Image via `tools/mkbootimg.sh`;
|
|
the release name does not change then.
|
|
- Stock references on the laptop (read-only):
|
|
- `build/tmp/twrp/stock-18865.dts` -- the phone's stock DT (dtb.08 of
|
|
the TWRP image + `dtbo_a.img` entry 3). The 7T is project **18865**.
|
|
- `~/src/los-kernel-sm8150` -- LineageOS kernel (downstream DTs under
|
|
`arch/arm64/boot/dts/19801/`, drivers e.g. `drivers/power/oplus/`).
|
|
|
|
------------------------------------------------------------------------
|
|
## 4. Testing: boot series
|
|
|
|
One boot proves little; most defects here were intermittent (5-30 %).
|
|
|
|
sh tools/boot-loop.sh N LOG tools/checks/CHECK.sh
|
|
|
|
- reboots the phone N times (clean `reboot`), waits until uptime >= 45 s
|
|
(`WAIT_UP=` to change), feeds `CHECK.sh` to `sh` on the phone and writes
|
|
`run I: <output>` to LOG. Every wait is bounded; a boot that does not
|
|
come back ends the loop.
|
|
- Checks: `tools/checks/bt-wlan.sh` (Bluetooth, WLAN, modem crashes),
|
|
`tools/checks/wlan-diag.sh` (details when WLAN is missing). Write new
|
|
ones the same way: plain sh, print one line, no single quotes needed.
|
|
- Display: `sh tools/display-loop.sh N LOG` (camera; `screen=` 0 = black
|
|
console, 255 = white). `sh tools/phone-screen.sh` takes one frame.
|
|
- 30 boots take ~25 minutes. Run long series in the background and read
|
|
the log afterwards.
|
|
|
|
------------------------------------------------------------------------
|
|
## 5. TASK A -- WLAN missing in about 2-3 boots of 15 (SOLVED 2026-11-10)
|
|
|
|
Solved: `qrtr_smd` loaded too late (udev race); it is loaded in stage 1
|
|
now, WLAN in 15 of 15 boots (`devices/hotdogb/AGENTS.md`). Kept below as
|
|
the record of the hunt.
|
|
|
|
### Symptom (measured, `build/logs/wlan-diag-2026-11-09.log`)
|
|
|
|
Good boot: modem up ~4.1 s -> ath10k "wifi fw qmi service found" ~6.1 s
|
|
-> `wlan0` ~10.2 s. Bad boot: modem up ~4 s, the WLAN QMI service never
|
|
appears, at ~44 s `qcom_q6v5_pas 4080000.remoteproc: fatal error without
|
|
message`, the modem recovers and WLAN comes up at ~50 s.
|
|
|
|
### Already ruled out
|
|
|
|
- tqftpserv not running when the modem starts: rmtfs now waits for it
|
|
(`soc/sm8150/rootfs-void/etc/sv/rmtfs/conf`). Keep that, it is right,
|
|
but the failure stayed.
|
|
- `qcom_pd_mapper` not loaded: it is loaded in stage 1
|
|
(`soc/sm8150/rootfs/etc/modules-load.d/qcom-pd-mapper.conf`).
|
|
|
|
### Next steps
|
|
|
|
1. Fix the check: `tools/checks/wlan-diag.sh` now tests whether the PD
|
|
mapper is **bound** (`/sys/bus/auxiliary/devices/qcom_common.pd-mapper.0/driver`).
|
|
Run `sh tools/boot-loop.sh 15 build/logs/wlan-diag2-DATE.log tools/checks/wlan-diag.sh`.
|
|
If `bound=0` in failing boots: the auxiliary device appears while the
|
|
driver is not yet registered, or the other way round; look at
|
|
`drivers/soc/qcom/qcom_pd_mapper.c` and `drivers/remoteproc/qcom_common.c`
|
|
(pdm_notify_prepare), consider building qcom_pd_mapper into the kernel
|
|
(`CONFIG_QCOM_PD_MAPPER=y` in `devices/hotdogb/kernel.config`).
|
|
2. Turn on more logging in failing boots, temporarily:
|
|
- `echo 'options ath10k_core debug_mask=0x00200000' > /etc/modprobe.d/ath10k-debug.conf`
|
|
(QMI messages of ath10k; remove the file afterwards);
|
|
- dynamic debug for the PD mapper and sysmon:
|
|
`echo 'module qcom_pd_mapper +p' > /sys/kernel/debug/dynamic_debug/control`
|
|
(needs `mount -t debugfs none /sys/kernel/debug`; only for the
|
|
running boot -- for boot time use the kernel parameter
|
|
`dyndbg="module qcom_pd_mapper +p"` via EXTRA_CMDLINE).
|
|
- tqftpserv: does the modem ask for `wlanmdsp.mbn` in bad boots? Its
|
|
output goes to its runit log (`/var/log/socklog` is not set up; look
|
|
at `sv status tqftpserv`, `ps`, or run tqftpserv in the foreground
|
|
with output to a file by editing a copy of `/etc/sv/tqftpserv/run`).
|
|
- QRTR services: install `qrtr` tools (`xbps-install qrtr-ns` brings
|
|
`qrtr-lookup`?) and list services in a bad boot: a missing service
|
|
69 (WLFW) / 66 (PD mapper) etc. tells which side is silent.
|
|
3. Compare good and bad boots line by line; write the difference into
|
|
`devices/hotdogb/AGENTS.md`.
|
|
4. Stopgap if no root cause is found: a runit service `wlan-watch` that
|
|
waits up to 20 s after the modem is up for `wlan0` and otherwise runs
|
|
`sv restart rmtfs` (stops and starts the modem). Measure that it
|
|
brings WLAN in < 30 s in bad boots. Document it as a stopgap.
|
|
|
|
------------------------------------------------------------------------
|
|
## 6. TASK B -- persistent data across updates (Konrad's wish)
|
|
|
|
### State, 2026-11-09 evening
|
|
|
|
Implemented, not yet on the phone:
|
|
|
|
- `base/initramfs/init`: two layouts, decided by `/system/current` (new:
|
|
binds + `/etc` overlay; old: whole partition, unchanged). Pin renewed:
|
|
`INITRAMFS_SHA256_PREFIX=36d13e577c6a298c`.
|
|
- `devices/hotdogb/kernel.config`: `CONFIG_OVERLAY_FS=y` (was `m`; the
|
|
initramfs loads no modules). Kernel release unchanged
|
|
(`7.0.0-sm8150-gb81725c5c168`), `overlayfs` in `modules.builtin`,
|
|
`/sys/module/overlay` present on the phone.
|
|
- `tools/mkrootimg.sh` writes `/system/current/` instead of the tree at the
|
|
top; the tree assembly moved to `tools/assemble-rootfs.sh` and is shared
|
|
with the new `tools/mkroottar.sh` (`make roottar`) and
|
|
`tools/update-root.sh` (`make update-root`; not
|
|
`VERSION=`, which make passes into the kernel build).
|
|
- `base/AGENTS.md`, `docs/BOOT.md`: the layout, the mounts, the update.
|
|
|
|
Measured on the build host (2026-11-09): the whole sequence (image with
|
|
`/system/current`, bind of it, binds of `/data/{home,root,var/lib}`,
|
|
overlay on `/etc`) mounts; a write to `/etc` lands in
|
|
`/data/etc/upper`; `mount -o remount,ro` on the bind makes the whole file
|
|
system read-only and `remount,rw` undoes it (so Void's stage 1 still does
|
|
its fsck of the partition, and `e2fsck` accepts the read-only mount);
|
|
`/proc/mounts` names the device for `/`, so `03-grow-root.sh` keeps
|
|
working.
|
|
|
|
Measured on the phone (2026-11-09): the new initramfs boots the **old**
|
|
image -- `layout: whole partition (image without /system/current)`,
|
|
`switch_root` at 1.45 s, phone up, ssh over USB as before
|
|
(`build/logs/netconsole-2026-11-07.log`).
|
|
|
|
Next: `make rootimg` and `make flash-root` (wipes the root; the state is
|
|
backed up in `build/phone-backup-2026-11-09/`), then restore
|
|
`/etc/NetworkManager`, `/etc/ssh`, `/var/lib/*` into the new `/data`, and
|
|
measure: first boot creates `/data`, a changed `/etc` file survives a
|
|
reboot, `/var/lib/makronix/rtc-offset` and the ssh host keys survive
|
|
`make update-root`.
|
|
|
|
|
|
### Problem
|
|
|
|
Today the root file system IS the `userdata` partition. `make flash-root`
|
|
writes a new ext4 image over it, so WLAN networks, Bluetooth pairings, the
|
|
ssh host keys, /home, /root and `/var/lib/makronix/rtc-offset` are lost
|
|
with every root update.
|
|
|
|
### How Android does it
|
|
|
|
- `system`, `vendor`, `product`: the OS, read-only, A/B slots, replaced
|
|
on every update.
|
|
- `/data` (`userdata`): all state -- settings, `/data/misc/wifi`,
|
|
`/data/misc/bluedroid`, apps, user files. Never touched by an update.
|
|
- `/persist`: factory calibration. Never touched.
|
|
|
|
### Design for Makronix Mobile (decided direction, 2026-11-09)
|
|
|
|
Persist exactly these (Konrad: "/var/lib /etc /home und /root"):
|
|
|
|
| path | how | why |
|
|
|------------|-----------------------------|-----|
|
|
| `/home` | bind mount from `/data/home` | user data |
|
|
| `/root` | bind mount from `/data/root` | root's files, ssh keys of root |
|
|
| `/var/lib` | bind mount from `/data/var/lib` | all service state: NetworkManager (WLAN networks are in /etc, see below), bluetooth pairings, makronix (rtc-offset), dbus machine-id, chrony, ... |
|
|
| `/etc` | **overlayfs**: lower = the system's /etc, upper = `/data/etc/upper`, work = `/data/etc/work` | changes persist, untouched files come fresh with every update |
|
|
|
|
Why `/etc` is an overlay and not a bind mount: a whole /etc copied to
|
|
/data would hide every new or changed default of the next system version
|
|
(new services, changed PAM, new config keys) and break updates quietly.
|
|
With the overlay only the files Konrad (or a service) changed are taken
|
|
from /data. WLAN connections live in
|
|
`/etc/NetworkManager/system-connections/` and ssh host keys in
|
|
`/etc/ssh/` -- both are covered by the /etc overlay.
|
|
|
|
Known overlay caveats to handle:
|
|
- A file changed in /data/etc stays as it is even when the system ships a
|
|
newer version of it. Later: a tool that lists files in
|
|
`/data/etc/upper` that also changed in the new system (like a 3-way
|
|
merge, `etcupdate` on NetBSD, `pacnew` on Arch). For now: document.
|
|
- Deleting a file in /etc creates a whiteout in the upper dir: fine.
|
|
- `/etc/fstab`, `/etc/hostname` etc. written by `tools/mkrootimg.sh`
|
|
would be shadowed if they are in the upper dir. Do not write them at
|
|
run time.
|
|
|
|
### Layout on userdata (step 1, keeps the current image format)
|
|
|
|
Keep one ext4 file system on userdata, but separate system and data in
|
|
directories:
|
|
|
|
/ (the ext4 on userdata)
|
|
/system/current/ the root tree of the running system version
|
|
/data/ persistent: home/ root/ var/lib/ etc/upper etc/work
|
|
|
|
The initramfs mounts userdata at `/sysroot.real`, then:
|
|
|
|
mount --bind /sysroot.real/system/current /sysroot
|
|
mount --bind /sysroot.real/data/home /sysroot/home
|
|
mount --bind /sysroot.real/data/root /sysroot/root
|
|
mount --bind /sysroot.real/data/var/lib /sysroot/var/lib
|
|
mount -t overlay overlay -o lowerdir=/sysroot/etc,upperdir=/sysroot.real/data/etc/upper,workdir=/sysroot.real/data/etc/work /sysroot/etc
|
|
|
|
(Kernel needs `CONFIG_OVERLAY_FS=y` -- check `devices/hotdogb/kernel.config`;
|
|
if it is `m`, the initramfs cannot load it: make it `y`.)
|
|
|
|
First boot (no /data yet): create `/data/home`, `/data/root`, and copy
|
|
the system's `/var/lib` and `/root` into `/data` once (`cp -a`), create
|
|
`/data/etc/upper` and `/data/etc/work` empty.
|
|
|
|
Root-image updates then write only `/system/<version>/` (e.g. unpack the
|
|
rootfs tar there over ssh, or later a separate image file) and switch
|
|
`/system/current` -- `/data` is never touched. That also prepares the
|
|
A/B update design (two system versions side by side, the boot slot names
|
|
which one; see the discussion in `docs/HANDOFF.md`).
|
|
|
|
### Concrete steps
|
|
|
|
1. Read `base/initramfs/init` completely (POSIX sh, busybox). It mounts
|
|
`root=UUID=` read-only at /sysroot and runs `switch_root`.
|
|
2. Check the kernel config for overlayfs (`grep OVERLAY devices/hotdogb/kernel.config`).
|
|
3. Change `/init`: mount userdata at `/sysroot.real` **read-write**
|
|
(the bind mounts need a writable /data; the root's own fsck/remount
|
|
logic in Void's stage 1 then sees an already-rw root -- check
|
|
`/etc/runit/core-services/03-filesystems.sh` on the phone, it remounts
|
|
/ ro for fsck; with this layout / is the bind of /system/current, so
|
|
fsck of the whole partition must move to the initramfs or be skipped:
|
|
decide and document). If `/system/current` does not exist, fall back
|
|
to the old behaviour (whole partition as root) so that today's images
|
|
still boot.
|
|
4. Change `tools/mkrootimg.sh` so the ext4 image contains
|
|
`/system/current/<tree>` instead of the tree at the top; `/data` is
|
|
NOT in the image (created at first boot).
|
|
5. A migration for the running phone (one time, by hand, with Konrad):
|
|
on the phone, `mkdir -p /data /system/current`, move the tree... this
|
|
is delicate on a running system -- better: build a new image with the
|
|
new layout, `make flash-root` once more (last time data is lost), set
|
|
up WLAN again, and from then on updates keep /data.
|
|
6. A tool for updates that keeps /data: `tools/update-root.sh` (POSIX sh):
|
|
streams `build/rootfs-void-hotdogb.tar` plus the device files into
|
|
`/system/<new>/` on the phone over ssh, switches `/system/current`
|
|
(a symlink, or a small file the initramfs reads), reboots. Measure:
|
|
WLAN, bluetooth pairing, ssh host key, a file in /root survive.
|
|
7. Document in `base/AGENTS.md` and `docs/BOOT.md`; commit.
|
|
|
|
------------------------------------------------------------------------
|
|
## 7. TASK C -- Bluetooth second setup
|
|
|
|
Status: `bt-address` runs as runit service `bt-address`
|
|
(`soc/sm8150/rootfs-void/etc/sv/bt-address/run`, script
|
|
`soc/sm8150/rootfs/usr/libexec/makronix/bt-address`). It waits up to 30 s
|
|
for wlan0, sets the address (derived from the serial number), and if the
|
|
controller does not come up, unbinds/binds `hci_uart_qca` and tries again
|
|
(3 attempts). Last series: 14 of 15 on attempt 1; the one miss was a boot
|
|
where wlan0 was missing (task A), so the script was still waiting at 45 s.
|
|
|
|
Next: after task A, run `tools/boot-loop.sh 15 LOG tools/checks/bt-wlan.sh`
|
|
and look at `attempt=`. If attempts > 1 still occur, consider giving the
|
|
controller its address before the first setup: the kernel reads
|
|
`local-bd-address` from the DT (hci_qca sets
|
|
HCI_QUIRK_USE_BDADDR_PROPERTY); the bootloader does not fill it on this
|
|
phone. It would have to be patched into the DTB at boot (not possible
|
|
with a fixed DTB) or the kernel taught to derive it -- probably not worth
|
|
it if the retry works.
|
|
|
|
------------------------------------------------------------------------
|
|
## 8. TASK D -- update slot b (only with Konrad's OK)
|
|
|
|
Slot b holds the state of 2026-11-08 morning (commit b9c0aff). Once A
|
|
and C are settled and a 30-boot series is clean:
|
|
|
|
FORCE_FALLBACK=1 sh tools/flash.sh devices/hotdogb build/boot_hotdogb.img b
|
|
# then: fastboot set_active a was done by the script? check:
|
|
phone_ssh "$a" 'qcom-ab-slot status' # boot_a active=1, boot_b active=0
|
|
|
|
Note: slot b uses the same userdata root. Its kernel must have its modules
|
|
in /usr/lib/modules too (it will, if it is the same build as slot a).
|
|
Record the boot image sha256 in `devices/hotdogb/AGENTS.md`.
|
|
|
|
------------------------------------------------------------------------
|
|
## 9. Smaller open points
|
|
|
|
- SMMU faults at boot (`Unhandled context fault ... iova=0x9c...`, SIDs
|
|
0x800/0xc20), about every second boot: harmless for the picture. The
|
|
tail of the bootloader's last frame; could be avoided by waiting for
|
|
the frame to finish before msm attaches its IOMMU domain
|
|
(`_dpu_kms_stop_boot_scanout` in `drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c`).
|
|
- Shutdown hang when the modem stops while ath10k is loaded: avoided by
|
|
`soc/sm8150/rootfs-void/etc/runit/shutdown.d/05-wlan-before-modem.sh`,
|
|
not fixed in the kernel.
|
|
- The root image has not been rebuilt since many changes (they were
|
|
copied onto the running phone). Before task B's flash, run
|
|
`make rootfs && make rootimg` and check the image contains everything
|
|
in `base/void/rootfs`, `soc/sm8150/rootfs*`, the services in
|
|
`base/void/base.conf` (bluetoothd rmtfs tqftpserv), the packages
|
|
(bluez rmtfs tqftpserv linux-firmware-network).
|
|
- Clock: after a new root image run `sh tools/phone-time.sh` once (or
|
|
rely on chronyd now that WLAN has internet -- check `chronyc tracking`
|
|
and drop rtc-offset's need for the host if it works).
|
|
- OTG host mode untested (needs an OTG adapter from Konrad).
|
|
- Touchscreen not enabled; audio (ADSP), sensors (SLPI), camera, modem
|
|
data/calls: not started. The firmware-partitions mechanism
|
|
(`/etc/makronix/firmware-partitions`) is ready for `dsp_a` (ADSP/CDSP).
|
|
- GOAL.md phases: pkgsrc for aarch64 Linux and the `makronix` set on the
|
|
phone, CDE as the session, touch.
|
|
|
|
------------------------------------------------------------------------
|
|
## 9a. Reproducible kernel release name (found 2026-11-10)
|
|
|
|
`make linux KERNEL_TREE=build/linux-verify` from `refs/linux/7.0.0` applies
|
|
all 20 patches and gives the same source tree as `build/linux-hotdogb`
|
|
(tree hash d31c6d86f032 in both, `build/logs/linux-verify-2026-11-10.log`),
|
|
but other commit hashes (git am stamps the commit date), so the kernel's
|
|
release name differs (`7.0.0-sm8150-g<hash>` from `setlocalversion`): a
|
|
kernel from a fresh tree does not load the modules of the old one. Fix:
|
|
let `tools/fetch-kernel.sh` apply the patches with a fixed committer and
|
|
author date (`GIT_COMMITTER_DATE`, `git am --committer-date-is-author-date`
|
|
-- the patches carry their author date), so the same series gives the
|
|
same commits; or set `LOCALVERSION` from the tree hash and turn off
|
|
`CONFIG_LOCALVERSION_AUTO`. Measure: two fresh trees, same `HEAD`.
|
|
|
|
Done the same day: `tools/fetch-kernel.sh` applies the series with a fixed
|
|
committer and `--committer-date-is-author-date`; two fresh trees both end
|
|
at 662ea51c5ed9 (tree d31c6d86f032). The work tree `build/linux-hotdogb`
|
|
predates this (HEAD 425f6d5c4, release g425f6d5c494a, what the phone runs):
|
|
to switch, move it aside, `make linux`, `make kernel`, then `make
|
|
update-root SYSTEM_VERSION=...` (new modules) and `make flash` -- the
|
|
release becomes 7.0.0-sm8150-g662ea51c5ed9. New kernel work then goes
|
|
into that tree as before (commit, `format-patch --start-number 21`).
|
|
|
|
## 9b. Linux 7.4 (Konrad, 2026-11-10: "7.4 is okay")
|
|
|
|
State: slot b holds the current 7.0 state (8c098f3d3af88f9b, system
|
|
/system/2026-11-10f; way back in devices/hotdogb/AGENTS.md). The SM8150
|
|
fork has no 7.2; its next base is the branch `sm8150/7.4-rc1-wip`
|
|
(gitlab.nura.eco/soc/qualcomm-sm8150/linux). Its source lives in the
|
|
repository like 7.0's: the shallow submodule `../refs/linux/7.4-rc1` on
|
|
that branch (added 2026-11-10; `.gitmodules`). Nothing outside the
|
|
repository (no ~/src/nura) is used.
|
|
|
|
Steps:
|
|
1. Experimental tree: `git clone -q --no-checkout ../refs/linux/7.4-rc1
|
|
build/linux-74` (a local clone, hardlinks), check out its HEAD.
|
|
2. Apply `kernel/patches/*` with `git am -3` one by one; sort each into:
|
|
applies / conflicts (rebase it) / upstream already (drop it). Write the
|
|
list into devices/hotdogb/AGENTS.md. Watch the DTS patches (0007 ff.):
|
|
the fork may carry its own sm8150-oneplus-hotdogb.dts.
|
|
3. Build with devices/hotdogb/kernel.config (olddefconfig first; check
|
|
the logo, overlayfs=y, BTF still on). `make kernel KERNEL_TREE=build/linux-74`.
|
|
4. Test on slot a only: `make update-root KERNEL_TREE=build/linux-74`
|
|
(7.4 modules), then flash. Measure: display + splash (camera,
|
|
tools/display-loop.sh), USB, WLAN, BT, modem, battery,
|
|
tools/boot-loop.sh 15 with tools/checks/bt-wlan.sh.
|
|
5. Only when it holds: a new submodule refs/linux/7.4.x at the fork's tag
|
|
(once it exists), kernel/PIN and kernel/patches moved together.
|
|
|
|
State 2026-11-10 evening: steps 1-3 done (`kernel/patches-7.4`, README
|
|
there); step 4 failed. Booted only with `fastboot boot` (slot a stays
|
|
7.0): black after the bootloader, no kernel line with `console=tty0`,
|
|
nothing on USB, no self-restart with `panic=1 oops=panic` (a hard hang,
|
|
no panic, so no ramoops either) -- also with the 7.0 DTB and with an
|
|
Image of 41 MiB (BTF off), so neither the device tree nor the size. The
|
|
fork's branch is WIP on an rc. On hold until the fork tags 7.4
|
|
(`v7.4.0-sm8150`); then rebase kernel/patches-7.4 onto the tag and try
|
|
again. Each failed try needs Konrad: Power 15 s (it then boots slot a).
|
|
|
|
### 9c. 2026-11-11: off the fork, onto kernel.org; 7.3.4 measured
|
|
|
|
Decision (Konrad, 2026-11-11): no third-party base; kernel.org stable plus
|
|
our series, full control. The phone runs **v7.0.14** now (`kernel/PIN`,
|
|
`../refs/linux/7.0.14`): 0001-0004 are what hotdogb needs from the fork
|
|
(DTSI/PMIC nodes, OnePlus DTS, SMB5 charger, of/property; the fork's 107
|
|
files against v7.0 are mostly other devices), 0005-0025 ours (the old 0005
|
|
is in v7.0.14 by a stable backport). The fork's 7.4 waiting above is moot;
|
|
`kernel/patches-7.4` is history. 7.0 is EOL at 7.0.14: the next base is
|
|
the 2026 LTS (likely 7.4 or 7.5), and before that the regression below has
|
|
to be found.
|
|
|
|
What 7.3.4 + the same series (`build/linux-m73`) showed, each from RAM:
|
|
- the 2026-11-10 "hang before the console" was two things. With the
|
|
fork's DTB ABL never starts the kernel at all (no `qcom,msm-id` /
|
|
`qcom,board-id`: `fastboot boot` says OKAY, fastboot stays alive, the
|
|
menu stays on screen) -- a fork-DTB test is no test. With our DTB the
|
|
kernel starts and hangs.
|
|
- our config: black, no USB. The fork's config (defconfig +
|
|
sm8150.config): the kernel runs, msm DRM takes the panel (garbled).
|
|
Our config with `FTRACE` off: runs too, msm takes the panel -- so ftrace
|
|
(dynamic, with call ops, as in 7.0 where it works) hangs 7.3 before the
|
|
console. A regression, not found yet.
|
|
- without ftrace it freezes hard later: picture frozen, no USB, no panic
|
|
with softlockup/hardlockup(buddy)/hung-task panic and panic=10 (cmdline
|
|
`build/tmp/dev-panic`), no reset -- so pstore (ramoops at 0xa9800000,
|
|
works on 7.0 from 0.046 s) never gets a warm boot to keep the log. A
|
|
15 s power press is a cold reset; RAM is lost.
|
|
- the screen is no console without msm: 7.0 with
|
|
`initcall_blacklist=msm_drm_register console=tty0` boots (ssh) and the
|
|
panel stays black, so a black screen on such a test means nothing.
|
|
- SoC drivers that changed most from v7.0 to v7.3.4: qcom-pdc (+571, and
|
|
sm8150.dtsi's pdc reg 0x30000 -> 0x10000), llcc-qcom (+671), qcom_scm
|
|
(+571), ufs-qcom (+632), pinctrl-msm, rpmhpd, qcom-wdt. Cheapest next
|
|
tests: DTB-only changes (pdc size back), then a release bisect with the
|
|
series (v7.1, v7.2), booting from RAM; a 7.0 phone is put into fastboot
|
|
by `reboot-mode bootloader` over ssh, only a hang needs Konrad.
|
|
|
|
### 9d. Open since 7.0.14: Bluetooth fails in about 3 boots of 10
|
|
|
|
Measured 2026-11-11 (build/logs/ab-bt-{new,old}-2026-11-11.log, the NetBSD
|
|
userland and the Void tree before it, 5 boots each: 4/5 and 3/5): every
|
|
failure is the kernel's "QCA TLV response size mismatch" / "Retry BT power
|
|
ON" during the second setup (address set by bt-address); on 7.0.0 it hit 1
|
|
boot of 15 (bt-flush-2026-11-10.log). bt-address then probes again --
|
|
unbind of the UART driver -- and hangs in the kernel: qca_serdev_remove ->
|
|
hci_unregister_dev -> __flush_work, the script in D state. Two kernel
|
|
items: what in 7.0.0 -> 7.0.14 made the retry more frequent (hci_qca,
|
|
serdev, the qcom geni UART), and the unbind deadlock while a power-on
|
|
retry is pending. Not the userland (same rate with either).
|
|
|
|
## 10. Where things are (quick map)
|
|
|
|
| what | where |
|
|
|------|-------|
|
|
| measurements, history | `devices/hotdogb/AGENTS.md` |
|
|
| boot chain, access | `docs/BOOT.md` |
|
|
| device config | `devices/hotdogb/device.conf`, `kernel.config`, `cmdline` |
|
|
| initramfs | `base/initramfs/init` |
|
|
| Void base | `base/void/` (packages, base.conf, rootfs/) |
|
|
| SM8150 files | `soc/sm8150/rootfs/`, `soc/sm8150/rootfs-void/` |
|
|
| tools | `tools/` (flash.sh, mkbootimg.sh, mkrootimg.sh, boot-loop.sh, display-loop.sh, phone-screen.sh, phone-time.sh, lib.sh) |
|
|
| logs | `build/logs/` (not in git) |
|
|
| EFS/persist backup | `~/src/nura/hotdogb-backup` |
|
|
| stock DT | `build/tmp/twrp/stock-18865.dts` |
|
|
| downstream kernel | `~/src/los-kernel-sm8150` |
|
|
|
|
<!-- License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. -->
|