From 1127fdb1bf431572be7fab27fc2be14bd8027f31 Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Mon, 9 Nov 2026 10:25:35 -0600 Subject: [PATCH 1/3] device/bluejay: keep pinned startup outside the passive package Split experimental services, overlays and probe tools from #543. Retain the exact old development-kernel pins and explicit enable gates; these helpers refuse the revised kernel topics. Remove userspace display-register access and use the descriptor/init trigger contract. The proposed SSH-ready helper clears the neutral root marker only when USB and sshd are ready. No new phone run or automatic installation is claimed. Co-Authored-By: OpenAI Codex --- device/bluejay/bringup/README.md | 48 ++++ .../bringup/bin/omamobile-bluejay-boot-ready | 9 + .../bringup/bin/omamobile-bluejay-check | 24 ++ .../bringup/bin/omamobile-bluejay-gpu-start | 40 ++++ .../bin/omamobile-bluejay-hardware-start | 40 ++++ .../bringup/bin/omamobile-bluejay-wifi-start | 50 ++++ device/bluejay/bringup/bluejay-gpu-smoke.c | 153 ++++++++++++ device/bluejay/bringup/bluejay-touch-view.c | 222 ++++++++++++++++++ .../uwsm/env.d/90-omamobile-bluejay-graphics | 14 ++ .../conf.d/10-omamobile-usb.conf | 3 + .../conf.d/30-bluejay-station.conf | 8 + .../vendor/modprobe.d/omamobile-bluejay.conf | 25 ++ .../logind.conf.d/10-bluejay-bringup.conf | 7 + .../systemd/network/20-usb-gadget.network | 10 + .../sleep.conf.d/10-bluejay-bringup.conf | 6 + .../system.conf.d/10-bluejay-watchdog.conf | 4 + .../omamobile-bluejay-boot-ready.service | 13 + .../system/omamobile-bluejay-check.service | 15 ++ .../system/omamobile-bluejay-gpu.service | 15 ++ .../system/omamobile-bluejay-hardware.service | 18 ++ .../system/omamobile-bluejay-wifi.service | 17 ++ .../system/sddm.service.d/bluejay-check.conf | 5 + device/bluejay/kernel.config | 12 + device/bluejay/overlays/gpu-g1.dtso | 25 ++ device/bluejay/overlays/input-alix.dtso | 8 + device/bluejay/overlays/input-controller.dtso | 16 ++ device/bluejay/overlays/wifi-controller.dtso | 22 ++ device/bluejay/overlays/wifi-endpoint.dtso | 15 ++ device/bluejay/overlays/wifi-intx.dtso | 13 + device/bluejay/overlays/wifi-pool.dtso | 13 + ...aquamarine-simpledrm-no-aux-renderer.patch | 14 ++ tests/all | 1 + tests/bluejay-root-ready.py | 32 +++ 33 files changed, 917 insertions(+) create mode 100644 device/bluejay/bringup/README.md create mode 100755 device/bluejay/bringup/bin/omamobile-bluejay-boot-ready create mode 100755 device/bluejay/bringup/bin/omamobile-bluejay-check create mode 100755 device/bluejay/bringup/bin/omamobile-bluejay-gpu-start create mode 100755 device/bluejay/bringup/bin/omamobile-bluejay-hardware-start create mode 100755 device/bluejay/bringup/bin/omamobile-bluejay-wifi-start create mode 100644 device/bluejay/bringup/bluejay-gpu-smoke.c create mode 100644 device/bluejay/bringup/bluejay-touch-view.c create mode 100644 device/bluejay/bringup/uwsm/env.d/90-omamobile-bluejay-graphics create mode 100644 device/bluejay/bringup/vendor/NetworkManager/conf.d/10-omamobile-usb.conf create mode 100644 device/bluejay/bringup/vendor/NetworkManager/conf.d/30-bluejay-station.conf create mode 100644 device/bluejay/bringup/vendor/modprobe.d/omamobile-bluejay.conf create mode 100644 device/bluejay/bringup/vendor/systemd/logind.conf.d/10-bluejay-bringup.conf create mode 100644 device/bluejay/bringup/vendor/systemd/network/20-usb-gadget.network create mode 100644 device/bluejay/bringup/vendor/systemd/sleep.conf.d/10-bluejay-bringup.conf create mode 100644 device/bluejay/bringup/vendor/systemd/system.conf.d/10-bluejay-watchdog.conf create mode 100644 device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-boot-ready.service create mode 100644 device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-check.service create mode 100644 device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-gpu.service create mode 100644 device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-hardware.service create mode 100644 device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-wifi.service create mode 100644 device/bluejay/bringup/vendor/systemd/system/sddm.service.d/bluejay-check.conf create mode 100644 device/bluejay/kernel.config create mode 100644 device/bluejay/overlays/gpu-g1.dtso create mode 100644 device/bluejay/overlays/input-alix.dtso create mode 100644 device/bluejay/overlays/input-controller.dtso create mode 100644 device/bluejay/overlays/wifi-controller.dtso create mode 100644 device/bluejay/overlays/wifi-endpoint.dtso create mode 100644 device/bluejay/overlays/wifi-intx.dtso create mode 100644 device/bluejay/overlays/wifi-pool.dtso create mode 100644 device/bluejay/patches/aquamarine-simpledrm-no-aux-renderer.patch create mode 100644 tests/bluejay-root-ready.py diff --git a/device/bluejay/bringup/README.md b/device/bluejay/bringup/README.md new file mode 100644 index 000000000..c28a552cc --- /dev/null +++ b/device/bluejay/bringup/README.md @@ -0,0 +1,48 @@ + +# Bluejay development startup, outside the device package + +These files were split from #543. They are not installed by the passive device +package and no service is enabled by this source tree. The original tested +snapshot remains at commit 6ad4651f8ac151333345c72db99f1fd83259696f in the +contributor's omarchy-mobile fork. The revised files have not run on a phone. + +The hardware, Wi-Fi and GPU helpers retain their exact tested release/module +pins and explicit opt-ins. They target the OLD development kernel, including +its USI probe hold and ALIX stage parameter. They intentionally refuse the +revised kernel topics. Removing a check or changing a hash is not qualification. +The new ALIX topic drops both staging knobs: a separate next-run helper must +be prepared and reviewed before testing that stack. + +The retained-display startup no longer reads or writes registers with devmem. +Use `SIMPLEFB_TRIG_CON="0x1c300030 0x3061"` in the Bluejay descriptor and rebuild +with the shared init; its COMPATIBLE check owns the trigger. Native panel +modesetting is still unqualified. Confirm actual refresh visually in a gated +trial instead of claiming that the sysfs framebuffer check proves it. + +The proposed neutral root policy needs `INITRAMFS_ROOT_LABEL=omamobile-root`, +`INITRAMFS_ROOT_MODE=persistent-development` and, for a deliberately host-free +development boot, `INITRAMFS_USB_RECOVERY=no`. The SSH-ready helper now clears +`/var/lib/omamobile/root-boot-pending` after checking the USB address and sshd. +Do not install it against the historical Bluejay-specific selector/marker; +change the init and companion together, with a retained RAM rescue image. + +## Next-run gate (not executed) + +1. Offline: build a complete matching kernel/modules/initramfs/root set. Inspect + both A0/B0 DT variants, the descriptor trigger, root mode/label and marker, + module hashes, blacklists, opt-ins and `AUTO_WRITE=no`. Stop at any mismatch. + Rollback: keep the original tested outputs. Risk: low, laptop files only. +2. Read-only at the bench: establish actual slot/boot identity, USB transport, + storage guard and watchdog ownership. Take a fresh protected-data backup and + independently verify it. Stop on missing guard, transport or backup evidence. + Do not restore NV/devinfo or repeat the held slot-success write. Risk: read-only. +3. A phone boot or install needs the owner's approval and a phone-specific + runbook. Stream logs before driver load, use the owned watchdog and durable + markers, and make one hardware change per boot. Stop on lost USB, missing + acknowledgment, SPI/CRC faults, a stale marker or unexpected firmware state. + Rollback: buttons/fastboot and retained B RAM images. Never reset userdata + as a shortcut. Risk: hardware-dependent; no revised-stack approval implied. + +The Wi-Fi DT revision additionally introduces a disabled `regulator-wlan`. +Its future link-stage overlay must enable it; these historical overlays do not. +No prospective overlay should be copied into the working phone as-is. diff --git a/device/bluejay/bringup/bin/omamobile-bluejay-boot-ready b/device/bluejay/bringup/bin/omamobile-bluejay-boot-ready new file mode 100755 index 000000000..d1eb2e754 --- /dev/null +++ b/device/bluejay/bringup/bin/omamobile-bluejay-boot-ready @@ -0,0 +1,9 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +set -euo pipefail +# Keep the failed-boot marker unless both local rescue prerequisites exist. +ip -4 -o address show dev usb0 | grep -F ' 172.16.42.1/24 ' >/dev/null +systemctl is-active --quiet sshd.service +rm -f /var/lib/omamobile/root-boot-pending +sync /var/lib/omamobile +echo 'bluejay: persistent root and USB SSH ready' diff --git a/device/bluejay/bringup/bin/omamobile-bluejay-check b/device/bluejay/bringup/bin/omamobile-bluejay-check new file mode 100755 index 000000000..83e3217f5 --- /dev/null +++ b/device/bluejay/bringup/bin/omamobile-bluejay-check @@ -0,0 +1,24 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Passive first-root gate. Never changes storage flags, modules, or registers. +set -euo pipefail +fail() { echo "bluejay-check: $*" >&2; exit 1; } +[[ $(tr '\0' '\n' < /proc/device-tree/compatible | head -1) == google,gs101-bluejay ]] || fail 'wrong board' +[[ ! -e /dev/sda ]] || fail 'whole-disk node present' +[[ $(sed -n 's/^androidboot.slot_suffix = "_\([ab]\)"$/\1/p' /proc/bootconfig) == b ]] || fail 'not slot B' +count=0 +for f in /sys/class/block/*/uevent; do + name=$(sed -n 's/^PARTNAME=//p' "$f") + [[ -n $name ]] || continue + p=${f%/uevent} + case $name in boot_b|vendor_boot_b|dtbo_b|userdata) expected=0 ;; *) expected=1 ;; esac + [[ $(cat "$p/ro") == "$expected" ]] || fail "unexpected storage guard for $name" + count=$((count + 1)) +done +[[ $count == 49 ]] || fail 'partition inventory changed' +while read -r device mount rest; do + [[ $device != /dev/sd* || $mount == / ]] || fail 'Android partition mounted' +done < /proc/mounts +[[ $(grep -v '^#' /etc/omamobile/boot-update.conf) == AUTO_WRITE=no ]] || fail 'automatic boot writes enabled' +[[ $(readlink /usr/lib/systemd/system/omamobile-boot-success.service) == /dev/null ]] || fail 'boot-success unit is not masked' +echo 'bluejay-check: board, slot, 49 guards, mounts and development boot policy pass' diff --git a/device/bluejay/bringup/bin/omamobile-bluejay-gpu-start b/device/bluejay/bringup/bin/omamobile-bluejay-gpu-start new file mode 100755 index 000000000..95857c135 --- /dev/null +++ b/device/bluejay/bringup/bin/omamobile-bluejay-gpu-start @@ -0,0 +1,40 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Qualified development GPU path, restricted to the G1 DT and exact kernel. +set -euo pipefail +pending=/var/lib/omamobile/bluejay-gpu-pending +ready=/run/omamobile-bluejay-gpu-ready +[[ ! -e $ready ]] || exit 0 +if [[ -e $pending ]]; then + echo 'bluejay: previous GPU startup failed; retaining software rendering' + exit 0 +fi +mkdir -p /var/lib/omamobile +(set -o noclobber; cat /proc/sys/kernel/random/boot_id > "$pending") +sync "$pending" +[[ $(tr '\0' '\n' < /proc/device-tree/compatible | head -1) == google,gs101-bluejay ]] +[[ $(uname -r) == 7.3.0-rc6-omamobile-bluejay-input-gated0 ]] +[[ $(cat /sys/class/watchdog/watchdog0/state) == active ]] +modules=/usr/lib/modules/$(uname -r)/kernel +[[ $(sha256sum "$modules/drivers/clk/samsung/clk-acpm.ko" | cut -d' ' -f1) == 14e24a36e81acdc3e4c2ce9aa4e52c3f687efb2ec6a4619aae7ead19634dc0f6 ]] +[[ $(sha256sum "$modules/drivers/gpu/drm/panfrost/panfrost.ko" | cut -d' ' -f1) == af7ca03ed2224a4d6e0ea723929681df3033da94d17dc10f4a5a305c164b662b ]] +[[ $(sha256sum "$modules/drivers/gpu/drm/scheduler/gpu-sched.ko" | cut -d' ' -f1) == 4c91a6f4693601d7364b58f9ccf7bcf6a295a673d914a93a2186477ae868d80f ]] +# Registering the ACPM provider also makes CPU clocks available. Hold its +# unrelated deferred consumer until CPU DVFS has its own qualification. +[[ ! -e /sys/bus/platform/devices/cpufreq-dt/driver ]] +echo omamobile-gpu-only > /sys/bus/platform/devices/cpufreq-dt/driver_override +modprobe clk_acpm +[[ -L /sys/bus/platform/devices/gs101-acpm-clk/driver ]] +modprobe panfrost +udevadm settle --timeout=5 +[[ -c /dev/dri/renderD128 ]] +[[ $(basename "$(readlink /sys/bus/platform/devices/1c500000.gpu/driver)") == panfrost ]] +[[ $(cat /sys/class/devfreq/1c500000.gpu/available_frequencies) == 151000000 ]] +[[ $(cat /sys/class/devfreq/1c500000.gpu/cur_freq) == 151000000 ]] +[[ ! -e /sys/bus/platform/devices/cpufreq-dt/driver ]] +[[ $(cat /sys/bus/spi/devices/spi0.0/statistics/errors) == 0 ]] +[[ $(cat /sys/bus/spi/devices/spi0.0/statistics/timedout) == 0 ]] +touch "$ready" +rm "$pending" +sync /var/lib/omamobile +echo 'bluejay: Mali-G78 render node ready at 151 MHz' diff --git a/device/bluejay/bringup/bin/omamobile-bluejay-hardware-start b/device/bluejay/bringup/bin/omamobile-bluejay-hardware-start new file mode 100755 index 000000000..86cfa6486 --- /dev/null +++ b/device/bluejay/bringup/bin/omamobile-bluejay-hardware-start @@ -0,0 +1,40 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Development startup using the tested input modules and retained framebuffer. +set -euo pipefail +pending=/var/lib/omamobile/bluejay-hardware-pending +ready=/run/omamobile-bluejay-hardware-ready +[[ ! -e $ready ]] || exit 0 +if [[ -e $pending ]]; then + echo 'bluejay: previous hardware startup failed; leaving USB rescue available' + exit 0 +fi +mkdir -p /var/lib/omamobile +(set -o noclobber; cat /proc/sys/kernel/random/boot_id > "$pending") +sync "$pending" +[[ $(tr '\0' '\n' < /proc/device-tree/compatible | head -1) == google,gs101-bluejay ]] +[[ $(uname -r) == 7.3.0-rc6-omamobile-bluejay-input-gated0 ]] +[[ $(cat /sys/class/watchdog/watchdog0/state) == active ]] +[[ $(cat /sys/module/exynos_usi/parameters/probe_hold_base) == 282329280 ]] +[[ ! -e /sys/bus/platform/devices/10d400c0.usi/driver ]] +modules=/usr/lib/modules/$(uname -r)/kernel +spi=$modules/drivers/spi/spi-s3c64xx.ko +touch=$modules/drivers/input/touchscreen/salixp.ko +[[ $(sha256sum "$spi" | cut -d' ' -f1) == 656acf10f708d54616a3a1920f15e4d13d744b35cb20c3507c8c845ad18393a2 ]] +[[ $(sha256sum "$touch" | cut -d' ' -f1) == dd8344256203e50680e0c9ec44460cd2cd4bc1e8c8d0c8ab077e2d575dcc1267 ]] +echo 0 > /sys/module/exynos_usi/parameters/probe_hold_base +echo 10d400c0.usi > /sys/bus/platform/drivers/exynos-usi/bind +insmod "$spi" +insmod "$touch" alix_stage=3 +[[ $(cat /sys/bus/spi/devices/spi0.0/statistics/errors) == 0 ]] +[[ $(cat /sys/bus/spi/devices/spi0.0/statistics/timedout) == 0 ]] +shopt -s nullglob +inputs=(/sys/bus/spi/devices/spi0.0/input/input*/name) +[[ ${#inputs[@]} == 1 && $(cat "${inputs[0]}") == 'ALIX Touchscreen' ]] +# The shared init has already applied the descriptor's SIMPLEFB_TRIG_CON. +# Refresh must be confirmed visually during the next gated hardware trial. +[[ -e /dev/fb0 ]] +touch "$ready" +rm "$pending" +sync /var/lib/omamobile +echo 'bluejay: touch initialized and framebuffer available; visually verify refresh' diff --git a/device/bluejay/bringup/bin/omamobile-bluejay-wifi-start b/device/bluejay/bringup/bin/omamobile-bluejay-wifi-start new file mode 100755 index 000000000..7023a672d --- /dev/null +++ b/device/bluejay/bringup/bin/omamobile-bluejay-wifi-start @@ -0,0 +1,50 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# One startup per boot; a failed probe is held on the next boot for USB rescue. +set -euo pipefail +pending=/var/lib/omamobile/bluejay-wifi-pending +ready=/run/omamobile-bluejay-wifi-interface +[[ ! -e $ready ]] || exit 0 +if [[ -e $pending ]]; then + echo 'bluejay: previous Wi-Fi startup failed; leaving radio held and USB available' + exit 0 +fi +mkdir -p /var/lib/omamobile +(set -o noclobber; cat /proc/sys/kernel/random/boot_id > "$pending") +sync "$pending" +[[ $(tr '\0' '\n' < /proc/device-tree/compatible | head -1) == google,gs101-bluejay ]] +[[ $(uname -r) == 7.3.0-rc6-omamobile-bluejay-input-gated0 ]] +[[ $(cat /sys/class/watchdog/watchdog0/state) == active ]] +[[ ! -d /sys/module/pcie_gs201 && ! -d /sys/module/brcmfmac ]] +modules=/usr/lib/modules/$(uname -r)/kernel +[[ $(sha256sum "$modules/drivers/phy/samsung/phy-gs201-pcie.ko" | cut -d' ' -f1) == 08efd08749cda00d217fe239b00f757ed9deb230a2ce10e3f20ab6becf85ea12 ]] +[[ $(sha256sum "$modules/drivers/pci/controller/dwc/pcie-gs201.ko" | cut -d' ' -f1) == f556e9cd6ef42a5877411d849071844ebcd20d85f10a3f3a8d787f43bde6a553 ]] +[[ $(sha256sum "$modules/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko" | cut -d' ' -f1) == 72ebf24de53cfcce533858a148bf99aa4581ddaee0d05fbb78eed5d935c413a3 ]] +[[ $(sha256sum "$modules/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/brcmfmac-wcc.ko" | cut -d' ' -f1) == e57a292b28c87b5688e86806b7c72e70b4f4706736ea997f54a1f36655072d27 ]] +insmod "$modules/drivers/phy/samsung/phy-gs201-pcie.ko" trace=1 trace_delay_ms=20 check_tcxo=0 +insmod "$modules/drivers/pci/controller/dwc/pcie-gs201.ko" stop_after=5 trace=1 trace_delay_ms=20 use_ia=1 cmu_acg_off=0 +endpoint=/sys/bus/pci/devices/0000:01:00.0 +[[ $(cat "$endpoint/vendor") == 0x14e4 && $(cat "$endpoint/device") == 0x4441 ]] +echo bluejay-wifi-hold > "$endpoint/driver_override" +modprobe brcmutil +# BRCMF_FEAT_P2P is bit4 in this exact kernel. Hide unqualified Wi-Fi Direct +# so NetworkManager uses the tested station path without creating p2p-dev. +insmod "$modules/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko" chip_only=0 debug=6 feature_disable=16 +insmod "$modules/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/brcmfmac-wcc.ko" +printf '\n' > "$endpoint/driver_override" +echo 0000:01:00.0 > /sys/bus/pci/drivers/brcmfmac/bind +for ((i=0; i<100; i++)); do + shopt -s nullglob + interfaces=("$endpoint"/net/*) + ((${#interfaces[@]})) && break + sleep .1 +done +udevadm settle --timeout=10 +interfaces=("$endpoint"/net/*) +[[ ${#interfaces[@]} == 1 ]] +interface=${interfaces[0]##*/} +[[ -d /sys/class/net/$interface/phy80211 ]] +printf '%s\n' "$interface" > "$ready" +rm "$pending" +sync /var/lib/omamobile +echo "bluejay: station Wi-Fi ready on $interface" diff --git a/device/bluejay/bringup/bluejay-gpu-smoke.c b/device/bluejay/bringup/bluejay-gpu-smoke.c new file mode 100644 index 000000000..056999eba --- /dev/null +++ b/device/bluejay/bringup/bluejay-gpu-smoke.c @@ -0,0 +1,153 @@ +// SPDX-License-Identifier: MIT +// Explicit render-node GLES pixel checks; run under an external deadline. +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void require(int ok, const char *what) +{ + if (!ok) { + fprintf(stderr, "FAIL: %s (EGL %#x GL %#x)\n", what, + eglGetError(), glGetError()); + exit(1); + } +} + +static GLuint shader(GLenum type, const char *source) +{ + GLuint s = glCreateShader(type); + GLint ok; + char log[2048]; + + glShaderSource(s, 1, &source, NULL); + glCompileShader(s); + glGetShaderiv(s, GL_COMPILE_STATUS, &ok); + if (!ok) { + glGetShaderInfoLog(s, sizeof(log), NULL, log); + fprintf(stderr, "%s\n", log); + } + require(ok, "shader compile"); + return s; +} + +static void pixels(int size, int r, int g, int b, const char *name) +{ + size_t count = (size_t)size * size; + unsigned char *data = malloc(count * 4); + + require(data != NULL, "pixel allocation"); + glFinish(); + glReadPixels(0, 0, size, size, GL_RGBA, GL_UNSIGNED_BYTE, data); + require(glGetError() == GL_NO_ERROR, "pixel readback"); + for (size_t i = 0; i < count; ++i) { + if (abs(data[i * 4] - r) > 1 || abs(data[i * 4 + 1] - g) > 1 || + abs(data[i * 4 + 2] - b) > 1 || data[i * 4 + 3] != 255) { + fprintf(stderr, "FAIL: %s size %d pixel %zu = %u,%u,%u,%u\n", + name, size, i, data[i * 4], data[i * 4 + 1], + data[i * 4 + 2], data[i * 4 + 3]); + exit(1); + } + } + free(data); + printf("PASS: %s %dx%d all pixels\n", name, size, size); + fflush(stdout); +} + +int main(int argc, char **argv) +{ + const char *node = argc > 1 ? argv[1] : "/dev/dri/renderD128"; + const char *vs = "#version 300 es\n" + "void main(){vec2 p=vec2((gl_VertexID<<1)&2,gl_VertexID&2);" + "gl_Position=vec4(p*2.-1.,0.,1.);}"; + const char *fs = "#version 300 es\nprecision highp float;" + "uniform vec4 color;out vec4 outColor;" + "void main(){outColor=color;}"; + EGLint config_attrs[] = {EGL_SURFACE_TYPE, 0, EGL_RENDERABLE_TYPE, + EGL_OPENGL_ES3_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_NONE}; + EGLint context_attrs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE}; + EGLConfig config; + EGLint count; + GLuint program, framebuffer, texture; + GLint linked, color; + int sizes[] = {64, 257, 1024}; + int fd = open(node, O_RDWR | O_CLOEXEC); + struct gbm_device *gbm; + EGLDisplay display; + EGLContext context; + const char *renderer; + + setbuf(stdout, NULL); + require(fd >= 0, "open render node"); + gbm = gbm_create_device(fd); + require(gbm != NULL, "GBM device"); + display = eglGetPlatformDisplay(EGL_PLATFORM_GBM_KHR, gbm, NULL); + require(display != EGL_NO_DISPLAY && eglInitialize(display, NULL, NULL), + "EGL initialize on explicit GBM device"); + require(eglBindAPI(EGL_OPENGL_ES_API), "bind GLES"); + require(eglChooseConfig(display, config_attrs, &config, 1, &count) && count, + "GLES3 configuration"); + context = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attrs); + require(context != EGL_NO_CONTEXT, "GLES3 context"); + require(eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, context), + "surfaceless context"); + renderer = (const char *)glGetString(GL_RENDERER); + printf("Renderer: %s\nVersion: %s\n", renderer ? renderer : "NULL", + glGetString(GL_VERSION)); + require(renderer && strstr(renderer, "Mali-G78") && strstr(renderer, "Panfrost"), + "hardware Mali-G78 Panfrost renderer"); + program = glCreateProgram(); + glAttachShader(program, shader(GL_VERTEX_SHADER, vs)); + glAttachShader(program, shader(GL_FRAGMENT_SHADER, fs)); + glLinkProgram(program); + glGetProgramiv(program, GL_LINK_STATUS, &linked); + require(linked, "program link"); + glUseProgram(program); + color = glGetUniformLocation(program, "color"); + require(color >= 0, "color uniform"); + glGenFramebuffers(1, &framebuffer); + glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + for (unsigned int i = 0; i < sizeof(sizes) / sizeof(sizes[0]); ++i) { + int size = sizes[i]; + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, size, size, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, texture, 0); + require(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE, + "RGBA8 framebuffer"); + glViewport(0, 0, size, size); + glDisable(GL_BLEND); + glClearColor(1, 0, 0, 1); + glClear(GL_COLOR_BUFFER_BIT); + pixels(size, 255, 0, 0, "clear"); + glUniform4f(color, 0, 1, 0, 1); + glDrawArrays(GL_TRIANGLES, 0, 3); + pixels(size, 0, 255, 0, "shader solid"); + glEnable(GL_BLEND); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, + GL_ZERO, GL_ONE); + glUniform4f(color, 0, 0, 1, 0.5); + glDrawArrays(GL_TRIANGLES, 0, 3); + pixels(size, 0, 127, 128, "shader blend"); + } + require(glGetError() == GL_NO_ERROR, "final GL status"); + glDeleteTextures(1, &texture); + glDeleteFramebuffers(1, &framebuffer); + glDeleteProgram(program); + eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroyContext(display, context); + eglTerminate(display); + gbm_device_destroy(gbm); + close(fd); + puts("PASS: Bluejay headless hardware rendering"); + return 0; +} diff --git a/device/bluejay/bringup/bluejay-touch-view.c b/device/bluejay/bringup/bluejay-touch-view.c new file mode 100644 index 000000000..7aa962cd4 --- /dev/null +++ b/device/bluejay/bringup/bluejay-touch-view.c @@ -0,0 +1,222 @@ +/* SPDX-License-Identifier: MIT */ +/* Bounded framebuffer/evdev diagnostic. No MMIO, driver load, grab, or storage IO. */ +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +enum { W=1080, H=2400, SLOTS=10, BYTES=W*H*4 }; +struct contact { int id,x,y; }; +struct state { + struct contact c[SLOTS]; int slot; + unsigned starts, releases, frames, dropped, edges, keydown[3], keyup[3]; + bool held[3]; +}; +static uint32_t *screen; +static const uint32_t bg=0xff101b25, grid=0xff263e4c; +static void box(int x,int y,int w,int h,uint32_t color) +{ + for(int j=y;j=0 && i=0 && jtype==EV_SYN && e->code==SYN_DROPPED) { s->dropped++;return -1; } + if(keys && e->type==EV_KEY) { + int i=e->code==KEY_POWER?0:e->code==KEY_VOLUMEUP?1:e->code==KEY_VOLUMEDOWN?2:-1; + if(i<0)return 0; + if(e->value==1) {s->keydown[i]++;s->held[i]=true;} + else if(e->value==0) {s->keyup[i]++;s->held[i]=false;} + else if(e->value!=2)return -1; + key_indicator(i,s->held[i]?1:2); + } + if(keys)return 0; + if(e->type==EV_ABS) { + if(e->code==ABS_MT_SLOT) {if(e->value<0||e->value>=SLOTS)return -1;s->slot=e->value;} + else if(e->code==ABS_MT_TRACKING_ID) { + struct contact *c=&s->c[s->slot]; + if(e->value>=0) {if(c->id>=0)return -1;s->starts++;} + else {if(c->id<0)return -1;s->releases++;} + c->id=e->value; + } else if(e->code==ABS_MT_POSITION_X) { + if(e->value<0||e->value>=W)return -1; + s->c[s->slot].x=e->value; + } else if(e->code==ABS_MT_POSITION_Y) { + if(e->value<0||e->value>=H)return -1; + s->c[s->slot].y=e->value; + } + } + if(e->type==EV_SYN && e->code==SYN_REPORT) { + s->frames++; + for(int i=0;ic[i].id>=0) { + int x=s->c[i].x,y=s->c[i].y; + uint32_t color=i%2?0xffffc266:0xff5ddbb0; + box(x-6,y-6,13,13,color);box(x-24,y-1,49,3,color);box(x-1,y-24,3,49,color); + if(x<=54)s->edges|=1; + if(x>=W-55)s->edges|=2; + if(y<=120)s->edges|=4; + if(y>=H-121)s->edges|=8; + } + } + return 0; +} +static double now(void) +{ struct timespec t;if(clock_gettime(CLOCK_MONOTONIC,&t))exit(2);return t.tv_sec+t.tv_nsec/1e9; } +static void init(struct state *s) +{ memset(s,0,sizeof(*s));for(int i=0;ic[i].id=-1; } +static bool held(const struct state *s) +{ + for(int i=0;ic[i].id>=0)return true; + for(int i=0;i<3;i++)if(s->held[i])return true; + return false; +} +static bool window_open(double t,double deadline,bool active) +{ return t60)return 2;} + int fb=open("/dev/fb0",(probe?O_RDONLY:O_RDWR)|O_CLOEXEC),fd[2]={-1,-1}; + struct fb_fix_screeninfo fix;struct fb_var_screeninfo var; + if(fb<0||ioctl(fb,FBIOGET_FSCREENINFO,&fix)||ioctl(fb,FBIOGET_VSCREENINFO,&var))return 2; + if(strncmp(fix.id,"simpledrm",9)||var.xres!=W||var.yres!=H||var.bits_per_pixel!=32|| + var.xoffset||var.yoffset||fix.line_length!=W*4||fix.smem_len=SLOTS)return 2; + screen=mmap(NULL,BYTES,PROT_READ|PROT_WRITE,MAP_SHARED,fb,0);if(screen==MAP_FAILED)return 2;base(); + double started=now(),deadline=started+seconds;int failed=0;bool cue=false,grace=false; + printf("VISUAL_CAPTURE_READY monotonic=%.6f seconds=%ld release_grace=5 event_clock=MONOTONIC\n",started,seconds);fflush(stdout); + while(window_open(now(),deadline,held(&s))&&!failed) { + double remaining=deadline-now(); + if(!cue&&(s.edges==15||remaining<=20)) { + puts("BUTTON_PHASE_NOW: briefly tap Power, Volume Up and Volume Down, then release everything.");fflush(stdout); + label(276,310,"BUTTONS NOW",0xffffc266);cue=true; + } + if(!grace&&remaining<=0) {puts("RELEASE_EVERYTHING_NOW");fflush(stdout);grace=true;} + int width=(int)((W-80)*(remaining>0?remaining/seconds:0)); + box(40,H-60,W-80,12,grid);box(40,H-60,width,12,0xff5ddbb0); + struct pollfd p[2]={{.fd=fd[0],.events=POLLIN},{.fd=fd[1],.events=POLLIN}}; + int r=poll(p,2,100);if(r<0) {if(errno==EINTR)continue;failed=1;break;} + for(int i=0;i<2;i++) { + if(p[i].revents&(POLLERR|POLLHUP|POLLNVAL)) {failed=1;break;} + if(p[i].revents&POLLIN) { + struct input_event events[64];ssize_t n=read(fd[i],events,sizeof(events)); + if(n<0&&(errno==EAGAIN||errno==EINTR))continue; + if(n<=0||n%(ssize_t)sizeof(events[0])) {failed=1;break;} + for(size_t j=0;j<(size_t)n/sizeof(events[0]);j++) { + printf("EVENT %d %lld %lld %u %u %d\n",i,(long long)events[j].time.tv_sec,(long long)events[j].time.tv_usec,events[j].type,events[j].code,events[j].value); + if(event(&s,&events[j],i==1))failed=1; + } + } + } + } + int active=0;bool released=true;for(int i=0;i=0; + ids[0]=ABS_MT_TRACKING_ID;if(ioctl(fd[0],EVIOCGMTSLOTS(sizeof(ids)),ids))failed=1; + for(int i=1;i<=SLOTS;i++)if(ids[i]!=-1)released=false; + memset(keys,0,sizeof(keys));if(ioctl(fd[1],EVIOCGKEY(sizeof(keys)),keys)<0)failed=1; + for(int i=0;i<3;i++) { + int code=i==0?KEY_POWER:i==1?KEY_VOLUMEUP:KEY_VOLUMEDOWN; + if(keys[code/8]&(1U<<(code%8)))released=false; + } + for(int i=0;i<3;i++)if(s.held[i]||s.keydown[i]!=s.keyup[i])released=false; + bool complete=released&&!active&&s.starts&&s.starts==s.releases&&s.edges==15; + for(int i=0;i<3;i++)if(!s.keydown[i]||s.keydown[i]!=s.keyup[i])complete=false; + printf("{\"starts\":%u,\"releases\":%u,\"frames\":%u,\"active\":%d,\"edges\":%u,\"dropped\":%u,\"power\":[%u,%u],\"volume_up\":[%u,%u],\"volume_down\":[%u,%u],\"failed\":%s,\"released\":%s,\"coverage_complete\":%s,\"elapsed\":%.6f}\n",s.starts,s.releases,s.frames,active,s.edges,s.dropped,s.keydown[0],s.keyup[0],s.keydown[1],s.keyup[1],s.keydown[2],s.keyup[2],failed?"true":"false",released?"true":"false",complete?"true":"false",now()-started); + munmap(screen,BYTES);close(fb);close(fd[0]);close(fd[1]); + /* Incomplete owner coverage is a partial result, not a transport/kernel fault. */ + return failed?1:complete?0:3; +} diff --git a/device/bluejay/bringup/uwsm/env.d/90-omamobile-bluejay-graphics b/device/bluejay/bringup/uwsm/env.d/90-omamobile-bluejay-graphics new file mode 100644 index 000000000..d61b4eb49 --- /dev/null +++ b/device/bluejay/bringup/uwsm/env.d/90-omamobile-bluejay-graphics @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: MIT +# Retained simpledrm display; software fallback if guarded GPU startup is held. +export AQ_DRM_DEVICES=/dev/dri/card0 +if [ -e /run/omamobile-bluejay-gpu-ready ] && [ -c /dev/dri/renderD128 ]; then + export LIBGL_ALWAYS_SOFTWARE=0 + export GALLIUM_DRIVER=panfrost + export QT_QUICK_BACKEND=rhi +else + export LIBGL_ALWAYS_SOFTWARE=1 + export GALLIUM_DRIVER=llvmpipe + export QT_QUICK_BACKEND=software +fi +export AQ_SIMPLEDRM_NO_AUX_RENDERER=1 +export LD_LIBRARY_PATH=/usr/local/lib/bluejay${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} diff --git a/device/bluejay/bringup/vendor/NetworkManager/conf.d/10-omamobile-usb.conf b/device/bluejay/bringup/vendor/NetworkManager/conf.d/10-omamobile-usb.conf new file mode 100644 index 000000000..ae76c0819 --- /dev/null +++ b/device/bluejay/bringup/vendor/NetworkManager/conf.d/10-omamobile-usb.conf @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: MIT +[keyfile] +unmanaged-devices=interface-name:usb0 diff --git a/device/bluejay/bringup/vendor/NetworkManager/conf.d/30-bluejay-station.conf b/device/bluejay/bringup/vendor/NetworkManager/conf.d/30-bluejay-station.conf new file mode 100644 index 000000000..902cf339b --- /dev/null +++ b/device/bluejay/bringup/vendor/NetworkManager/conf.d/30-bluejay-station.conf @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: MIT +[device-bluejay-wifi] +match-device=driver:brcmfmac +wifi.scan-rand-mac-address=no + +[connection-bluejay-wifi] +match-device=driver:brcmfmac +wifi.powersave=2 diff --git a/device/bluejay/bringup/vendor/modprobe.d/omamobile-bluejay.conf b/device/bluejay/bringup/vendor/modprobe.d/omamobile-bluejay.conf new file mode 100644 index 000000000..baeeca6a9 --- /dev/null +++ b/device/bluejay/bringup/vendor/modprobe.d/omamobile-bluejay.conf @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: MIT +# No automatic hardware experiments on the first persistent root. +blacklist spi_s3c64xx +blacklist salixp +options salixp alix_stage=0 +blacklist brcmfmac +blacklist pcie_gs201 +blacklist phy_gs201_pcie +blacklist brcmfmac_wcc +blacklist brcmfmac_cyw +blacklist brcmfmac_bca +blacklist ath11k_pci +blacklist ath12k +blacklist panfrost +blacklist clk_acpm +blacklist panthor +blacklist gs_decon +blacklist gs_dsim_cmd +blacklist tcpci_maxim +blacklist gpio_max77759 +blacklist max77759_charger +blacklist pcie_gs201_cp +blacklist cpif +blacklist shm_ipc +blacklist boot_device_spi diff --git a/device/bluejay/bringup/vendor/systemd/logind.conf.d/10-bluejay-bringup.conf b/device/bluejay/bringup/vendor/systemd/logind.conf.d/10-bluejay-bringup.conf new file mode 100644 index 000000000..1a56edb61 --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/logind.conf.d/10-bluejay-bringup.conf @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: MIT +# Button events must not trigger a shutdown during qualification. +[Login] +HandlePowerKey=ignore +HandlePowerKeyLongPress=ignore +HandleSuspendKey=ignore +IdleAction=ignore diff --git a/device/bluejay/bringup/vendor/systemd/network/20-usb-gadget.network b/device/bluejay/bringup/vendor/systemd/network/20-usb-gadget.network new file mode 100644 index 000000000..8c71ec4d3 --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/network/20-usb-gadget.network @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: MIT +# Keep rescue USB addressed without taking over the Wi-Fi default route. +[Match] +Name=usb0 + +[Network] +Address=172.16.42.1/24 +ConfigureWithoutCarrier=yes +IPv6AcceptRA=no +LinkLocalAddressing=no diff --git a/device/bluejay/bringup/vendor/systemd/sleep.conf.d/10-bluejay-bringup.conf b/device/bluejay/bringup/vendor/systemd/sleep.conf.d/10-bluejay-bringup.conf new file mode 100644 index 000000000..5949e5e5c --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/sleep.conf.d/10-bluejay-bringup.conf @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: MIT +[Sleep] +AllowSuspend=no +AllowHibernation=no +AllowHybridSleep=no +AllowSuspendThenHibernate=no diff --git a/device/bluejay/bringup/vendor/systemd/system.conf.d/10-bluejay-watchdog.conf b/device/bluejay/bringup/vendor/systemd/system.conf.d/10-bluejay-watchdog.conf new file mode 100644 index 000000000..0bad679fe --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/system.conf.d/10-bluejay-watchdog.conf @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: MIT +[Manager] +RuntimeWatchdogSec=20s +RebootWatchdogSec=1min diff --git a/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-boot-ready.service b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-boot-ready.service new file mode 100644 index 000000000..d98af9986 --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-boot-ready.service @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: MIT +[Unit] +Description=Complete Bluejay development boot after USB SSH is available +Requires=sshd.service omamobile-bluejay-check.service +After=sshd.service omamobile-bluejay-check.service systemd-networkd.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/omamobile-bluejay-boot-ready +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-check.service b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-check.service new file mode 100644 index 000000000..fbe0d4de8 --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-check.service @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: MIT +[Unit] +Description=Check Bluejay storage and development boot policy +Before=sddm.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/omamobile-bluejay-check +RemainAfterExit=yes +ProtectSystem=strict +ProtectHome=yes +NoNewPrivileges=yes + +[Install] +WantedBy=multi-user.target diff --git a/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-gpu.service b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-gpu.service new file mode 100644 index 000000000..39077608a --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-gpu.service @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: MIT +[Unit] +Description=Start qualified Bluejay development GPU +ConditionPathExists=/etc/omamobile/bluejay-gpu-enable +Requires=omamobile-bluejay-boot-ready.service omamobile-bluejay-hardware.service +After=omamobile-bluejay-boot-ready.service omamobile-bluejay-hardware.service omamobile-bluejay-wifi.service systemd-journald.service +Before=sddm.service +FailureAction=reboot-force + +[Service] +Type=oneshot +ExecStart=/usr/bin/omamobile-bluejay-gpu-start +RemainAfterExit=yes +TimeoutStartSec=30s +TimeoutStopSec=5s diff --git a/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-hardware.service b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-hardware.service new file mode 100644 index 000000000..62521dede --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-hardware.service @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: MIT +[Unit] +ConditionPathExists=/etc/omamobile/bluejay-hardware-enable +Description=Start tested Bluejay touch and retained display refresh +Requires=omamobile-bluejay-boot-ready.service +After=omamobile-bluejay-boot-ready.service systemd-journald.service +Before=sddm.service +FailureAction=reboot-force + +[Service] +Type=oneshot +ExecStart=/usr/bin/omamobile-bluejay-hardware-start +RemainAfterExit=yes +TimeoutStartSec=25s +TimeoutStopSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-wifi.service b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-wifi.service new file mode 100644 index 000000000..fc35202a8 --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-wifi.service @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: MIT +[Unit] +ConditionPathExists=/etc/omamobile/bluejay-wifi-enable +Description=Start Bluejay station Wi-Fi with the tested firmware and PCIe path +Requires=omamobile-bluejay-boot-ready.service NetworkManager.service +After=omamobile-bluejay-boot-ready.service omamobile-bluejay-hardware.service NetworkManager.service systemd-journald.service +FailureAction=reboot-force + +[Service] +Type=oneshot +ExecStart=/usr/bin/omamobile-bluejay-wifi-start +RemainAfterExit=yes +TimeoutStartSec=45s +TimeoutStopSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/device/bluejay/bringup/vendor/systemd/system/sddm.service.d/bluejay-check.conf b/device/bluejay/bringup/vendor/systemd/system/sddm.service.d/bluejay-check.conf new file mode 100644 index 000000000..a0bf340fe --- /dev/null +++ b/device/bluejay/bringup/vendor/systemd/system/sddm.service.d/bluejay-check.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +[Unit] +ConditionPathExists=/run/omamobile-bluejay-hardware-ready +Requires=omamobile-bluejay-hardware.service omamobile-bluejay-gpu.service +After=omamobile-bluejay-hardware.service omamobile-bluejay-gpu.service diff --git a/device/bluejay/kernel.config b/device/bluejay/kernel.config new file mode 100644 index 000000000..f774a27b7 --- /dev/null +++ b/device/bluejay/kernel.config @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: MIT +# Qualified development kernel shape, not the release kernel configuration. +CONFIG_LOCALVERSION="-omamobile-bluejay-input-gated0" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_SPI_S3C64XX=m +CONFIG_TOUCHSCREEN_SALIXP=m +CONFIG_WATCHDOG_SYSFS=y +CONFIG_DMA_RESTRICTED_POOL=y +CONFIG_SWIOTLB_DEFAULT_SIZE_MB=64 +# CONFIG_SWIOTLB_DYNAMIC is not set +CONFIG_EXYNOS_ACPM_CLK=m +CONFIG_FUSE_FS=m diff --git a/device/bluejay/overlays/gpu-g1.dtso b/device/bluejay/overlays/gpu-g1.dtso new file mode 100644 index 000000000..23503b45b --- /dev/null +++ b/device/bluejay/overlays/gpu-g1.dtso @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0-only +/dts-v1/; +/plugin/; + +/* Manual Panfrost qualification only; keep the module blacklisted at boot. + * Limit ACPM to its lowest existing shader/L2 pair (151/302 MHz). + * Supply wiring follows gs101-pmic.dtsi, also included by stock Bluejay. + */ +&{/} { + bluejay_gpu_opp: opp-table-bluejay { + compatible = "operating-points-v2"; + opp-151000000 { + opp-hz = /bits/ 64 <151000000>; + }; + }; +}; + +&gpu { + mali-supply = <&s2mpg11_buck2s>; + g3d-l2-supply = <&s2mpg11_buck8s>; + g3d-m-supply = <&s2mpg11_ldo1s>; + int-m-supply = <&s2mpg10_buck7m>; + operating-points-v2 = <&bluejay_gpu_opp>; + status = "okay"; +}; diff --git a/device/bluejay/overlays/input-alix.dtso b/device/bluejay/overlays/input-alix.dtso new file mode 100644 index 000000000..aece84625 --- /dev/null +++ b/device/bluejay/overlays/input-alix.dtso @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only +/dts-v1/; +/plugin/; + +/* Requires the held input-controller overlay and blacklisted SPI/ALIX modules. */ +&bluejay_touch { + status = "okay"; +}; diff --git a/device/bluejay/overlays/input-controller.dtso b/device/bluejay/overlays/input-controller.dtso new file mode 100644 index 000000000..4e7c22b02 --- /dev/null +++ b/device/bluejay/overlays/input-controller.dtso @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-only +/dts-v1/; +/plugin/; + +/* Keep the already-qualified USI/SPI path held until USB rescue is ready. */ +&{/chosen} { + bootargs = "console=tty0 panic=10 clk_ignore_unused pd_ignore_unused rdinit=/init exynos_usi.probe_hold_base=0x10d400c0"; +}; + +&usi11 { + status = "okay"; +}; + +&spi_11 { + status = "okay"; +}; diff --git a/device/bluejay/overlays/wifi-controller.dtso b/device/bluejay/overlays/wifi-controller.dtso new file mode 100644 index 000000000..7e14d2f10 --- /dev/null +++ b/device/bluejay/overlays/wifi-controller.dtso @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Requires wifi-pool, live pool qualification and blacklisted modules. + * Controller stages 0-4 only, under the guarded single-attempt runner. + * Applying this overlay alone does not authorize a driver load. + */ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target-path = "/soc@0/phy@14550000"; + __overlay__ { + status = "okay"; + }; + }; + fragment@1 { + target-path = "/soc@0/pcie@14520000"; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/device/bluejay/overlays/wifi-endpoint.dtso b/device/bluejay/overlays/wifi-endpoint.dtso new file mode 100644 index 000000000..a96d1ca3b --- /dev/null +++ b/device/bluejay/overlays/wifi-endpoint.dtso @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Requires wifi-pool + wifi-controller and passed stages 0-4 on separate boots. + * Link/attachment inspection only; brcmfmac stays blocked until its own gates. + */ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target-path = "/soc@0/pcie@14520000/pcie@0,0/wifi@0,0"; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/device/bluejay/overlays/wifi-intx.dtso b/device/bluejay/overlays/wifi-intx.dtso new file mode 100644 index 000000000..6cb8d2eb0 --- /dev/null +++ b/device/bluejay/overlays/wifi-intx.dtso @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-only +/dts-v1/; +/plugin/; + +/* pci_irqd_intx_xlate() expects PCI pins 1-4, then subtracts one. */ +&bluejay_pcie1 { + #address-cells = <3>; + #interrupt-cells = <1>; + interrupt-map = <0 0 0 1 &bluejay_pcie1_intc 1>, + <0 0 0 2 &bluejay_pcie1_intc 2>, + <0 0 0 3 &bluejay_pcie1_intc 3>, + <0 0 0 4 &bluejay_pcie1_intc 4>; +}; diff --git a/device/bluejay/overlays/wifi-pool.dtso b/device/bluejay/overlays/wifi-pool.dtso new file mode 100644 index 000000000..8a5209e38 --- /dev/null +++ b/device/bluejay/overlays/wifi-pool.dtso @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Pool-only boot: no PCIe, PHY or WLAN driver. See WIFI-INTEGRATION-P1.md. */ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target-path = "/reserved-memory/dma-pool@c4000000"; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/device/bluejay/patches/aquamarine-simpledrm-no-aux-renderer.patch b/device/bluejay/patches/aquamarine-simpledrm-no-aux-renderer.patch new file mode 100644 index 000000000..a4c7a9bcc --- /dev/null +++ b/device/bluejay/patches/aquamarine-simpledrm-no-aux-renderer.patch @@ -0,0 +1,14 @@ +--- a/src/backend/drm/DRM.cpp ++++ b/src/backend/drm/DRM.cpp +@@ -1121,8 +1121,10 @@ + + auto drmVerName = drmVer && drmVer->name ? drmVer->name : "unknown"; + driver = driverFromName(drmVerName); +- if (driver == AQ_BACKEND_GPU_DRIVER_EVDI) { ++ if (driver == AQ_BACKEND_GPU_DRIVER_EVDI || (std::string_view(drmVerName) == "simpledrm" && envEnabled("AQ_SIMPLEDRM_NO_AUX_RENDERER"))) { + // DisplayLink/evdi exposes KMS without a usable EGL renderer. Keep primary so its output swapchain stays LINEAR. ++ // A primary simpledrm device can use Mesa's GBM software renderer too, ++ // but has no DRM-backed EGLDevice for the auxiliary renderer probe. + rendererRequired = false; + } + diff --git a/tests/all b/tests/all index 27a3b1482..33f782f7b 100755 --- a/tests/all +++ b/tests/all @@ -65,6 +65,7 @@ else echo "ok - # skip: no root image in out/ for tests/rootfs-smoke (tools/build-rootfs)" fi +python3 tests/bluejay-root-ready.py echo "# tests/phone-ssh" tests/phone-ssh echo "# tests/module-load-once" diff --git a/tests/bluejay-root-ready.py b/tests/bluejay-root-ready.py new file mode 100644 index 000000000..b1881d6eb --- /dev/null +++ b/tests/bluejay-root-ready.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Run the proposed SSH-ready helper with a fake USB link and service state.""" +from pathlib import Path +import os +import subprocess +import tempfile + +repo = Path(__file__).resolve().parent.parent +source = (repo / 'device/bluejay/bringup/bin/omamobile-bluejay-boot-ready').read_text() +for address, ssh in ((True, True), (False, True), (True, False)): + with tempfile.TemporaryDirectory() as tmp: + p = Path(tmp) + root = p / 'state' + root.mkdir() + marker = root / 'root-boot-pending' + marker.write_text('pending\n') + bindir = p / 'bin' + bindir.mkdir() + (bindir / 'ip').write_text('#!/bin/sh\n' + + ('echo "1: usb0 inet 172.16.42.1/24 scope global usb0"\n' if address else 'exit 0\n')) + (bindir / 'systemctl').write_text('#!/bin/sh\nexit ' + ('0\n' if ssh else '1\n')) + for f in bindir.iterdir(): + f.chmod(0o755) + helper = p / 'ready' + helper.write_text(source.replace('/var/lib/omamobile', str(root))) + result = subprocess.run(['bash', str(helper)], + env={**os.environ, 'PATH': str(bindir) + ':' + os.environ['PATH']}, + capture_output=True, text=True) + assert (result.returncode == 0) == (address and ssh), result + assert marker.exists() != (address and ssh) + print('ok - pending marker follows verified USB and SSH readiness:', address, ssh) From ac1a11bfbed7a2fb40e3327cb2ba1f4d2063d882 Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Tue, 10 Nov 2026 12:12:52 -0600 Subject: [PATCH 2/3] device/bluejay: identify tested startup kernel and bootargs replacement Name the exact historical kernel source and release that the pinned helpers support. Warn that input-controller.dtso replaces the complete chosen bootargs string, so combining overlays requires inspecting both final DT variants and preserving the selected recovery policy. Co-Authored-By: OpenAI Codex --- device/bluejay/bringup/README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/device/bluejay/bringup/README.md b/device/bluejay/bringup/README.md index c28a552cc..9d12af5c7 100644 --- a/device/bluejay/bringup/README.md +++ b/device/bluejay/bringup/README.md @@ -7,12 +7,19 @@ snapshot remains at commit 6ad4651f8ac151333345c72db99f1fd83259696f in the contributor's omarchy-mobile fork. The revised files have not run on a phone. The hardware, Wi-Fi and GPU helpers retain their exact tested release/module -pins and explicit opt-ins. They target the OLD development kernel, including -its USI probe hold and ALIX stage parameter. They intentionally refuse the +pins and explicit opt-ins. They target the tested kernel source `c934e316b` +(release `7.3.0-rc6-omamobile-bluejay-input-gated0`), including its USI probe +hold and ALIX stage parameter. They intentionally refuse the revised kernel topics. Removing a check or changing a hash is not qualification. The new ALIX topic drops both staging knobs: a separate next-run helper must be prepared and reviewed before testing that stack. +`device/bluejay/overlays/input-controller.dtso` replaces the whole +`/chosen/bootargs` string; it does not append its USI probe-hold argument. +Before combining it with other overlays, inspect the final bootargs in both +DT variants and retain every argument the matching boot/recovery policy needs. +It is a historical overlay for the tested kernel, not the revised ALIX path. + The retained-display startup no longer reads or writes registers with devmem. Use `SIMPLEFB_TRIG_CON="0x1c300030 0x3061"` in the Bluejay descriptor and rebuild with the shared init; its COMPATIBLE check owns the trigger. Native panel From 5d5bd6bd77c60457d2c3c217eabdee3e0544e12e Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Wed, 11 Nov 2026 12:06:37 -0600 Subject: [PATCH 3/3] device/bluejay: isolate the historical kernel configuration Keep the fixed release string and module choices out of ordinary Bluejay builds. Describe manual use with the exact historical kernel, overlay compatibility and installation and restoration of the matching root gates. Co-Authored-By: Codex --- device/bluejay/bringup/README.md | 83 ++++++++++++++++++++++ device/bluejay/{ => bringup}/kernel.config | 0 2 files changed, 83 insertions(+) rename device/bluejay/{ => bringup}/kernel.config (100%) diff --git a/device/bluejay/bringup/README.md b/device/bluejay/bringup/README.md index 9d12af5c7..952dd1a08 100644 --- a/device/bluejay/bringup/README.md +++ b/device/bluejay/bringup/README.md @@ -14,11 +14,20 @@ revised kernel topics. Removing a check or changing a hash is not qualification. The new ALIX topic drops both staging knobs: a separate next-run helper must be prepared and reviewed before testing that stack. +`bringup/kernel.config` is the historical fragment for rebuilding `c934e316b`. +Apply it by hand with `scripts/kconfig/merge_config.sh` after the shared config, +then run `olddefconfig` in that build's own output directory. It is deliberately +outside `device/bluejay/kernel.config`, so ordinary Bluejay builds keep their +own kernel release, commit suffix and SPI configuration. + + `device/bluejay/overlays/input-controller.dtso` replaces the whole `/chosen/bootargs` string; it does not append its USI probe-hold argument. Before combining it with other overlays, inspect the final bootargs in both DT variants and retain every argument the matching boot/recovery policy needs. It is a historical overlay for the tested kernel, not the revised ALIX path. +These overlays name labels from that development tree and do not apply to the +published kernel. Rebuild and validate a matched set before another trial. The retained-display startup no longer reads or writes registers with devmem. Use `SIMPLEFB_TRIG_CON="0x1c300030 0x3061"` in the Bluejay descriptor and rebuild @@ -53,3 +62,77 @@ change the init and companion together, with a retained RAM rescue image. The Wi-Fi DT revision additionally introduces a disabled `regulator-wlan`. Its future link-stage overlay must enable it; these historical overlays do not. No prospective overlay should be copied into the working phone as-is. + +## Install and undo the root gates (not executed) + +Only after the next-run gate above has passed, stage the check and ready pair +on the prepared development root. The neutral root policy from #562 and this +ready helper must be installed together. These commands enable the pair for +the next boot; they do not start hardware or prove a successful handover. +Announce any subsequent boot or screen interruption separately. + +From the repository root, as root on the prepared handset, choose a fresh +backup directory and record the previous enabled state. Stop if the directory +already exists, a copy fails, or the root/image/kernel checks disagree: + +```sh +( +set -eu +backup=/var/lib/omamobile/bluejay-root-gates-before-test +[ ! -e "$backup" ] +mkdir -p /var/lib/omamobile +mkdir -m 700 "$backup" +systemctl is-enabled omamobile-bluejay-check.service > "$backup/check.enabled" 2>&1 || true +systemctl is-enabled omamobile-bluejay-boot-ready.service > "$backup/ready.enabled" 2>&1 || true +for path in /usr/bin/omamobile-bluejay-check /usr/bin/omamobile-bluejay-boot-ready \ + /usr/lib/systemd/system/omamobile-bluejay-check.service \ + /usr/lib/systemd/system/omamobile-bluejay-boot-ready.service \ + /usr/lib/systemd/system/sddm.service.d/bluejay-check.conf; do + if [ -e "$path" ] || [ -L "$path" ]; then cp -a --parents "$path" "$backup/"; fi +done +touch "$backup/snapshot-complete" +install -Dm755 device/bluejay/bringup/bin/omamobile-bluejay-check /usr/bin/omamobile-bluejay-check +install -Dm755 device/bluejay/bringup/bin/omamobile-bluejay-boot-ready /usr/bin/omamobile-bluejay-boot-ready +install -Dm644 device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-check.service /usr/lib/systemd/system/omamobile-bluejay-check.service +install -Dm644 device/bluejay/bringup/vendor/systemd/system/omamobile-bluejay-boot-ready.service /usr/lib/systemd/system/omamobile-bluejay-boot-ready.service +install -Dm644 device/bluejay/bringup/vendor/systemd/system/sddm.service.d/bluejay-check.conf /usr/lib/systemd/system/sddm.service.d/bluejay-check.conf +systemctl daemon-reload +systemctl enable omamobile-bluejay-check.service omamobile-bluejay-boot-ready.service +) +``` + +Expect both units enabled and their installed `ExecStart` paths present. A real +boot must show the check passing, SSH available, the pending marker cleared +and the desktop ready. Stop on any failed prerequisite; do not clear the +marker merely to make a failing boot repeat. + +To undo on the installed development root before another boot, restore the +saved files below. If only RAM rescue is available, first recover access to +the installed root using PERSISTENCE-PLAN; these absolute paths must not be +run against the RAM filesystem. A missing or incomplete backup stops before +any unit is disabled or any file removed: + +```sh +( +set -eu +backup=/var/lib/omamobile/bluejay-root-gates-before-test +[ -d "$backup" ] +[ -f "$backup/check.enabled" ] +[ -f "$backup/ready.enabled" ] +[ -f "$backup/snapshot-complete" ] +systemctl disable omamobile-bluejay-check.service omamobile-bluejay-boot-ready.service +for path in /usr/bin/omamobile-bluejay-check /usr/bin/omamobile-bluejay-boot-ready \ + /usr/lib/systemd/system/omamobile-bluejay-check.service \ + /usr/lib/systemd/system/omamobile-bluejay-boot-ready.service \ + /usr/lib/systemd/system/sddm.service.d/bluejay-check.conf; do + rm -f "$path" + if [ -e "$backup$path" ] || [ -L "$backup$path" ]; then cp -a "$backup$path" "$path"; fi +done +systemctl daemon-reload +) +``` + +Restore each unit's recorded enabled/masked state from `check.enabled` and +`ready.enabled` (enable only a unit recorded as enabled; restore any prior +mask). Keep the backup. These root-gate commands do not stage the rest of the +historical hardware stack and do not qualify a revised kernel. diff --git a/device/bluejay/kernel.config b/device/bluejay/bringup/kernel.config similarity index 100% rename from device/bluejay/kernel.config rename to device/bluejay/bringup/kernel.config