diff --git a/device/bluejay/UPSTREAM.md b/device/bluejay/UPSTREAM.md index 53aae8fea..fe373a4f1 100644 --- a/device/bluejay/UPSTREAM.md +++ b/device/bluejay/UPSTREAM.md @@ -1,25 +1,39 @@ # Bluejay development source and review status -Status (2026-11-10): documentation split from [#543](https://github.com/derekross/omarchy-mobile/pull/543), now closed unmerged in favour of the split PRs below. +Status (2026-11-11): documentation split from [#543](https://github.com/derekross/omarchy-mobile/pull/543), now closed unmerged in favour of the split PRs below. The historical source below demonstrates one working development handset; it -is not a release installer. No code or device descriptor is changed by this -PR. Source-only instructions are not authority to run a phone operation. +is not a release installer. This status page changes no boot or hardware +policy. Source-only instructions are not authority to run a phone operation. ## Kernel topics in review | Topic | PR | Remaining work | | --- | --- | --- | -| NCM aggregation retry | [#225](https://github.com/derekross/linux-omarchy-mobile/pull/225) | Suspend handling revised; separate selftests and validate on the reference phone, including laptop sleep | +| NCM aggregation retry | [#225](https://github.com/derekross/linux-omarchy-mobile/pull/225) | Driver/selftest commits split; attended SSH profile in [mobile #666](https://github.com/derekross/omarchy-mobile/pull/666); reference phone and laptop-sleep qualification remain | | Retained-memory exclusions | [#226](https://github.com/derekross/linux-omarchy-mobile/pull/226) | Provenance and node naming addressed; passing CI, awaiting maintainer merge | -| GS101 PCIe/PHY | [#227](https://github.com/derekross/linux-omarchy-mobile/pull/227) | Power control and match data revised; explain single link try/history suppression and qualify a fresh 6a boot | -| BCM4389 bring-up | [#228](https://github.com/derekross/linux-omarchy-mobile/pull/228) | Cache DMA-size limit at probe, count size drops and keep chip-only bring-up separate | -| ALIX touch | [#229](https://github.com/derekross/linux-omarchy-mobile/pull/229) | Staging knobs removed; check reset-order header and qualify a fresh 6a boot | -| Disabled Wi-Fi DT | [#230](https://github.com/derekross/linux-omarchy-mobile/pull/230) | Merge after both #227 and #228, then rebase to its own two commits | +| GS101 PCIe/PHY | [#227](https://github.com/derekross/linux-omarchy-mobile/pull/227) | Power control, match data and single-try/failure-history-read rationale revised; qualify a fresh 6a boot | +| BCM4389 bring-up | [#228](https://github.com/derekross/linux-omarchy-mobile/pull/228) | Probe-time DMA-limit cache and oversized-TX completion/counter revised; chip-only diagnostics excluded; matched-stack phone trial remains | +| ALIX touch | [#229](https://github.com/derekross/linux-omarchy-mobile/pull/229) | Staging knobs removed and shared reset-order header checked; qualify a fresh 6a boot | +| Disabled Wi-Fi DT | [#230](https://github.com/derekross/linux-omarchy-mobile/pull/230) | Revised dependency stack refreshed; merge after #227 and #228, then rebase to its own two commits | | Trusty trace API | [#231](https://github.com/derekross/linux-omarchy-mobile/pull/231) | Merged 2026-11-09; no Trusty runtime claimed | -All seven submitted heads passed CI. That is build/policy evidence, not -runtime qualification of the rebased stack. The tested source is the +The attended USB SSH transfer profile is `tools/ncm-transfer --peer root@ --interface `. It performs sixteen SHA-256-verified 2 MiB zero transfers with a shared 20-second deadline and no retry. Each transfer uses `tools/phone-ssh --fresh`, including its `OMAMOBILE_SSH_KEY` and `OMAMOBILE_SSH_KNOWN_HOSTS` settings. Direct interface binding defaults `OMAMOBILE_SSH_CONFIG` to `/dev/null`; an incompatible explicit config is refused. Failures name the transfer and failed check and include SSH's stderr. Run it only after the device identity and storage checks pass; USB tracing is separately required to establish that aggregation retry was exercised. It does not test laptop sleep or USB replug. + +The November 11 integration was built on +`fc7086a68fcaaed8960d09f1bdf6c51c9926c759`. Its local checks passed W=1 builds of seven touched C +files, ten Google device trees without new dtbs_check warnings, four binding +checks, policy and strict checkpatch without errors. New-file coverage +warnings and one continuation-alignment check remain disclosed in the PRs. +A complete Image, Bluejay DTB and 1,828 modules also build for +`7.3.0-rc6-omamobile-bluejay-review-20261111`; the full build has two format +warnings in unchanged AoC ALSA code. Matching dependency indexes and module +resolution pass. The revised build has not been installed or booted on the +phone at that build checkpoint. Current source revisions, review and CI belong +in the individual kernel PRs. + +This is build/policy evidence, not runtime qualification of the rebased stack. +The tested source is the contributor's `bringup/bluejay-tested-20261108`, commit `c934e316b`, based on `29a7a9326bf0`; the tested release is `7.3.0-rc6-omamobile-bluejay-input-gated0`. @@ -35,12 +49,16 @@ which follows #562 for its matching root-ready marker. The planned Bluejay package builds on the passive first-light proposal [#346](https://github.com/derekross/omarchy-mobile/pull/346). Kernel-release pins, module hashes and experimental startup belong in `device/bluejay/bringup/` until their dependencies merge. No combined package -agreement with #346's author or new phone qualification is claimed here. +agreement with #346's author or passive-package phone migration is claimed here. +A proposed follow-up that would make the package own `boot-update.conf` +was not taken; #346 stays passive. Replacing the old active development +package still needs an attended migration of the startup files it owns +and a smoke report with the passive package installed. The tested overlays, startup files, Aquamarine patch and probe tools remain inspectable at [the immutable #543 source](https://github.com/latentoperator/omarchy-mobile/tree/6ad4651f8ac151333345c72db99f1fd83259696f). The subsystem plans describe them historically; their relative file paths do -not imply that this documentation-only PR installs those files. The original +not imply that these status notes install those files. The original #543 is closed unmerged in favour of documentation [#561](https://github.com/derekross/omarchy-mobile/pull/561), initramfs #562, installer #563 and bring-up #565. diff --git a/tests/all b/tests/all index 2979afca7..3980d1eb2 100755 --- a/tests/all +++ b/tests/all @@ -75,6 +75,8 @@ fi python3 tests/bluejay-root-ready.py echo "# tests/phone-ssh" tests/phone-ssh +echo "# tests/ncm-transfer" +tests/ncm-transfer echo "# tests/module-load-once" tests/module-load-once # One suite per line from here on, so two pull requests that each add one diff --git a/tests/ncm-transfer b/tests/ncm-transfer new file mode 100755 index 000000000..05ca28d77 --- /dev/null +++ b/tests/ncm-transfer @@ -0,0 +1,133 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Real phone-ssh settings with a stand-in ssh; no network or phone access. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +python3 - <<'PY' +import json +import os +from pathlib import Path +import runpy +import subprocess +import sys +import tempfile +from unittest.mock import MagicMock, patch + +tool = Path('tools/ncm-transfer').resolve() +with tempfile.TemporaryDirectory(prefix='ncm-transfer-') as scratch: + scratch = Path(scratch) + fake = scratch / 'ssh' + fake.write_text('''#!/usr/bin/env python3 +import json, os, sys +from pathlib import Path +log = Path(os.environ['NCM_TEST_LOG']) +with log.open('a') as f: + f.write(json.dumps(sys.argv[1:]) + '\\n') +mode = os.environ.get('NCM_TEST_MODE', 'ok') +if mode == 'third' and len(log.read_text().splitlines()) == 3: + mode = 'ssh' +if mode == 'ssh': + print('Host key verification failed (fixture)', file=sys.stderr) + sys.exit(255) +if mode == 'short': + sys.stdout.buffer.write(bytes(7)) +elif mode == 'digest': + sys.stdout.buffer.write(b'x' * 2097152) +else: + sys.stdout.buffer.write(bytes(2097152)) +''') + fake.chmod(0o755) + key = scratch / 'key with spaces' + known = scratch / 'known hosts' + key.write_text('fixture key\n') + known.write_text('fixture host key\n') + log = scratch / 'calls' + env = {k: v for k, v in os.environ.items() if not k.startswith('OMAMOBILE_SSH_')} + env.update(PATH=str(scratch) + os.pathsep + env['PATH'], NCM_TEST_LOG=str(log), + OMAMOBILE_SSH_KEY=str(key), OMAMOBILE_SSH_KNOWN_HOSTS=str(known), + OMAMOBILE_SSH_HOST_KEY_ALIAS='phone-fixture', OMAMOBILE_SSH_SHARE='1') + args = ['--peer', 'root@192.0.2.1', '--interface', 'usb-fixture'] + + def invoke(mode='ok', cli=None, extra=None): + log.unlink(missing_ok=True) + result = subprocess.run([str(tool), *(args if cli is None else cli)], + env=dict(env, NCM_TEST_MODE=mode, **(extra or {})), + capture_output=True, text=True, timeout=25) + calls = [json.loads(line) for line in log.read_text().splitlines()] if log.exists() else [] + return result, calls + + result, calls = invoke() + assert result.returncode == 0, result.stderr + assert len(calls) == 16 and result.stdout.count('SHA-256 verified') == 16 + for call in calls: + for option in ('ControlMaster=no', 'ControlPath=none', 'StrictHostKeyChecking=yes', + 'HostKeyAlias=phone-fixture', 'ConnectTimeout=5', str(key), + 'UserKnownHostsFile="' + str(known) + '"', '/dev/null', + 'root@192.0.2.1', 'head -c 2097152 /dev/zero'): + assert option in call, (option, call) + proxy, = (x for x in call if x.startswith('ProxyCommand=')) + assert '--relay usb-fixture 192.0.2.1 5' in proxy, proxy + assert 'ControlMaster=auto' not in call + print('ok - sixteen verified transfers use fresh pinned phone-ssh settings and interface binding') + + for mode, diagnostic in [('ssh', 'phone-ssh exited 255'), ('short', 'received 7'), + ('digest', 'SHA-256 mismatch'), ('third', 'transfer 3/16')]: + result, calls = invoke(mode) + assert result.returncode != 0 and diagnostic in result.stderr, result + assert len(calls) == (3 if mode == 'third' else 1), calls + if mode in ('ssh', 'third'): + assert 'Host key verification failed (fixture)' in result.stderr + print('ok - ' + mode + ' names the failed check and stops without retry') + + for cli in ([], ['--peer', 'root@192.0.2.1'], + ['--peer=-V', '--interface', 'usb-fixture'], + ['--peer', 'root@192.0.2.1', '--interface=-V'], + ['--peer', 'root@192.0.2.1', '--interface', 'off'], + ['--peer', 'root@192.0.2.1', '--interface', 'auto'], + ['--peer', 'root@192.0.2.1', '--interface', 'x' * 16]): + result, calls = invoke(cli=cli) + assert result.returncode == 2 and not calls, result + print('ok - missing and invalid arguments fail before SSH') + + result, calls = invoke(extra={'OMAMOBILE_SSH_CONFIG': str(scratch / 'explicit config')}) + assert result.returncode != 0 and not calls + assert 'requires explicit OMAMOBILE_SSH_CONFIG=/dev/null' in result.stderr + print('ok - incompatible explicit SSH config is diagnosed, never ignored') + + # Exercise the shared deadline without waiting 20 seconds or opening a process. + for times, timeout in [([0, 21], False), ([0, 1], True)]: + process = MagicMock() + process.pid = 123456 + process.communicate.side_effect = [subprocess.TimeoutExpired('fixture', 19), (b'', b'timeout fixture')] + with patch.object(sys, 'argv', [str(tool), *args]), \ + patch('time.monotonic', side_effect=times), \ + patch('subprocess.Popen') as popen, patch('os.killpg') as killpg: + popen.return_value.__enter__.return_value = process + try: + runpy.run_path(str(tool), run_name='__main__') + raise AssertionError('deadline did not stop the stage') + except SystemExit as error: + assert '20-second stage deadline' in str(error), error + assert popen.call_count == int(timeout) + if timeout: + assert popen.call_args.kwargs['start_new_session'] is True + assert process.communicate.call_args_list[0].kwargs['timeout'] == 19 + killpg.assert_called_once_with(process.pid, 9) + else: + killpg.assert_not_called() + print('ok - elapsed stage deadline and transfer timeout both stop immediately') + + process = MagicMock() + process.pid = 123456 + process.communicate.side_effect = [KeyboardInterrupt(), (b'', b'')] + with patch.object(sys, 'argv', [str(tool), *args]), \ + patch('subprocess.Popen') as popen, patch('os.killpg') as killpg: + popen.return_value.__enter__.return_value = process + try: + runpy.run_path(str(tool), run_name='__main__') + raise AssertionError('interrupt did not stop the stage') + except KeyboardInterrupt: + pass + killpg.assert_called_once_with(process.pid, 9) + print('ok - interruption stops the SSH process group before exiting') +PY diff --git a/tools/ncm-transfer b/tools/ncm-transfer new file mode 100755 index 000000000..4e41c8239 --- /dev/null +++ b/tools/ncm-transfer @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Pull 16 exact 2 MiB zero streams over an explicitly selected USB SSH link. + +Example: tools/ncm-transfer --peer root@ --interface +Uses phone-ssh --fresh and its OMAMOBILE_SSH_* identity and host-key settings. +Direct interface binding defaults OMAMOBILE_SSH_CONFIG to /dev/null; an +explicit incompatible config is refused by phone-ssh rather than ignored. +The peer needs head and SSH. No device files or partitions are modified. +No retries: the first timeout, SSH error, size or digest mismatch stops the run. +Run only after the device's read-only identity and storage-guard checks pass. +This reproduces the transfer profile; use USB tracing separately to establish +whether a full request pool exercised the aggregation retry. +""" +import argparse +import hashlib +import os +import re +import signal +import subprocess +import sys +import time +from pathlib import Path + +parser = argparse.ArgumentParser(description=__doc__) +parser.add_argument('--peer', required=True) +parser.add_argument('--interface', required=True) +args = parser.parse_args() +if not re.fullmatch(r'[A-Za-z0-9_][A-Za-z0-9_.:@-]*', args.peer): + parser.error('invalid SSH peer') +if args.interface in ('off', 'auto') or not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9_.:-]{0,14}', args.interface): + parser.error('invalid host interface') +ssh = Path(__file__).resolve().with_name('phone-ssh') +env = dict(os.environ, OMAMOBILE_SSH_HOST=args.peer, + OMAMOBILE_SSH_INTERFACE=args.interface, SSH_ASKPASS_REQUIRE='never') +env.setdefault('OMAMOBILE_SSH_CONFIG', '/dev/null') +env.setdefault('OMAMOBILE_SSH_CONNECT_TIMEOUT', '5') + + +def fail(message, stderr=b''): + if stderr: + print(stderr.decode(errors='replace').rstrip(), file=sys.stderr) + raise SystemExit(f'FAIL: transfer {index + 1}/16: {message}; stopped without retry') + + +def stop_transfer(process): + try: + os.killpg(process.pid, signal.SIGKILL) + except ProcessLookupError: + pass + return process.communicate() + + +def interrupted(signum, _frame): + raise SystemExit(128 + signum) + + +for signum in (signal.SIGTERM, signal.SIGHUP): + signal.signal(signum, interrupted) + + +size = 2 * 1024 * 1024 +expected = hashlib.sha256(bytes(size)).digest() +deadline = time.monotonic() + 20 +for index in range(16): + remaining = deadline - time.monotonic() + if remaining <= 0: + fail('20-second stage deadline') + try: + # No controlling terminal or interactive key prompt, and a timeout + # stops the SSH proxy as well as SSH itself. + with subprocess.Popen([str(ssh), '--fresh', 'head -c 2097152 /dev/zero'], + stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, env=env, start_new_session=True) as process: + try: + output, errors = process.communicate(timeout=remaining) + except subprocess.TimeoutExpired: + output, errors = stop_transfer(process) + fail('transfer timeout within 20-second stage deadline', errors) + except BaseException: + stop_transfer(process) + raise + except OSError as error: + fail(f'could not start phone-ssh: {error}') + if process.returncode: + fail(f'phone-ssh exited {process.returncode}', errors) + if len(output) != size: + fail(f'size mismatch: expected {size} bytes, received {len(output)}', errors) + if hashlib.sha256(output).digest() != expected: + fail('SHA-256 mismatch', errors) + print(f'ok - transfer {index + 1}/16: {size} bytes, SHA-256 verified', flush=True)