diff --git a/device/oriole/NOTES.md b/device/oriole/NOTES.md index 3cd57fd6f..745ab407d 100644 --- a/device/oriole/NOTES.md +++ b/device/oriole/NOTES.md @@ -9,6 +9,80 @@ Sources: - `U/`: upstream Linux v7.0, `arch/arm64/boot/dts/exynos/google/gs101*.dts(i)`. - `P/`: postmarketOS pmaports [`device/testing/device-google-oriole`](https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/main/device/testing/device-google-oriole), [`soc-google-gs101`](https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/main/device/testing/soc-google-gs101) and [`linux-postmarketos-gs101`](https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/main/device/testing/linux-postmarketos-gs101) (7.0.6), which builds [gs101-mainline/linux @ d28cfa42](https://github.com/gs101-mainline/linux/tree/d28cfa4275b95e93f4b7a1e743de31b723bd21b8). +## 2026-11-08: offline audit of omitted startup safeguards + +[V, recovered private checker and unit] The companion's boot check is gated +by `omamobile.oriole-staged`, requires private initramfs assets and an armed +handoff-watchdog process, and checks protected storage, the compositor, +shell IPC and staged touch state. Only after success does it disarm the +watchdog, record the kernel release and clear the persistent boot-in-progress +marker. The matching staged initramfs uses a leftover marker for guarded USB +rescue before providers. This is Linux startup/recovery state, not ABL +boot-success marking: the checker does not write boot metadata. Its private +paths, touch interface and rendering assumptions prevent treating it as a +generic public device-package service. + +[V, recovered configuration] The companion separately retains cheetah's +`RebootWatchdogSec=1min`. The checker requires an open `/dev/watchdog0` and +checks disarm, but source prerequisites are not a public-kernel binding or +shutdown-reset test. No such standalone qualification was established by +this offline audit. Neither watchdog mechanism certifies slot success. + +The README and descriptor now explicitly say that an image with this package +alone is not yet a supported install. Public startup/recovery integration and +its hardware qualification remain separate work. No private services, +battery code, boot-success writes or watchdog configuration were added; +no phone access or new hardware result is claimed. + +## 2026-11-07: first-light 0.2.0 package installed with local safeguards + +[V] Native `makepkg` build/check/package passed for `0.2.0-1` on the Pixel 6. +The build used a separate `BUILDDIR`, preserving the package's source tree +during makepkg clean-build preparation. Version 0.2.0 satisfies the existing +hardware packages' minimum device-package dependencies; a 0.1.0 transaction +was rejected by the normal dependency check before any package changes. + +[V] On `7.3.0-rc6-oriole-hsi1-late-dev0-g4bd35d34abb9-dirty`, normal signed +`pacman -U` installed `omamobile-device-oriole 0.2.0-1` together with a private +`omamobile-oriole-local-safeguards 0.1.9-2` package. The latter preserves the +original boot-check/battery scripts and units, power-key policy and reboot +watchdog policy byte for byte. It is not part of this public package or a +standalone-image qualification. All archive signatures were verified against +the existing phone keyring; dependency, signature and hook checks stayed on. + +[V] Fresh SSH, safeguard hashes, package ownership, enabled units, repository +configuration/channel and pacman database checks passed. The existing local +mirrorlist was retained, with the incoming default saved as `.pacnew`. A +laptop kernel log, owned marker and bounded rollback timer covered the +transaction; systemd's supported update marker prevented a udev retrigger. +The timer and only this test's markers were cleared after validation. + +[V] `phone-smoke` passed every required check: slot B, 49-partition storage +guard, root, kernel health, USB and session. It still reported existing +error-level kernel messages and the backlight/NFC low-battery startup +refusals. Battery reported 70% Charging. No kernel fault was observed in the +transaction log. No reboot, flash, provider retry or shell restart occurred. +Rollback ownership transfer passed offline; live rollback and a boot of this +package combination remain untested. Do not replace an integration package +with this public package alone. + +## 2026-11-07: first-light package native staging check + +[V] Package source at `d32957dc3feb` passed `test/all` on the Pixel 6 +(`aarch64`), running +`7.3.0-rc6-oriole-hsi1-late-dev0-g4bd35d34abb9-dirty`. The reboot helper +compiled and installation into a temporary directory passed the file, +USB-route, coldplug and disabled-sleep checks. Temporary files were removed. +The package was not installed; `omamobile-device-oriole 0.1.9-2` remains. + +[V] A separate baseline `phone-smoke` report passed the required boot, +storage, root, kernel-health, USB and session checks. It also reported new +error-level kernel messages and failed backlight/NFC units; both units +reported `Battery outside development limits`. This is not a clean report +or an exact-package boot qualification. The first-light package omits the +installed boot-check, battery and reboot-watchdog safeguards, so replacing +the integration package still needs a qualified migration and rollback. + ## 2026-10-31: build provenance and recovery limits This describes the unpublished stack in the October 30 smoke report. It is @@ -126,6 +200,12 @@ helper's logic or from a later backup. No new metadata write was attempted. - [V, source] On the published kernel's `omamobile` branch, the S2MPG10 alarm callback reads `S2MPS14_REG_ST2` at offset `0x08`. On S2MPG10 that is `INT3M`; [Google's register definitions](https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/include/linux/mfd/samsung/s2mpg10-register.h) place `STATUS2` at `0x0d`, and its [RTC driver](https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/rtc/rtc-s2mpg10.c) reads the alarm-0 status bit there. The proposed kernel fix, [linux-omarchy-mobile#149](https://github.com/derekross/linux-omarchy-mobile/pull/149), is S2MPG10-specific; the S2MPG12 path remains unchanged. The test phone's unpublished kernel already contains the correction. - [I] The smoke test does not exercise a live pending alarm, alarm delivery, suspend or wake. Those paths remain to be independently verified. +## 2026-10-17: coldplug audit on the first-light kernel + +[V] On `7.3.0-rc6-omamobile-oriole-firstlight-g4bd35d34abb9-dirty`, a read-only audit of unbound platform, I2C and SPI devices found module matches for `clk_acpm`, `max77759_charger`, `gpio_max77759`, `arm_dsu_pmu`, `at24` and `max17042_battery`. The local device policy blocked both alias autoload and direct modprobe; dry runs confirmed the refusals. The audit did not load any of these modules, so it does not establish what each would do when loaded. These blocks are conservative bring-up policy, not proof of individual driver failure. + +[V] The local native integration later used a separate experimental read-only `oriole-battery-readonly` provider, publishing `omamobile-battery`, to report battery telemetry; it did not use `max17042_battery`. Its kernel charging status remained Unknown. UPower inference and a separate charger-status observation do not establish charging control or prove that the upstream charger driver is safe. The public package contains neither that experimental provider nor its startup service; battery reporting is not guaranteed by this policy package. + ## 2026-10-16: stage 0, part 2: a retail Pixel 6 (stock, bootloader locked) Read-only queries (`adb shell getprop`, `/dev/block/by-name`, `fastboot getvar all`) of a stock phone; facts only, no serial numbers. diff --git a/device/oriole/device.conf b/device/oriole/device.conf index d52866e6a..ce918e3e8 100644 --- a/device/oriole/device.conf +++ b/device/oriole/device.conf @@ -13,6 +13,8 @@ NAME="Pixel 6" SOC=gs101 # First string of the upstream DT root compatible (gs101-oriole.dts). COMPATIBLE="google,gs101-oriole" +# This package alone is not yet a supported install: images omit the private +# staged-start/recovery safeguards. See packages/omamobile-device-oriole/README.md. PACKAGE=omamobile-device-oriole # --- Kernel and device tree --- diff --git a/packages/omamobile-device-oriole/LICENSE b/packages/omamobile-device-oriole/LICENSE new file mode 100644 index 000000000..aecd59624 --- /dev/null +++ b/packages/omamobile-device-oriole/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Derek Ross + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/omamobile-device-oriole/PKGBUILD b/packages/omamobile-device-oriole/PKGBUILD new file mode 100644 index 000000000..3befe18d6 --- /dev/null +++ b/packages/omamobile-device-oriole/PKGBUILD @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: MIT +pkgname=omamobile-device-oriole +pkgver=$(cat "${startdir:-.}/version") +pkgrel=1 +pkgdesc="Pixel 6 first-light support: storage policy, USB networking and boot helpers" +arch=(aarch64) +url="https://github.com/derekross/omarchy-mobile" +license=(MIT) +depends=(bash systemd util-linux omamobile-keyring) +provides=(omamobile-device) +conflicts=(omamobile-device) +install=omamobile-device-oriole.install +makedepends=(gcc) +checkdepends=(python) +backup=(etc/UPower/UPower.conf.d/20-omamobile-critical-power.conf etc/pacman.d/omamobile-mirrorlist) + +build() { "$startdir/build" "$srcdir/build"; } +check() { "$startdir/test/all"; } +package() { "$startdir/install" "$pkgdir" "$srcdir/build"; } diff --git a/packages/omamobile-device-oriole/README.md b/packages/omamobile-device-oriole/README.md new file mode 100644 index 000000000..50e273796 --- /dev/null +++ b/packages/omamobile-device-oriole/README.md @@ -0,0 +1,80 @@ + +# Pixel 6 first-light policy + +**This package alone is not yet a supported Pixel 6 install.** An image +built from `device/oriole/device.conf` receives this package without the +private integration safeguards described below. Do not use that image as a +standalone installation or replace an integration package with it alone. + +Minimal first-light policy package, version 0.2.0. No kernel, rootfs integration or +hardware qualification is supplied. Installation stages files only and enables +no services. The optional system setup command configures locale/time and +enables timesyncd. + +Portable helpers, build script, USB network policy and storage udev policy +come from the cheetah package. The storage rules continue an existing +initramfs guard: they do not set partitions read-only themselves. A guarded +initramfs and matching kernel remain prerequisites. USB gadget creation and +networkd activation are also external prerequisites. USB has fallback metric +2000, below ordinary Wi-Fi preference. + +All four sleep modes are disabled. UPower selects PowerOff on critical +battery. Coldplug blocks alias and explicit modprobe for clk_acpm, +max77759_charger, gpio_max77759, arm_dsu_pmu, at24 and max17042_battery. +The [coldplug audit](../../device/oriole/NOTES.md) found matching unbound devices and confirmed that +modprobe dry runs refused these modules; it did not load them or establish +their behavior. This package does not qualify the underlying hardware. +Built-in drivers are outside modprobe policy. + +No battery startup, staged boot checker, automatic boot-success, radio, +charging or GS201 hardware services are included. Boot-control tooling is +omitted while slot marking remains on hold. Native ARM64 build and +installation passed with a private companion preserving +existing integration safeguards; see the 2026-11-07 entries in +[NOTES](../../device/oriole/NOTES.md). Standalone installation and a boot of +this package combination remain unqualified. + +The PowerOff action has not been qualified for oriole; Linux power-off on other +Pixels can restart instead. + +Run test/all for a native helper build and +staged installation checks. Version 0.2.0 sorts above the local integration +package 0.1.9-2, satisfying existing hardware-package version dependencies. +That integration package carries +boot and battery safeguards absent here. Replacing it requires a separately +qualified migration and rollback; do not remove it as a routine upgrade. + +## Omitted startup safeguards and boot-success marking + +The private companion's boot check is a staged-start guard, not a slot-success +marker. Its opt-in unit requires private initramfs assets, a matching kernel +and a bounded handoff-watchdog process. It checks protected storage, the +compositor, shell and staged touch state before disarming that watchdog and +clearing the persistent boot-in-progress marker. The matching initramfs uses a +leftover marker to select guarded USB rescue before starting providers. +The checker writes Linux state files; it does not mark slot B successful or +write boot metadata. See the [guard audit in NOTES](../../device/oriole/NOTES.md). + +Those private assets and the companion's battery/startup policy are not a +portable device-package service. A supported standalone image needs a public, +matched startup/recovery path and its boot qualification first; this PR does +not import the private stack or enable services to approximate it. + +Boot-success marking is separate and remains outside this package, pending +[#252](https://github.com/derekross/omarchy-mobile/issues/252) and Oriole's +qualification. On an unmarked B slot, ABL can exhaust its retry budget +(normally three attempts) and select A. The staged-start guard does not reset +that budget. With native Linux on userdata, selecting stock A is not a usable +Android recovery without deliberate userdata restoration; do not rely on an +automatic stock fallback. If stock Android does come up, decline any offer +to reset and take fresh read-only backups of the protected radio partitions +after any stock boot (`efs`, `efs_backup`, `modem_userdata`, `persist` and +`modem_a/b`) before further radio work. + +The private companion also preserves `RebootWatchdogSec=1min`. That setting +only bounds a stuck shutdown when a usable watchdog driver is bound; it does +not replace the startup guard or mark a slot successful. The recovered checker +requires an open `/dev/watchdog0` and verifies disarm, but this audit does not +establish a watchdog-binding/shutdown-reset qualification for a standalone +public-kernel image. The copied cheetah setting is therefore deferred with the +other omitted safeguards, rather than presented as a qualified recovery path. diff --git a/packages/omamobile-device-oriole/bin/omamobile-setup-system b/packages/omamobile-device-oriole/bin/omamobile-setup-system new file mode 100755 index 000000000..1c485bf7d --- /dev/null +++ b/packages/omamobile-device-oriole/bin/omamobile-setup-system @@ -0,0 +1,18 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Oriole's system setup: locale and time only, with no hardware services. +set -euo pipefail + +[[ $(id -u) == 0 ]] || { echo "Run as root" >&2; exit 1; } +if [[ -n ${1:-} ]]; then + [[ $1 =~ ^[A-Za-z0-9_+-]+(/[A-Za-z0-9_+-]+)*$ && $1 != *..* && + -f /usr/share/zoneinfo/$1 ]] || { echo "Invalid time zone" >&2; exit 1; } +fi + +sed -i 's/^#\(en_US.UTF-8 UTF-8\)/\1/' /etc/locale.gen +locale-gen >/dev/null +printf 'LANG=en_US.UTF-8\n' > /etc/locale.conf +if [[ -n ${1:-} ]]; then + ln -sfn "/usr/share/zoneinfo/$1" /etc/localtime +fi +systemctl enable systemd-timesyncd.service >/dev/null diff --git a/packages/omamobile-device-oriole/build b/packages/omamobile-device-oriole/build new file mode 100755 index 000000000..f1d93f8cd --- /dev/null +++ b/packages/omamobile-device-oriole/build @@ -0,0 +1,8 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Compile the C tools into BUILDDIR (default: build). +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" +out=${1:-build} +mkdir -p "$out" +${CC:-cc} ${CFLAGS:--O2} -Wall -Wextra -o "$out/reboot-to" src/reboot-to.c ${LDFLAGS:-} diff --git a/packages/omamobile-device-oriole/config/UPower/UPower.conf.d/20-omamobile-critical-power.conf b/packages/omamobile-device-oriole/config/UPower/UPower.conf.d/20-omamobile-critical-power.conf new file mode 100644 index 000000000..38636e5c7 --- /dev/null +++ b/packages/omamobile-device-oriole/config/UPower/UPower.conf.d/20-omamobile-critical-power.conf @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: MIT +# Unsupported sleep modes are disabled. UPower 1.91.5's Auto policy can +# select Ignore when CanSleep is unavailable; keep depletion protection. +# Oriole power-off has not been qualified and may restart the phone. +[UPower] +CriticalPowerAction=PowerOff diff --git a/packages/omamobile-device-oriole/etc/omamobile-mirrorlist b/packages/omamobile-device-oriole/etc/omamobile-mirrorlist new file mode 100644 index 000000000..f9be3d0e9 --- /dev/null +++ b/packages/omamobile-device-oriole/etc/omamobile-mirrorlist @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: MIT +# Where pacman gets Omarchy Mobile's packages ([omamobile] in /etc/pacman.conf). +# +# The one active Server line is the channel this phone follows: +# stable what has run on the Pixel 7 Pro; phones installed from a +# release follow it +# development every day's build, first; for builders and testers +# local the repository on the phone itself, /var/lib/omamobile/repo, +# filled from a build machine by tools/repo-push +# +# Switch with: sudo omamobile-update channel development (or stable, local) +# See which: omamobile-update check +# +# pacman keeps a changed copy of this file across upgrades (backup= in the +# device package); a new default then arrives as omamobile-mirrorlist.pacnew. +Server = https://pkgs.omamobile.org/stable/$arch +#Server = https://pkgs.omamobile.org/development/$arch +#Server = file:///var/lib/omamobile/repo/$arch diff --git a/packages/omamobile-device-oriole/install b/packages/omamobile-device-oriole/install new file mode 100755 index 000000000..4cf89033f --- /dev/null +++ b/packages/omamobile-device-oriole/install @@ -0,0 +1,25 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Stage files only. No service activation or boot-success writes. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" +destination=${1:?Usage: ./install DESTDIR [BUILDDIR]} +build=${2:-build} +[[ $destination == /* && $destination != / ]] || { echo "Use an absolute staging directory" >&2; exit 1; } +for tool in reboot-to; do + install -Dm755 "$build/$tool" "$destination/usr/bin/$tool" +done +for tool in omamobile-setup-system; do + install -Dm755 "bin/$tool" "$destination/usr/bin/$tool" +done +while IFS= read -r -d '' file; do + install -Dm644 "$file" "$destination/usr/lib/${file#vendor/}" +done < <(find vendor -type f -print0) +while IFS= read -r -d '' file; do + install -Dm644 "$file" "$destination/etc/${file#config/}" +done < <(find config -type f -print0) +install -Dm644 etc/omamobile-mirrorlist "$destination/etc/pacman.d/omamobile-mirrorlist" +for file in LICENSE; do + install -Dm644 "$file" "$destination/usr/share/licenses/omamobile-device-oriole/$file" +done +install -Dm644 version "$destination/usr/share/omamobile/device-oriole/version" diff --git a/packages/omamobile-device-oriole/omamobile-device-oriole.install b/packages/omamobile-device-oriole/omamobile-device-oriole.install new file mode 100644 index 000000000..96da5786e --- /dev/null +++ b/packages/omamobile-device-oriole/omamobile-device-oriole.install @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: MIT +# Add the [omamobile] repository to pacman.conf, before [omarchy] so its +# builds (e.g. Mesa with Mali-G710 support) win. Added once; never removed +# automatically, so a user's edits stay. +add_repository() { + local conf=/etc/pacman.conf + grep -q '^\[omamobile\]' "$conf" && return + local entry='[omamobile]\nInclude = /etc/pacman.d/omamobile-mirrorlist\n' + if grep -q '^\[omarchy\]' "$conf"; then + sed -i "0,/^\[omarchy\]/s//${entry//\//\\/}\n[omarchy]/" "$conf" + elif grep -q '^\[core\]' "$conf"; then + sed -i "0,/^\[core\]/s//${entry//\//\\/}\n[core]/" "$conf" + else + printf '\n[omamobile]\nInclude = /etc/pacman.d/omamobile-mirrorlist\n' >>"$conf" + fi +} + +# --- the [omamobile] channel (identical in every device package) --- +# The mirrorlist names the channel (stable, development or local). It is a +# backup= file, so pacman keeps a changed copy; an unchanged one, though, is +# replaced by the new default. Phones from before 2026-11-01 read the +# repository on the phone (file:///var/lib/omamobile/repo, filled by +# tools/repo-push), unchanged, and would silently move to stable: such a phone +# keeps reading its own repository, and is told how to switch. +OMAMOBILE_MIRRORLIST=/etc/pacman.d/omamobile-mirrorlist +OMAMOBILE_LOCAL_MARK=/var/lib/omamobile/.mirrorlist-was-local +OMAMOBILE_LOCAL_SERVER='Server = file:///var/lib/omamobile/repo/$arch' + +remember_local_channel() { + [[ -f $OMAMOBILE_MIRRORLIST ]] || return 0 + if grep -qxF "$OMAMOBILE_LOCAL_SERVER" "$OMAMOBILE_MIRRORLIST"; then + mkdir -p "${OMAMOBILE_LOCAL_MARK%/*}" && : > "$OMAMOBILE_LOCAL_MARK" + fi +} + +keep_local_channel() { + [[ -e $OMAMOBILE_LOCAL_MARK ]] || return 0 + rm -f "$OMAMOBILE_LOCAL_MARK" + [[ -f $OMAMOBILE_MIRRORLIST ]] || return 0 + grep -qxF "$OMAMOBILE_LOCAL_SERVER" "$OMAMOBILE_MIRRORLIST" && return 0 + # Comment out every Server line, then turn the local one back on + sed -i -E 's|^([[:space:]]*Server[[:space:]]*=)|#\1|' "$OMAMOBILE_MIRRORLIST" + sed -i 's|^#Server = file:///var/lib/omamobile/repo/\$arch$|Server = file:///var/lib/omamobile/repo/$arch|' "$OMAMOBILE_MIRRORLIST" + grep -qxF "$OMAMOBILE_LOCAL_SERVER" "$OMAMOBILE_MIRRORLIST" || + printf '%s\n' "$OMAMOBILE_LOCAL_SERVER" >>"$OMAMOBILE_MIRRORLIST" + echo "==> [omamobile] stays on this phone's own repository (/var/lib/omamobile/repo)." + echo " Installed phones follow the stable channel at pkgs.omamobile.org; switch with" + echo " sudo omamobile-update channel stable (or development)" +} + +pre_upgrade() { + remember_local_channel +} + +post_install() { + add_repository +} + +post_upgrade() { + add_repository + keep_local_channel +} diff --git a/packages/omamobile-device-oriole/src/reboot-to.c b/packages/omamobile-device-oriole/src/reboot-to.c new file mode 100644 index 000000000..f79e948ed --- /dev/null +++ b/packages/omamobile-device-oriole/src/reboot-to.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +// reboot-to: reboot with a reason the Pixel bootloader understands, +// e.g. "reboot-to bootloader" lands in fastboot. +// The kernel's syscon-reboot-mode driver stores the reason in the PMU +// before the reset; busybox reboot can't pass one. +#include +#include +#include + +/* From (stable ABI); musl's sysroot has no kernel headers */ +#define LINUX_REBOOT_MAGIC1 0xfee1dead +#define LINUX_REBOOT_MAGIC2 672274793 +#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 + +int main(int argc, char **argv) +{ + const char *reason = argc > 1 ? argv[1] : "bootloader"; + + sync(); + syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, + LINUX_REBOOT_CMD_RESTART2, reason); + perror("reboot"); + return 1; +} diff --git a/packages/omamobile-device-oriole/test/all b/packages/omamobile-device-oriole/test/all new file mode 100755 index 000000000..c0763b722 --- /dev/null +++ b/packages/omamobile-device-oriole/test/all @@ -0,0 +1,63 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +t=$(mktemp -d) +trap 'rm -rf "$t"' EXIT +./build "$t/build" +echo 'ok - reboot helper compiles' +./install "$t/root" "$t/build" +for file in usr/bin/reboot-to usr/bin/omamobile-setup-system \ + usr/lib/udev/rules.d/10-omamobile-storage.rules \ + usr/lib/systemd/network/20-usb-gadget.network \ + usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf \ + usr/lib/systemd/sleep.conf.d/20-omamobile-unqualified-sleep.conf \ + etc/UPower/UPower.conf.d/20-omamobile-critical-power.conf \ + usr/lib/modprobe.d/omamobile-oriole-bringup.conf \ + etc/pacman.d/omamobile-mirrorlist \ + usr/share/licenses/omamobile-device-oriole/LICENSE; do + test -f "$t/root/$file" +done +test ! -d "$t/root/usr/lib/systemd/system/multi-user.target.wants" +# Exercise the same destination refusal without targeting the host root. +if ./install relative-dir "$t/build" > "$t/refusal" 2>&1; then + echo 'not ok - installation must refuse a relative destination' >&2 + exit 1 +fi +grep -Fx 'Use an absolute staging directory' "$t/refusal" +echo 'ok - installation stages policy and helpers, with no enabled hardware services' + +python3 - "$t/root/usr/lib/systemd/network/20-usb-gadget.network" <<'PY_ROUTE' +import configparser, sys +network = configparser.ConfigParser(strict=False) +network.read(sys.argv[1]) +assert network['Match']['Name'] == 'usb0' +assert network['Network']['Address'] == '172.16.42.1/24' +assert 'Gateway' not in network['Network'] +assert network['Route']['Gateway'] == '172.16.42.2' +assert int(network['Route']['Metric']) > 1024 +print('ok - USB keeps its direct SSH address and a fallback route below Wi-Fi priority') +PY_ROUTE + +python3 - "$t/root" <<'PY_POLICY' +from pathlib import Path +import sys +root = Path(sys.argv[1]) +policy = (root/'usr/lib/modprobe.d/omamobile-oriole-bringup.conf').read_text().splitlines() +for module in ('clk_acpm', 'max77759_charger', 'gpio_max77759', 'arm_dsu_pmu', 'at24', 'max17042_battery'): + assert f'blacklist {module}' in policy + assert f'install {module} /bin/false' in policy +sleep = (root/'usr/lib/systemd/sleep.conf.d/20-omamobile-unqualified-sleep.conf').read_text().splitlines() +for mode in ('Suspend', 'Hibernation', 'SuspendThenHibernate', 'HybridSleep'): + assert f'Allow{mode}=no' in sleep +assert not list(root.rglob('*.service')) +print('ok - coldplug refusals, disabled sleep modes and no service units') +PY_POLICY + +# Copied policy and helper must track the source package when present. +for file in src/reboot-to.c vendor/udev/rules.d/10-omamobile-storage.rules vendor/NetworkManager/conf.d/10-omamobile-usb.conf; do + if [[ -f ../omamobile-device-cheetah/$file ]]; then + cmp "$file" "../omamobile-device-cheetah/$file" + fi +done +test ! -e "$t/root/usr/bin/omamobile-bootctl" diff --git a/packages/omamobile-device-oriole/vendor/NetworkManager/conf.d/10-omamobile-usb.conf b/packages/omamobile-device-oriole/vendor/NetworkManager/conf.d/10-omamobile-usb.conf new file mode 100644 index 000000000..252de6e15 --- /dev/null +++ b/packages/omamobile-device-oriole/vendor/NetworkManager/conf.d/10-omamobile-usb.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +# Omarchy Mobile: the USB gadget link to the host (usb0) is configured by +# systemd-networkd; NetworkManager manages everything else (Wi-Fi later). +[keyfile] +unmanaged-devices=interface-name:usb0 diff --git a/packages/omamobile-device-oriole/vendor/modprobe.d/omamobile-oriole-bringup.conf b/packages/omamobile-device-oriole/vendor/modprobe.d/omamobile-oriole-bringup.conf new file mode 100644 index 000000000..3a2ce7617 --- /dev/null +++ b/packages/omamobile-device-oriole/vendor/modprobe.d/omamobile-oriole-bringup.conf @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: MIT +# Unqualified coldplug matches: block aliases and direct modprobe. +blacklist clk_acpm +install clk_acpm /bin/false +blacklist max77759_charger +install max77759_charger /bin/false +blacklist gpio_max77759 +install gpio_max77759 /bin/false +blacklist arm_dsu_pmu +install arm_dsu_pmu /bin/false +blacklist at24 +install at24 /bin/false +blacklist max17042_battery +install max17042_battery /bin/false diff --git a/packages/omamobile-device-oriole/vendor/systemd/network/20-usb-gadget.network b/packages/omamobile-device-oriole/vendor/systemd/network/20-usb-gadget.network new file mode 100644 index 000000000..973c61db7 --- /dev/null +++ b/packages/omamobile-device-oriole/vendor/systemd/network/20-usb-gadget.network @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: MIT +# Omarchy Mobile: USB networking to the host. The initramfs sets up the USB +# gadget (CDC NCM) before handing over to Arch; this gives it an address. +# The host shares its internet over this link (NetworkManager "shared" +# mode on 172.16.42.2), so it is also a gateway, the last one: Wi-Fi (600) +# and mobile data (700) go first. ConfigureWithoutCarrier keeps this route +# after an unplug (and usb0 keeps its carrier anyway), so at metric 0 IPv4 +# went into the dead cable once the phone left the desk: IPv4-only sites +# such as github.com failed on Wi-Fi while IPv6 ones loaded (raven, +# 2026-10-28). DNS goes to public resolvers. +[Match] +Name=usb0 + +[Network] +Address=172.16.42.1/24 +DNS=1.1.1.1 +DNS=9.9.9.9 +ConfigureWithoutCarrier=yes + +[Route] +Gateway=172.16.42.2 +Metric=2000 diff --git a/packages/omamobile-device-oriole/vendor/systemd/sleep.conf.d/20-omamobile-unqualified-sleep.conf b/packages/omamobile-device-oriole/vendor/systemd/sleep.conf.d/20-omamobile-unqualified-sleep.conf new file mode 100644 index 000000000..88bcf98e8 --- /dev/null +++ b/packages/omamobile-device-oriole/vendor/systemd/sleep.conf.d/20-omamobile-unqualified-sleep.conf @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: MIT +[Sleep] +AllowSuspend=no +AllowHibernation=no +AllowSuspendThenHibernate=no +AllowHybridSleep=no diff --git a/packages/omamobile-device-oriole/vendor/udev/rules.d/10-omamobile-storage.rules b/packages/omamobile-device-oriole/vendor/udev/rules.d/10-omamobile-storage.rules new file mode 100644 index 000000000..89c02cf30 --- /dev/null +++ b/packages/omamobile-device-oriole/vendor/udev/rules.d/10-omamobile-storage.rules @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: MIT +# Omarchy Mobile storage guard, continued in Arch. The initramfs marks every UFS +# partition read-only except slot B's boot images and userdata, and removes +# the whole-disk node of the main LUN. udev would recreate /dev/sda, so make +# the whole-disk node inaccessible and keep desktop tools from touching any +# Android partition. +SUBSYSTEM=="block", KERNEL=="sda", MODE="0000", ENV{UDISKS_IGNORE}="1" +SUBSYSTEM=="block", KERNEL=="sd[a-d][0-9]*", ENV{ID_PART_ENTRY_NAME}!="userdata", ENV{UDISKS_IGNORE}="1" diff --git a/packages/omamobile-device-oriole/version b/packages/omamobile-device-oriole/version new file mode 100644 index 000000000..0ea3a944b --- /dev/null +++ b/packages/omamobile-device-oriole/version @@ -0,0 +1 @@ +0.2.0