From bb430b10895cc8fca76ee18ad5b35fe3d988b246 Mon Sep 17 00:00:00 2001 From: Gr-linkk <280405187+Gr-linkk@users.noreply.github.com> Date: Sat, 31 Oct 2026 11:45:49 -0700 Subject: [PATCH 1/7] device-oriole: add minimal first-light policy package Recover portable helpers and shared policy without enabling hardware services. Keep experimental battery and boot-check services outside this initial package. --- packages/omamobile-device-oriole/LICENSE | 21 + .../LICENSE.Apache-2.0 | 73 ++++ packages/omamobile-device-oriole/PKGBUILD | 16 + packages/omamobile-device-oriole/README.md | 30 ++ .../bin/omamobile-setup-system | 18 + packages/omamobile-device-oriole/build | 9 + .../20-omamobile-critical-power.conf | 5 + packages/omamobile-device-oriole/install | 24 ++ .../src/omamobile-bootctl.c | 378 ++++++++++++++++++ .../omamobile-device-oriole/src/reboot-to.c | 24 ++ packages/omamobile-device-oriole/test/all | 68 ++++ .../conf.d/10-omamobile-usb.conf | 5 + .../modprobe.d/omamobile-oriole-bringup.conf | 14 + .../systemd/network/20-usb-gadget.network | 22 + .../20-omamobile-unqualified-sleep.conf | 6 + .../udev/rules.d/10-omamobile-storage.rules | 8 + packages/omamobile-device-oriole/version | 1 + 17 files changed, 722 insertions(+) create mode 100644 packages/omamobile-device-oriole/LICENSE create mode 100644 packages/omamobile-device-oriole/LICENSE.Apache-2.0 create mode 100644 packages/omamobile-device-oriole/PKGBUILD create mode 100644 packages/omamobile-device-oriole/README.md create mode 100755 packages/omamobile-device-oriole/bin/omamobile-setup-system create mode 100755 packages/omamobile-device-oriole/build create mode 100644 packages/omamobile-device-oriole/config/UPower/UPower.conf.d/20-omamobile-critical-power.conf create mode 100755 packages/omamobile-device-oriole/install create mode 100644 packages/omamobile-device-oriole/src/omamobile-bootctl.c create mode 100644 packages/omamobile-device-oriole/src/reboot-to.c create mode 100755 packages/omamobile-device-oriole/test/all create mode 100644 packages/omamobile-device-oriole/vendor/NetworkManager/conf.d/10-omamobile-usb.conf create mode 100644 packages/omamobile-device-oriole/vendor/modprobe.d/omamobile-oriole-bringup.conf create mode 100644 packages/omamobile-device-oriole/vendor/systemd/network/20-usb-gadget.network create mode 100644 packages/omamobile-device-oriole/vendor/systemd/sleep.conf.d/20-omamobile-unqualified-sleep.conf create mode 100644 packages/omamobile-device-oriole/vendor/udev/rules.d/10-omamobile-storage.rules create mode 100644 packages/omamobile-device-oriole/version 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/LICENSE.Apache-2.0 b/packages/omamobile-device-oriole/LICENSE.Apache-2.0 new file mode 100644 index 000000000..137069b82 --- /dev/null +++ b/packages/omamobile-device-oriole/LICENSE.Apache-2.0 @@ -0,0 +1,73 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/packages/omamobile-device-oriole/PKGBUILD b/packages/omamobile-device-oriole/PKGBUILD new file mode 100644 index 000000000..ffddb18b8 --- /dev/null +++ b/packages/omamobile-device-oriole/PKGBUILD @@ -0,0 +1,16 @@ +# 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 Apache-2.0) +depends=(bash systemd util-linux) +makedepends=(gcc) +checkdepends=(python) +backup=(etc/UPower/UPower.conf.d/20-omamobile-critical-power.conf) + +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..ebe3e0618 --- /dev/null +++ b/packages/omamobile-device-oriole/README.md @@ -0,0 +1,30 @@ + +# Pixel 6 first-light policy + +Initial standalone package, version 0.1.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. +These six names follow the recovered Oriole ROOTFS-PLAN coldplug audit; +this package makes no claim that the underlying hardware is qualified. +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 writes require +an explicit flag and separate human authorization. No phone testing was +performed for this package; exact-branch boot remains unqualified. + +Run test/all for a native helper build, synthetic boot-control dry run and +staged installation checks. Do not install on a phone without a separate +device-specific, watchdog-protected qualification gate and rollback. 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..bcaa40d21 --- /dev/null +++ b/packages/omamobile-device-oriole/build @@ -0,0 +1,9 @@ +#!/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/omamobile-bootctl" src/omamobile-bootctl.c ${LDFLAGS:-} +${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..a942007eb --- /dev/null +++ b/packages/omamobile-device-oriole/config/UPower/UPower.conf.d/20-omamobile-critical-power.conf @@ -0,0 +1,5 @@ +# 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. +[UPower] +CriticalPowerAction=PowerOff diff --git a/packages/omamobile-device-oriole/install b/packages/omamobile-device-oriole/install new file mode 100755 index 000000000..25c1db867 --- /dev/null +++ b/packages/omamobile-device-oriole/install @@ -0,0 +1,24 @@ +#!/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 omamobile-bootctl 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) +for file in LICENSE LICENSE.Apache-2.0; 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/src/omamobile-bootctl.c b/packages/omamobile-device-oriole/src/omamobile-bootctl.c new file mode 100644 index 000000000..bc63b1375 --- /dev/null +++ b/packages/omamobile-device-oriole/src/omamobile-bootctl.c @@ -0,0 +1,378 @@ +// SPDX-License-Identifier: Apache-2.0 +/* + * omamobile-bootctl: read and (carefully) update the A/B slot metadata that + * the Pixel bootloader (ABL) keeps in the "devinfo" partition on gs101/gs201. + * + * This file is a port of Google's Pixel boot-control HAL and is therefore + * licensed under Apache-2.0, not MIT like the rest of Omarchy Mobile's tools. + * The devinfo layout and the slot update rules come from: + * + * https://android.googlesource.com/device/google/gs-common + * tag android-14.0.0_r75 (commit ddbc3a43bcad1db516c114aca87df90d1780e728) + * bootctrl/aidl/DevInfo.h Copyright (C) 2021 The Android Open Source Project + * bootctrl/aidl/BootControl.cpp Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications (Omarchy Mobile, 2026): rewritten from C++/AIDL into a standalone C + * command-line tool. Only the devinfo path is kept (no GPT-attribute fallback, + * no virtual A/B misc message, no anti-rollback OTP blowing, no UFS + * bBootLunEn write). Bitfields are replaced by explicit byte/bit offsets. + * Writes are gated behind --i-understand, touch only the slot bytes, and are + * verified by re-reading the whole partition afterwards. + * + * Usage: + * omamobile-bootctl dump + * omamobile-bootctl mark-successful [--i-understand] + * omamobile-bootctl set-active [--i-understand] + * is a file or block device (on the phone: the "devinfo" partition). + * is a, b, _a, _b, 0 or 1. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* From DevInfo.h ("definitions taken from ABL code") */ +#define DEVINFO_MAGIC 0x49564544u /* "DEVI" little-endian */ +#define DEVINFO_AB_SLOT_COUNT 2 +#define DEVINFO_SIZE 128 /* sizeof(devinfo_t), what the HAL reads/writes */ + +/* + * devinfo_t, as in DevInfo.h: + * 0x00 u32 magic + * 0x04 u16 ver_major + * 0x06 u16 ver_minor + * 0x08 u8 unused[40] + * 0x30 devinfo_ab_slot_data_t slots[2], 4 bytes each: + * +0 u8 retry_count + * +1 u8 unbootable:1, successful:1, active:1, fastboot_ok:1, :4 + * (LSB-first bitfield allocation, as clang/gcc do on arm64) + * +2 u8 unused[2] + * 0x38 u8 unused1[72] + */ +#define OFF_MAGIC 0x00 +#define OFF_VER_MAJOR 0x04 +#define OFF_VER_MINOR 0x06 +#define OFF_SLOTS 0x30 +#define SLOT_SIZE 4 +#define SLOT_RETRY 0 +#define SLOT_FLAGS 1 +#define FLAG_UNBOOTABLE 0x01 +#define FLAG_SUCCESSFUL 0x02 +#define FLAG_ACTIVE 0x04 +#define FLAG_FASTBOOT_OK 0x08 +#define FLAG_KNOWN 0x0f + +/* From BootControl.cpp */ +#define AB_ATTR_MAX_RETRY_COUNT 3 +#define DEVINFO_MIN_VERSION 0x00030003u /* "only version 3.3+ supports A/B data" */ + +/* + * The only layout version this port has been checked against (Pixel 7 Pro, + * cheetah, stock CP2A bootloader, devinfo 3.15). Writes refuse anything else. + */ +#define VERIFIED_VER_MAJOR 3 +#define VERIFIED_VER_MINOR 15 + +/* devinfo is 8 KiB on cheetah; refuse anything absurdly large */ +#define MAX_REGION (1024 * 1024) + +static const char *argv0 = "omamobile-bootctl"; + +static uint32_t rd32(const uint8_t *p) { return p[0] | p[1] << 8 | p[2] << 16 | (uint32_t)p[3] << 24; } +static uint16_t rd16(const uint8_t *p) { return p[0] | p[1] << 8; } + +static int usage(void) +{ + fprintf(stderr, + "usage: %s dump \n" + " %s mark-successful [--i-understand]\n" + " %s set-active [--i-understand]\n" + ": a, b, _a, _b, 0 or 1\n", + argv0, argv0, argv0); + return 2; +} + +/* Read the whole file/device (up to MAX_REGION) into a malloc'd buffer. */ +static uint8_t *read_region(const char *path, size_t *len) +{ + int fd = open(path, O_RDONLY); + if (fd < 0) { + fprintf(stderr, "%s: open %s: %s\n", argv0, path, strerror(errno)); + return NULL; + } + uint8_t *buf = malloc(MAX_REGION + 1); + size_t n = 0; + while (buf && n <= MAX_REGION) { + ssize_t r = pread(fd, buf + n, MAX_REGION + 1 - n, n); + if (r < 0) { + if (errno == EINTR) + continue; + fprintf(stderr, "%s: read %s: %s\n", argv0, path, strerror(errno)); + free(buf); + buf = NULL; + break; + } + if (r == 0) + break; + n += r; + } + close(fd); + if (!buf) + return NULL; + if (n > MAX_REGION) { + fprintf(stderr, "%s: %s is larger than %d bytes; is this really devinfo?\n", + argv0, path, MAX_REGION); + free(buf); + return NULL; + } + if (n < DEVINFO_SIZE) { + fprintf(stderr, "%s: %s: only %zu bytes, need %d\n", argv0, path, n, DEVINFO_SIZE); + free(buf); + return NULL; + } + *len = n; + return buf; +} + +static int check_header(const uint8_t *d, int for_write) +{ + uint32_t magic = rd32(d + OFF_MAGIC); + uint16_t maj = rd16(d + OFF_VER_MAJOR), min = rd16(d + OFF_VER_MINOR); + if (magic != DEVINFO_MAGIC) { + fprintf(stderr, "%s: bad magic 0x%08x (want 0x%08x \"DEVI\")\n", argv0, magic, DEVINFO_MAGIC); + return -1; + } + if (((uint32_t)maj << 16 | min) < DEVINFO_MIN_VERSION) { + fprintf(stderr, "%s: devinfo version %u.%u has no A/B data (need 3.3+)\n", argv0, maj, min); + return -1; + } + if (for_write && (maj != VERIFIED_VER_MAJOR || min != VERIFIED_VER_MINOR)) { + fprintf(stderr, "%s: devinfo version %u.%u is not the verified %u.%u layout; refusing to write\n", + argv0, maj, min, VERIFIED_VER_MAJOR, VERIFIED_VER_MINOR); + return -1; + } + return 0; +} + +static int parse_slot(const char *s) +{ + if (!strcmp(s, "a") || !strcmp(s, "_a") || !strcmp(s, "0")) + return 0; + if (!strcmp(s, "b") || !strcmp(s, "_b") || !strcmp(s, "1")) + return 1; + return -1; +} + +static void print_slot(const uint8_t *d, int i) +{ + const uint8_t *s = d + OFF_SLOTS + i * SLOT_SIZE; + uint8_t f = s[SLOT_FLAGS]; + printf("slot %c (bytes 0x%02x-0x%02x: %02x %02x %02x %02x)\n", 'a' + i, + OFF_SLOTS + i * SLOT_SIZE, OFF_SLOTS + i * SLOT_SIZE + 3, s[0], s[1], s[2], s[3]); + printf(" active: %s\n", f & FLAG_ACTIVE ? "yes" : "no"); + printf(" successful: %s\n", f & FLAG_SUCCESSFUL ? "yes" : "no"); + printf(" unbootable: %s\n", f & FLAG_UNBOOTABLE ? "yes" : "no"); + printf(" fastboot-ok: %s\n", f & FLAG_FASTBOOT_OK ? "yes" : "no"); + printf(" retry-count: %u\n", s[SLOT_RETRY]); + if (f & ~FLAG_KNOWN || s[2] || s[3]) + printf(" reserved: flags-high=0x%x unused=%02x %02x\n", f >> 4, s[2], s[3]); +} + +static void hexdump(const uint8_t *d, size_t n) +{ + for (size_t i = 0; i < n; i += 16) { + printf(" %04zx:", i); + for (size_t j = i; j < i + 16 && j < n; j++) + printf(" %02x", d[j]); + printf("\n"); + } +} + +static int cmd_dump(const char *path) +{ + size_t len; + uint8_t *d = read_region(path, &len); + if (!d) + return 1; + if (check_header(d, 0)) { + free(d); + return 1; + } + printf("devinfo: %s (%zu bytes)\n", path, len); + printf("magic: 0x%08x \"DEVI\"\n", rd32(d + OFF_MAGIC)); + printf("version: %u.%u%s\n", rd16(d + OFF_VER_MAJOR), rd16(d + OFF_VER_MINOR), + rd16(d + OFF_VER_MAJOR) == VERIFIED_VER_MAJOR && rd16(d + OFF_VER_MINOR) == VERIFIED_VER_MINOR + ? " (verified layout)" : " (NOT the verified layout: read-only)"); + for (int i = 0; i < DEVINFO_AB_SLOT_COUNT; i++) + print_slot(d, i); + printf("active slot (HAL rule: slot b if its active bit is set, else a): %c\n", + d[OFF_SLOTS + SLOT_SIZE + SLOT_FLAGS] & FLAG_ACTIVE ? 'b' : 'a'); + /* + * Everything else in the 128-byte header is "unused" in Google's + * definition but is not zero: ABL keeps its own state there (likely + * including lock/unlock state). We print it raw and never modify it. + */ + printf("opaque ABL-owned header bytes (never modified), 0x00-0x7f:\n"); + hexdump(d, DEVINFO_SIZE); + printf("bytes 0x80-0x%zx: not decoded (factory/ABL records), never written\n", len - 1); + free(d); + return 0; +} + +/* Apply the HAL's update rules to a copy of the 128-byte header. */ +static void apply_mark_successful(uint8_t *h, int slot) +{ + /* markBootSuccessful(): devinfo.ab_data.slots[slot].successful = 1 */ + h[OFF_SLOTS + slot * SLOT_SIZE + SLOT_FLAGS] |= FLAG_SUCCESSFUL; +} + +static void apply_set_active(uint8_t *h, int slot) +{ + /* setActiveBootSlot(): inactive.active = 0; DevInfoInitSlot(active) */ + uint8_t *act = h + OFF_SLOTS + slot * SLOT_SIZE; + uint8_t *ina = h + OFF_SLOTS + !slot * SLOT_SIZE; + ina[SLOT_FLAGS] &= ~FLAG_ACTIVE; + act[SLOT_RETRY] = AB_ATTR_MAX_RETRY_COUNT; + act[SLOT_FLAGS] &= ~(FLAG_UNBOOTABLE | FLAG_SUCCESSFUL | FLAG_FASTBOOT_OK); + act[SLOT_FLAGS] |= FLAG_ACTIVE; + /* reserved flag bits and unused[2] are left as they were, as with the bitfields */ +} + +static int cmd_write(const char *path, int slot, int set_active, int confirmed) +{ + size_t len; + uint8_t *orig = read_region(path, &len); + if (!orig) + return 1; + if (check_header(orig, 1)) { + free(orig); + return 1; + } + + uint8_t want[DEVINFO_SIZE]; + memcpy(want, orig, DEVINFO_SIZE); + if (set_active) + apply_set_active(want, slot); + else + apply_mark_successful(want, slot); + + printf("before:\n"); + for (int i = 0; i < DEVINFO_AB_SLOT_COUNT; i++) + print_slot(orig, i); + + if (!set_active && orig[OFF_SLOTS + slot * SLOT_SIZE + SLOT_FLAGS] & FLAG_UNBOOTABLE) + printf("warning: slot %c is marked unbootable; marking it successful does not clear that\n", + 'a' + slot); + + /* Every changed byte must lie inside the slot array, 0x30-0x37. */ + int changes = 0; + for (int i = 0; i < DEVINFO_SIZE; i++) { + if (want[i] == orig[i]) + continue; + if (i < OFF_SLOTS || i >= OFF_SLOTS + DEVINFO_AB_SLOT_COUNT * SLOT_SIZE) { + fprintf(stderr, "%s: internal error: would change byte 0x%02x outside the slot data\n", + argv0, i); + free(orig); + return 1; + } + if (!changes++) + printf("bytes to change (offset: old -> new):\n"); + printf(" 0x%02x: %02x -> %02x\n", i, orig[i], want[i]); + } + if (!changes) { + printf("nothing to change; not writing\n"); + free(orig); + return 0; + } + if (set_active) + printf("note: Google's HAL also writes the UFS bBootLunEn attribute (boot LU %c);" + " this tool does not\n", slot ? 'B' : 'A'); + if (!confirmed) { + printf("dry run: pass --i-understand to write these %d byte(s)\n", changes); + free(orig); + return 1; + } + + /* Re-read right before writing and make sure nothing moved underneath us. */ + size_t len2; + uint8_t *again = read_region(path, &len2); + if (!again || len2 != len || memcmp(again, orig, len)) { + fprintf(stderr, "%s: %s changed since it was read; refusing to write\n", argv0, path); + free(again); + free(orig); + return 1; + } + free(again); + + /* Like DevInfoSync(): write the 128-byte header at offset 0, O_DSYNC. */ + int fd = open(path, O_WRONLY | O_DSYNC); + if (fd < 0) { + fprintf(stderr, "%s: open %s for writing: %s\n", argv0, path, strerror(errno)); + free(orig); + return 1; + } + ssize_t w = pwrite(fd, want, DEVINFO_SIZE, 0); + if (w != DEVINFO_SIZE || fsync(fd)) { + fprintf(stderr, "%s: write %s: %s\n", argv0, path, w < 0 ? strerror(errno) : "short write"); + close(fd); + free(orig); + return 1; + } + close(fd); + + /* Verify: the whole region must equal the original with only our bytes changed. */ + memcpy(orig, want, DEVINFO_SIZE); + uint8_t *after = read_region(path, &len2); + if (!after || len2 != len || memcmp(after, orig, len)) { + fprintf(stderr, "%s: VERIFY FAILED: %s does not read back as written\n", argv0, path); + free(after); + free(orig); + return 1; + } + printf("written and verified (%zu bytes compared)\nafter:\n", len); + for (int i = 0; i < DEVINFO_AB_SLOT_COUNT; i++) + print_slot(after, i); + free(after); + free(orig); + return 0; +} + +int main(int argc, char **argv) +{ + int confirmed = 0, n = 0; + char *args[4]; + for (int i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--i-understand")) + confirmed = 1; + else if (n < 4) + args[n++] = argv[i]; + else + return usage(); + } + if (n == 2 && !strcmp(args[0], "dump")) + return cmd_dump(args[1]); + if (n == 3 && (!strcmp(args[0], "mark-successful") || !strcmp(args[0], "set-active"))) { + int slot = parse_slot(args[2]); + if (slot < 0) + return usage(); + return cmd_write(args[1], slot, !strcmp(args[0], "set-active"), confirmed); + } + return usage(); +} 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..7eb38090c --- /dev/null +++ b/packages/omamobile-device-oriole/test/all @@ -0,0 +1,68 @@ +#!/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" +python3 - "$t/devinfo" <<'PY' +import struct, sys +data = bytearray(8192) +data[:4] = b'DEVI' +struct.pack_into(' "$t/dump" +grep -q 'version: 3.15' "$t/dump" +"$t/build/omamobile-bootctl" mark-successful "$t/devinfo" b > "$t/plan" 2>&1 || true +grep -q '0x35: 04 -> 06' "$t/plan" +cmp "$t/devinfo" "$t/original" +echo 'ok - helpers compile; boot-control dry run leaves the synthetic partition unchanged' +./install "$t/root" "$t/build" +for file in usr/bin/reboot-to usr/bin/omamobile-bootctl 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 \ + usr/share/licenses/omamobile-device-oriole/LICENSE \ + usr/share/licenses/omamobile-device-oriole/LICENSE.Apache-2.0; do + test -f "$t/root/$file" +done +test ! -d "$t/root/usr/lib/systemd/system/multi-user.target.wants" +if ./install / "$t/build" > "$t/refusal" 2>&1; then + echo 'not ok - installation must refuse the host root' >&2 + exit 1 +fi +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 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..6e8bf73aa --- /dev/null +++ b/packages/omamobile-device-oriole/version @@ -0,0 +1 @@ +0.1.0 From 0d50416a7e030acaff056db9b9c0944ed2fbdb92 Mon Sep 17 00:00:00 2001 From: Gr-linkk <280405187+Gr-linkk@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:07:45 -0700 Subject: [PATCH 2/7] device-oriole: complete first-light package policy Provide the repository configuration and package metadata, remove the unqualified boot-control tool, and document the safeguards required before replacing a local integration package. --- .../LICENSE.Apache-2.0 | 73 ---- packages/omamobile-device-oriole/PKGBUILD | 9 +- packages/omamobile-device-oriole/README.md | 19 +- packages/omamobile-device-oriole/build | 1 - .../20-omamobile-critical-power.conf | 1 + .../etc/omamobile-mirrorlist | 18 + packages/omamobile-device-oriole/install | 5 +- .../omamobile-device-oriole.install | 62 +++ .../src/omamobile-bootctl.c | 378 ------------------ packages/omamobile-device-oriole/test/all | 31 +- 10 files changed, 114 insertions(+), 483 deletions(-) delete mode 100644 packages/omamobile-device-oriole/LICENSE.Apache-2.0 create mode 100644 packages/omamobile-device-oriole/etc/omamobile-mirrorlist create mode 100644 packages/omamobile-device-oriole/omamobile-device-oriole.install delete mode 100644 packages/omamobile-device-oriole/src/omamobile-bootctl.c diff --git a/packages/omamobile-device-oriole/LICENSE.Apache-2.0 b/packages/omamobile-device-oriole/LICENSE.Apache-2.0 deleted file mode 100644 index 137069b82..000000000 --- a/packages/omamobile-device-oriole/LICENSE.Apache-2.0 +++ /dev/null @@ -1,73 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/packages/omamobile-device-oriole/PKGBUILD b/packages/omamobile-device-oriole/PKGBUILD index ffddb18b8..3befe18d6 100644 --- a/packages/omamobile-device-oriole/PKGBUILD +++ b/packages/omamobile-device-oriole/PKGBUILD @@ -5,11 +5,14 @@ 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 Apache-2.0) -depends=(bash systemd util-linux) +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) +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"; } diff --git a/packages/omamobile-device-oriole/README.md b/packages/omamobile-device-oriole/README.md index ebe3e0618..aaa0938a6 100644 --- a/packages/omamobile-device-oriole/README.md +++ b/packages/omamobile-device-oriole/README.md @@ -16,15 +16,20 @@ networkd activation are also external prerequisites. USB has fallback metric 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. -These six names follow the recovered Oriole ROOTFS-PLAN coldplug audit; -this package makes no claim that the underlying hardware is qualified. +A read-only coldplug audit 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 writes require -an explicit flag and separate human authorization. No phone testing was +charging or GS201 hardware services are included. Boot-control tooling is omitted while slot marking remains on hold. No phone testing was performed for this package; exact-branch boot remains unqualified. -Run test/all for a native helper build, synthetic boot-control dry run and -staged installation checks. Do not install on a phone without a separate -device-specific, watchdog-protected qualification gate and rollback. +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. The local integration package 0.1.9-2 is newer, so pacman will not +automatically upgrade it to this package. 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. diff --git a/packages/omamobile-device-oriole/build b/packages/omamobile-device-oriole/build index bcaa40d21..f1d93f8cd 100755 --- a/packages/omamobile-device-oriole/build +++ b/packages/omamobile-device-oriole/build @@ -5,5 +5,4 @@ set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")" out=${1:-build} mkdir -p "$out" -${CC:-cc} ${CFLAGS:--O2} -Wall -Wextra -o "$out/omamobile-bootctl" src/omamobile-bootctl.c ${LDFLAGS:-} ${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 index a942007eb..38636e5c7 100644 --- 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 @@ -1,5 +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 index 25c1db867..4cf89033f 100755 --- a/packages/omamobile-device-oriole/install +++ b/packages/omamobile-device-oriole/install @@ -6,7 +6,7 @@ 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 omamobile-bootctl reboot-to; do +for tool in reboot-to; do install -Dm755 "$build/$tool" "$destination/usr/bin/$tool" done for tool in omamobile-setup-system; do @@ -18,7 +18,8 @@ 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) -for file in LICENSE LICENSE.Apache-2.0; do +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/omamobile-bootctl.c b/packages/omamobile-device-oriole/src/omamobile-bootctl.c deleted file mode 100644 index bc63b1375..000000000 --- a/packages/omamobile-device-oriole/src/omamobile-bootctl.c +++ /dev/null @@ -1,378 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -/* - * omamobile-bootctl: read and (carefully) update the A/B slot metadata that - * the Pixel bootloader (ABL) keeps in the "devinfo" partition on gs101/gs201. - * - * This file is a port of Google's Pixel boot-control HAL and is therefore - * licensed under Apache-2.0, not MIT like the rest of Omarchy Mobile's tools. - * The devinfo layout and the slot update rules come from: - * - * https://android.googlesource.com/device/google/gs-common - * tag android-14.0.0_r75 (commit ddbc3a43bcad1db516c114aca87df90d1780e728) - * bootctrl/aidl/DevInfo.h Copyright (C) 2021 The Android Open Source Project - * bootctrl/aidl/BootControl.cpp Copyright (C) 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications (Omarchy Mobile, 2026): rewritten from C++/AIDL into a standalone C - * command-line tool. Only the devinfo path is kept (no GPT-attribute fallback, - * no virtual A/B misc message, no anti-rollback OTP blowing, no UFS - * bBootLunEn write). Bitfields are replaced by explicit byte/bit offsets. - * Writes are gated behind --i-understand, touch only the slot bytes, and are - * verified by re-reading the whole partition afterwards. - * - * Usage: - * omamobile-bootctl dump - * omamobile-bootctl mark-successful [--i-understand] - * omamobile-bootctl set-active [--i-understand] - * is a file or block device (on the phone: the "devinfo" partition). - * is a, b, _a, _b, 0 or 1. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* From DevInfo.h ("definitions taken from ABL code") */ -#define DEVINFO_MAGIC 0x49564544u /* "DEVI" little-endian */ -#define DEVINFO_AB_SLOT_COUNT 2 -#define DEVINFO_SIZE 128 /* sizeof(devinfo_t), what the HAL reads/writes */ - -/* - * devinfo_t, as in DevInfo.h: - * 0x00 u32 magic - * 0x04 u16 ver_major - * 0x06 u16 ver_minor - * 0x08 u8 unused[40] - * 0x30 devinfo_ab_slot_data_t slots[2], 4 bytes each: - * +0 u8 retry_count - * +1 u8 unbootable:1, successful:1, active:1, fastboot_ok:1, :4 - * (LSB-first bitfield allocation, as clang/gcc do on arm64) - * +2 u8 unused[2] - * 0x38 u8 unused1[72] - */ -#define OFF_MAGIC 0x00 -#define OFF_VER_MAJOR 0x04 -#define OFF_VER_MINOR 0x06 -#define OFF_SLOTS 0x30 -#define SLOT_SIZE 4 -#define SLOT_RETRY 0 -#define SLOT_FLAGS 1 -#define FLAG_UNBOOTABLE 0x01 -#define FLAG_SUCCESSFUL 0x02 -#define FLAG_ACTIVE 0x04 -#define FLAG_FASTBOOT_OK 0x08 -#define FLAG_KNOWN 0x0f - -/* From BootControl.cpp */ -#define AB_ATTR_MAX_RETRY_COUNT 3 -#define DEVINFO_MIN_VERSION 0x00030003u /* "only version 3.3+ supports A/B data" */ - -/* - * The only layout version this port has been checked against (Pixel 7 Pro, - * cheetah, stock CP2A bootloader, devinfo 3.15). Writes refuse anything else. - */ -#define VERIFIED_VER_MAJOR 3 -#define VERIFIED_VER_MINOR 15 - -/* devinfo is 8 KiB on cheetah; refuse anything absurdly large */ -#define MAX_REGION (1024 * 1024) - -static const char *argv0 = "omamobile-bootctl"; - -static uint32_t rd32(const uint8_t *p) { return p[0] | p[1] << 8 | p[2] << 16 | (uint32_t)p[3] << 24; } -static uint16_t rd16(const uint8_t *p) { return p[0] | p[1] << 8; } - -static int usage(void) -{ - fprintf(stderr, - "usage: %s dump \n" - " %s mark-successful [--i-understand]\n" - " %s set-active [--i-understand]\n" - ": a, b, _a, _b, 0 or 1\n", - argv0, argv0, argv0); - return 2; -} - -/* Read the whole file/device (up to MAX_REGION) into a malloc'd buffer. */ -static uint8_t *read_region(const char *path, size_t *len) -{ - int fd = open(path, O_RDONLY); - if (fd < 0) { - fprintf(stderr, "%s: open %s: %s\n", argv0, path, strerror(errno)); - return NULL; - } - uint8_t *buf = malloc(MAX_REGION + 1); - size_t n = 0; - while (buf && n <= MAX_REGION) { - ssize_t r = pread(fd, buf + n, MAX_REGION + 1 - n, n); - if (r < 0) { - if (errno == EINTR) - continue; - fprintf(stderr, "%s: read %s: %s\n", argv0, path, strerror(errno)); - free(buf); - buf = NULL; - break; - } - if (r == 0) - break; - n += r; - } - close(fd); - if (!buf) - return NULL; - if (n > MAX_REGION) { - fprintf(stderr, "%s: %s is larger than %d bytes; is this really devinfo?\n", - argv0, path, MAX_REGION); - free(buf); - return NULL; - } - if (n < DEVINFO_SIZE) { - fprintf(stderr, "%s: %s: only %zu bytes, need %d\n", argv0, path, n, DEVINFO_SIZE); - free(buf); - return NULL; - } - *len = n; - return buf; -} - -static int check_header(const uint8_t *d, int for_write) -{ - uint32_t magic = rd32(d + OFF_MAGIC); - uint16_t maj = rd16(d + OFF_VER_MAJOR), min = rd16(d + OFF_VER_MINOR); - if (magic != DEVINFO_MAGIC) { - fprintf(stderr, "%s: bad magic 0x%08x (want 0x%08x \"DEVI\")\n", argv0, magic, DEVINFO_MAGIC); - return -1; - } - if (((uint32_t)maj << 16 | min) < DEVINFO_MIN_VERSION) { - fprintf(stderr, "%s: devinfo version %u.%u has no A/B data (need 3.3+)\n", argv0, maj, min); - return -1; - } - if (for_write && (maj != VERIFIED_VER_MAJOR || min != VERIFIED_VER_MINOR)) { - fprintf(stderr, "%s: devinfo version %u.%u is not the verified %u.%u layout; refusing to write\n", - argv0, maj, min, VERIFIED_VER_MAJOR, VERIFIED_VER_MINOR); - return -1; - } - return 0; -} - -static int parse_slot(const char *s) -{ - if (!strcmp(s, "a") || !strcmp(s, "_a") || !strcmp(s, "0")) - return 0; - if (!strcmp(s, "b") || !strcmp(s, "_b") || !strcmp(s, "1")) - return 1; - return -1; -} - -static void print_slot(const uint8_t *d, int i) -{ - const uint8_t *s = d + OFF_SLOTS + i * SLOT_SIZE; - uint8_t f = s[SLOT_FLAGS]; - printf("slot %c (bytes 0x%02x-0x%02x: %02x %02x %02x %02x)\n", 'a' + i, - OFF_SLOTS + i * SLOT_SIZE, OFF_SLOTS + i * SLOT_SIZE + 3, s[0], s[1], s[2], s[3]); - printf(" active: %s\n", f & FLAG_ACTIVE ? "yes" : "no"); - printf(" successful: %s\n", f & FLAG_SUCCESSFUL ? "yes" : "no"); - printf(" unbootable: %s\n", f & FLAG_UNBOOTABLE ? "yes" : "no"); - printf(" fastboot-ok: %s\n", f & FLAG_FASTBOOT_OK ? "yes" : "no"); - printf(" retry-count: %u\n", s[SLOT_RETRY]); - if (f & ~FLAG_KNOWN || s[2] || s[3]) - printf(" reserved: flags-high=0x%x unused=%02x %02x\n", f >> 4, s[2], s[3]); -} - -static void hexdump(const uint8_t *d, size_t n) -{ - for (size_t i = 0; i < n; i += 16) { - printf(" %04zx:", i); - for (size_t j = i; j < i + 16 && j < n; j++) - printf(" %02x", d[j]); - printf("\n"); - } -} - -static int cmd_dump(const char *path) -{ - size_t len; - uint8_t *d = read_region(path, &len); - if (!d) - return 1; - if (check_header(d, 0)) { - free(d); - return 1; - } - printf("devinfo: %s (%zu bytes)\n", path, len); - printf("magic: 0x%08x \"DEVI\"\n", rd32(d + OFF_MAGIC)); - printf("version: %u.%u%s\n", rd16(d + OFF_VER_MAJOR), rd16(d + OFF_VER_MINOR), - rd16(d + OFF_VER_MAJOR) == VERIFIED_VER_MAJOR && rd16(d + OFF_VER_MINOR) == VERIFIED_VER_MINOR - ? " (verified layout)" : " (NOT the verified layout: read-only)"); - for (int i = 0; i < DEVINFO_AB_SLOT_COUNT; i++) - print_slot(d, i); - printf("active slot (HAL rule: slot b if its active bit is set, else a): %c\n", - d[OFF_SLOTS + SLOT_SIZE + SLOT_FLAGS] & FLAG_ACTIVE ? 'b' : 'a'); - /* - * Everything else in the 128-byte header is "unused" in Google's - * definition but is not zero: ABL keeps its own state there (likely - * including lock/unlock state). We print it raw and never modify it. - */ - printf("opaque ABL-owned header bytes (never modified), 0x00-0x7f:\n"); - hexdump(d, DEVINFO_SIZE); - printf("bytes 0x80-0x%zx: not decoded (factory/ABL records), never written\n", len - 1); - free(d); - return 0; -} - -/* Apply the HAL's update rules to a copy of the 128-byte header. */ -static void apply_mark_successful(uint8_t *h, int slot) -{ - /* markBootSuccessful(): devinfo.ab_data.slots[slot].successful = 1 */ - h[OFF_SLOTS + slot * SLOT_SIZE + SLOT_FLAGS] |= FLAG_SUCCESSFUL; -} - -static void apply_set_active(uint8_t *h, int slot) -{ - /* setActiveBootSlot(): inactive.active = 0; DevInfoInitSlot(active) */ - uint8_t *act = h + OFF_SLOTS + slot * SLOT_SIZE; - uint8_t *ina = h + OFF_SLOTS + !slot * SLOT_SIZE; - ina[SLOT_FLAGS] &= ~FLAG_ACTIVE; - act[SLOT_RETRY] = AB_ATTR_MAX_RETRY_COUNT; - act[SLOT_FLAGS] &= ~(FLAG_UNBOOTABLE | FLAG_SUCCESSFUL | FLAG_FASTBOOT_OK); - act[SLOT_FLAGS] |= FLAG_ACTIVE; - /* reserved flag bits and unused[2] are left as they were, as with the bitfields */ -} - -static int cmd_write(const char *path, int slot, int set_active, int confirmed) -{ - size_t len; - uint8_t *orig = read_region(path, &len); - if (!orig) - return 1; - if (check_header(orig, 1)) { - free(orig); - return 1; - } - - uint8_t want[DEVINFO_SIZE]; - memcpy(want, orig, DEVINFO_SIZE); - if (set_active) - apply_set_active(want, slot); - else - apply_mark_successful(want, slot); - - printf("before:\n"); - for (int i = 0; i < DEVINFO_AB_SLOT_COUNT; i++) - print_slot(orig, i); - - if (!set_active && orig[OFF_SLOTS + slot * SLOT_SIZE + SLOT_FLAGS] & FLAG_UNBOOTABLE) - printf("warning: slot %c is marked unbootable; marking it successful does not clear that\n", - 'a' + slot); - - /* Every changed byte must lie inside the slot array, 0x30-0x37. */ - int changes = 0; - for (int i = 0; i < DEVINFO_SIZE; i++) { - if (want[i] == orig[i]) - continue; - if (i < OFF_SLOTS || i >= OFF_SLOTS + DEVINFO_AB_SLOT_COUNT * SLOT_SIZE) { - fprintf(stderr, "%s: internal error: would change byte 0x%02x outside the slot data\n", - argv0, i); - free(orig); - return 1; - } - if (!changes++) - printf("bytes to change (offset: old -> new):\n"); - printf(" 0x%02x: %02x -> %02x\n", i, orig[i], want[i]); - } - if (!changes) { - printf("nothing to change; not writing\n"); - free(orig); - return 0; - } - if (set_active) - printf("note: Google's HAL also writes the UFS bBootLunEn attribute (boot LU %c);" - " this tool does not\n", slot ? 'B' : 'A'); - if (!confirmed) { - printf("dry run: pass --i-understand to write these %d byte(s)\n", changes); - free(orig); - return 1; - } - - /* Re-read right before writing and make sure nothing moved underneath us. */ - size_t len2; - uint8_t *again = read_region(path, &len2); - if (!again || len2 != len || memcmp(again, orig, len)) { - fprintf(stderr, "%s: %s changed since it was read; refusing to write\n", argv0, path); - free(again); - free(orig); - return 1; - } - free(again); - - /* Like DevInfoSync(): write the 128-byte header at offset 0, O_DSYNC. */ - int fd = open(path, O_WRONLY | O_DSYNC); - if (fd < 0) { - fprintf(stderr, "%s: open %s for writing: %s\n", argv0, path, strerror(errno)); - free(orig); - return 1; - } - ssize_t w = pwrite(fd, want, DEVINFO_SIZE, 0); - if (w != DEVINFO_SIZE || fsync(fd)) { - fprintf(stderr, "%s: write %s: %s\n", argv0, path, w < 0 ? strerror(errno) : "short write"); - close(fd); - free(orig); - return 1; - } - close(fd); - - /* Verify: the whole region must equal the original with only our bytes changed. */ - memcpy(orig, want, DEVINFO_SIZE); - uint8_t *after = read_region(path, &len2); - if (!after || len2 != len || memcmp(after, orig, len)) { - fprintf(stderr, "%s: VERIFY FAILED: %s does not read back as written\n", argv0, path); - free(after); - free(orig); - return 1; - } - printf("written and verified (%zu bytes compared)\nafter:\n", len); - for (int i = 0; i < DEVINFO_AB_SLOT_COUNT; i++) - print_slot(after, i); - free(after); - free(orig); - return 0; -} - -int main(int argc, char **argv) -{ - int confirmed = 0, n = 0; - char *args[4]; - for (int i = 1; i < argc; i++) { - if (!strcmp(argv[i], "--i-understand")) - confirmed = 1; - else if (n < 4) - args[n++] = argv[i]; - else - return usage(); - } - if (n == 2 && !strcmp(args[0], "dump")) - return cmd_dump(args[1]); - if (n == 3 && (!strcmp(args[0], "mark-successful") || !strcmp(args[0], "set-active"))) { - int slot = parse_slot(args[2]); - if (slot < 0) - return usage(); - return cmd_write(args[1], slot, !strcmp(args[0], "set-active"), confirmed); - } - return usage(); -} diff --git a/packages/omamobile-device-oriole/test/all b/packages/omamobile-device-oriole/test/all index 7eb38090c..b40e9010b 100755 --- a/packages/omamobile-device-oriole/test/all +++ b/packages/omamobile-device-oriole/test/all @@ -5,32 +5,17 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." t=$(mktemp -d) trap 'rm -rf "$t"' EXIT ./build "$t/build" -python3 - "$t/devinfo" <<'PY' -import struct, sys -data = bytearray(8192) -data[:4] = b'DEVI' -struct.pack_into(' "$t/dump" -grep -q 'version: 3.15' "$t/dump" -"$t/build/omamobile-bootctl" mark-successful "$t/devinfo" b > "$t/plan" 2>&1 || true -grep -q '0x35: 04 -> 06' "$t/plan" -cmp "$t/devinfo" "$t/original" -echo 'ok - helpers compile; boot-control dry run leaves the synthetic partition unchanged' +echo 'ok - reboot helper compiles' ./install "$t/root" "$t/build" -for file in usr/bin/reboot-to usr/bin/omamobile-bootctl usr/bin/omamobile-setup-system \ +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 \ - usr/share/licenses/omamobile-device-oriole/LICENSE \ - usr/share/licenses/omamobile-device-oriole/LICENSE.Apache-2.0; do + 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" @@ -66,3 +51,11 @@ for mode in ('Suspend', 'Hibernation', 'SuspendThenHibernate', 'HybridSleep'): 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" From dcf5299ac836314c8cd28531e64fc39725b3c59c Mon Sep 17 00:00:00 2001 From: Gr-linkk <280405187+Gr-linkk@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:09:20 -0700 Subject: [PATCH 3/7] device-oriole: record coldplug audit limits Record the first-light audit without attributing untested behavior to the blocked drivers. Explain the separate experimental battery provider and the limits of charger status evidence. --- device/oriole/NOTES.md | 8 +++++++- packages/omamobile-device-oriole/README.md | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/device/oriole/NOTES.md b/device/oriole/NOTES.md index 5d1e10154..7e49e0580 100644 --- a/device/oriole/NOTES.md +++ b/device/oriole/NOTES.md @@ -1,7 +1,7 @@ # Pixel 6 (oriole) bring-up notes -Findings for the Pixel 6 port, newest first. The port is a community effort tracked in [issue #2](https://github.com/derekross/omarchy-mobile/issues/2); the 6 Pro (raven) and 6a (bluejay) share it. Facts are marked [V] (checked, with the source) or [I] (an inference to check on a phone). Nothing has been flashed or booted yet: the phone facts come from read-only adb and fastboot queries of a stock phone. +Findings for the Pixel 6 port, newest first. The port is a community effort tracked in [issue #2](https://github.com/derekross/omarchy-mobile/issues/2); the 6 Pro (raven) and 6a (bluejay) share it. Facts are marked [V] (checked, with the source) or [I] (an inference to check on a phone). The earlier stock-phone facts come from read-only adb and fastboot queries; later entries identify separate Linux bring-up observations. Sources: @@ -9,6 +9,12 @@ 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-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/packages/omamobile-device-oriole/README.md b/packages/omamobile-device-oriole/README.md index aaa0938a6..17398adc6 100644 --- a/packages/omamobile-device-oriole/README.md +++ b/packages/omamobile-device-oriole/README.md @@ -16,7 +16,7 @@ networkd activation are also external prerequisites. USB has fallback metric 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. -A read-only coldplug audit found matching unbound devices and confirmed that +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. From b6d0a3e40b9305ecebb0c05cff7e7406e32c435f Mon Sep 17 00:00:00 2001 From: Gr-linkk <280405187+Gr-linkk@users.noreply.github.com> Date: Sat, 7 Nov 2026 09:20:50 -0700 Subject: [PATCH 4/7] device-oriole: record native first-light staging validation Record ARM64 build and temporary-directory installation on the phone. Keep baseline smoke findings distinct from exact-package qualification; the installed integration safeguards were preserved. Co-Authored-By: Codex --- device/oriole/NOTES.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/device/oriole/NOTES.md b/device/oriole/NOTES.md index 4ee1e7757..8d1ee32f4 100644 --- a/device/oriole/NOTES.md +++ b/device/oriole/NOTES.md @@ -9,6 +9,23 @@ 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-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 From 4d9f13e4a1815be4134b0605ae44c04994df9c05 Mon Sep 17 00:00:00 2001 From: Gr-linkk <280405187+Gr-linkk@users.noreply.github.com> Date: Sat, 7 Nov 2026 10:47:54 -0700 Subject: [PATCH 5/7] device-oriole 0.2.0: satisfy integration package dependencies Use a version above the installed local device package so normal pacman checks admit migration with the preserved integration safeguards. Record native makepkg and signed installation evidence, including the private companion and outstanding standalone/boot qualification limits. Co-Authored-By: Codex --- device/oriole/NOTES.md | 32 ++++++++++++++++++++++ packages/omamobile-device-oriole/README.md | 15 ++++++---- packages/omamobile-device-oriole/version | 2 +- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/device/oriole/NOTES.md b/device/oriole/NOTES.md index 8d1ee32f4..10c60d104 100644 --- a/device/oriole/NOTES.md +++ b/device/oriole/NOTES.md @@ -9,6 +9,38 @@ 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-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 diff --git a/packages/omamobile-device-oriole/README.md b/packages/omamobile-device-oriole/README.md index 17398adc6..5e233371b 100644 --- a/packages/omamobile-device-oriole/README.md +++ b/packages/omamobile-device-oriole/README.md @@ -1,7 +1,7 @@ # Pixel 6 first-light policy -Initial standalone package, version 0.1.0. No kernel, rootfs integration or +Initial standalone 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. @@ -22,14 +22,19 @@ 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. No phone testing was -performed for this package; exact-branch boot remains unqualified. +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. The local integration package 0.1.9-2 is newer, so pacman will not -automatically upgrade it to this package. That integration package carries +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. diff --git a/packages/omamobile-device-oriole/version b/packages/omamobile-device-oriole/version index 6e8bf73aa..0ea3a944b 100644 --- a/packages/omamobile-device-oriole/version +++ b/packages/omamobile-device-oriole/version @@ -1 +1 @@ -0.1.0 +0.2.0 From 8a1f283e8f1ea9f9358396ad23a862f605886c35 Mon Sep 17 00:00:00 2001 From: Gr-linkk <280405187+Gr-linkk@users.noreply.github.com> Date: Sun, 8 Nov 2026 10:14:55 -0700 Subject: [PATCH 6/7] device-oriole: document first-light standalone install limits Separate the private staged-start guard from boot-success marking and explain why it cannot be copied into this minimal policy package alone. Mark the descriptor and README as unsupported for standalone installs, with startup and reboot-watchdog qualification still outstanding. Exercise install refusal with a relative destination instead of the host root. No installed policy, services or package version change. Co-Authored-By: Codex --- device/oriole/NOTES.md | 25 ++++++++++++++ device/oriole/device.conf | 2 ++ packages/omamobile-device-oriole/README.md | 39 +++++++++++++++++++++- packages/omamobile-device-oriole/test/all | 5 +-- 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/device/oriole/NOTES.md b/device/oriole/NOTES.md index 10c60d104..745ab407d 100644 --- a/device/oriole/NOTES.md +++ b/device/oriole/NOTES.md @@ -9,6 +9,31 @@ 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. 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/README.md b/packages/omamobile-device-oriole/README.md index 5e233371b..a6d8d30c7 100644 --- a/packages/omamobile-device-oriole/README.md +++ b/packages/omamobile-device-oriole/README.md @@ -1,7 +1,12 @@ # Pixel 6 first-light policy -Initial standalone package, version 0.2.0. No kernel, rootfs integration or +**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. @@ -38,3 +43,35 @@ 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. + +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/test/all b/packages/omamobile-device-oriole/test/all index b40e9010b..ee85dbfb4 100755 --- a/packages/omamobile-device-oriole/test/all +++ b/packages/omamobile-device-oriole/test/all @@ -19,8 +19,9 @@ for file in usr/bin/reboot-to usr/bin/omamobile-setup-system \ test -f "$t/root/$file" done test ! -d "$t/root/usr/lib/systemd/system/multi-user.target.wants" -if ./install / "$t/build" > "$t/refusal" 2>&1; then - echo 'not ok - installation must refuse the host root' >&2 +# 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 echo 'ok - installation stages policy and helpers, with no enabled hardware services' From 81801ed04c8bd0853421ff43c1ee992981a9b238 Mon Sep 17 00:00:00 2001 From: Gr-linkk <280405187+Gr-linkk@users.noreply.github.com> Date: Tue, 10 Nov 2026 22:43:15 -0700 Subject: [PATCH 7/7] device-oriole: strengthen refusal test and stock fallback guidance Check the staging refusal diagnostic so an unrelated install failure cannot satisfy the test. Keep the safe relative destination. Explain that any stock boot requires declining reset offers and fresh read-only protected radio backups before further radio work. Validation: package test/all passes; no runtime or version change. No phone access or hardware qualification. Co-Authored-By: Codex --- packages/omamobile-device-oriole/README.md | 5 ++++- packages/omamobile-device-oriole/test/all | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/omamobile-device-oriole/README.md b/packages/omamobile-device-oriole/README.md index a6d8d30c7..50e273796 100644 --- a/packages/omamobile-device-oriole/README.md +++ b/packages/omamobile-device-oriole/README.md @@ -66,7 +66,10 @@ 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. +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 diff --git a/packages/omamobile-device-oriole/test/all b/packages/omamobile-device-oriole/test/all index ee85dbfb4..c0763b722 100755 --- a/packages/omamobile-device-oriole/test/all +++ b/packages/omamobile-device-oriole/test/all @@ -24,6 +24,7 @@ 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'