Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions device/bluejay/bringup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<!-- SPDX-License-Identifier: MIT -->
# 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 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.

`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
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.

## 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.
9 changes: 9 additions & 0 deletions device/bluejay/bringup/bin/omamobile-bluejay-boot-ready
Original file line number Diff line number Diff line change
@@ -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'
24 changes: 24 additions & 0 deletions device/bluejay/bringup/bin/omamobile-bluejay-check
Original file line number Diff line number Diff line change
@@ -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'
40 changes: 40 additions & 0 deletions device/bluejay/bringup/bin/omamobile-bluejay-gpu-start
Original file line number Diff line number Diff line change
@@ -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'
40 changes: 40 additions & 0 deletions device/bluejay/bringup/bin/omamobile-bluejay-hardware-start
Original file line number Diff line number Diff line change
@@ -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'
50 changes: 50 additions & 0 deletions device/bluejay/bringup/bin/omamobile-bluejay-wifi-start
Original file line number Diff line number Diff line change
@@ -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"
Loading