From 681fa4ff6ebd6f97d916763b63a1dceb62528c85 Mon Sep 17 00:00:00 2001 From: den-kloot <1522975+den-kloot@users.noreply.github.com> Date: Tue, 17 Nov 2026 12:12:08 +0100 Subject: [PATCH] omamobile-modem 0.1.27: give gnssd the SIT RIL GPS stub on the Pixel 9a gnssd's libcustomgnss (gps.cfg GlueLayer_IsUseCustomGnssLib=1) dlopen()s /vendor/lib64/libsitril-gps.so and takes GpsOpen, GpsClose, RegisterCallback and RequestAGPS from it. The real library reaches the RIL's GPS channel through libsitril-client over binder, and the modem profile has no binder. With a modem chroot extracted from CP3A.261005.005, libbinder ends gnssd at its first call, 20 s after ONLINE: F libbinder.ProcessState: Binder driver '/dev/binder' could not be opened. Error: 2 (No such file or directory) ... Terminating. libc: Fatal signal 6 (SIGABRT) ... (gnssd) so @GNSSND never appears and Location has no receiver. The profile now bind-mounts omamobile-gnss's stub (libomamobile-sitril-gps.so, the same four calls succeeding as no-ops, which the 7 Pro's gpsd already preloads) read-only over that file, inside the profile's namespace only: the image stays as extracted. Without the image's library or without the stub it does nothing (with a note for the missing stub). bind() is not used for it, because it truncates a file target before mounting. On the Pixel 9a (7.3.0-rc6-omamobile-push1-gbd32edee1132, modem up with --gnss, no SIM needed): with the stub in place gnssd goes CODELOAD -> OPERATIONAL, listens on @GNSSND, and a Location session gave its first fix after about 55 s (cold, indoors), 18 satellites seen, up to 5 used, no Kepler fault. Co-Authored-By: Claude Opus 5.5 --- packages/omamobile-modem/profiles/modem.conf | 25 +++++++++++++++++ packages/omamobile-modem/test/all | 28 ++++++++++++++++++++ packages/omamobile-modem/version | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/packages/omamobile-modem/profiles/modem.conf b/packages/omamobile-modem/profiles/modem.conf index 8efcb772b..052c66633 100644 --- a/packages/omamobile-modem/profiles/modem.conf +++ b/packages/omamobile-modem/profiles/modem.conf @@ -159,6 +159,30 @@ modem_gnss_nodes() { } modem_gnss() { [[ $MODEM_GNSS == 1 ]] && modem_gnss_nodes; } +# gnssd's libcustomgnss (gps.cfg GlueLayer_IsUseCustomGnssLib=1) dlopen()s +# /vendor/lib64/libsitril-gps.so and takes GpsOpen, GpsClose, +# RegisterCallback and RequestAGPS from it. The real library reaches the +# RIL's GPS channel through libsitril-client over binder, and this profile +# has no binder: with a chroot from CP3A.261005.005, libbinder ends gnssd at +# its first call ("Binder driver '/dev/binder' could not be opened. +# Terminating.", SIGABRT), so the 9a has no GNSS. omamobile-gnss's stub +# (the same four calls, succeeding as no-ops, as for the 7 Pro's gpsd) goes +# over it, read-only, inside this namespace only; the image is unchanged. +SITRIL_GPS=/vendor/lib64/libsitril-gps.so +SITRIL_GPS_STUB=libomamobile-sitril-gps.so +modem_gnss_sitril() { + local dst=$ROOT$SITRIL_GPS + [[ -f $dst ]] || return 0 + if [[ ! -f $STUBS/$SITRIL_GPS_STUB ]]; then + say "no $STUBS/$SITRIL_GPS_STUB (omamobile-gnss): gnssd keeps the RIL's library, which needs binder" + return 0 + fi + # not bind(): it truncates a file target first, and this one is the + # image's own file (read-only here, but never the place to write) + mount --bind "$STUBS/$SITRIL_GPS_STUB" "$dst" + mount -o remount,bind,ro "$dst" +} + profile_setup() { local p l mnt=$ROOT/mnt/vendor mkdir -p "$NV" @@ -209,6 +233,7 @@ profile_setup() { for p in "${MODEM_NODES[@]}"; do bind "/dev/$p" "$ROOT/dev/$p"; done if modem_gnss_nodes; then for p in "${GNSS_NODES[@]}"; do bind "/dev/$p" "$ROOT/dev/$p"; done + modem_gnss_sitril mkdir -p "$STATE/data/vendor/gps/logs" "$STATE/data/vendor/gps/overlay" fi # cbd logs to the kernel log, next to CPIF's lines diff --git a/packages/omamobile-modem/test/all b/packages/omamobile-modem/test/all index c7376e744..7d5caa7ae 100755 --- a/packages/omamobile-modem/test/all +++ b/packages/omamobile-modem/test/all @@ -36,6 +36,34 @@ out=$(bash -c ' [[ $out == alive ]] || fail "a daemon exiting 3 leaves spawn_optional's job alive (got: $out)" pass "spawn_optional survives a failing daemon" +# gnssd's RIL library: the stub goes over it read-only when both exist, and +# nothing is mounted (or written) otherwise. +sitril=$(sed -n '/^SITRIL_GPS=/p; /^SITRIL_GPS_STUB=/p; /^modem_gnss_sitril() {$/,/^}$/p' profiles/modem.conf) +[[ $sitril == *modem_gnss_sitril* ]] || fail "modem_gnss_sitril found in modem.conf" +st=$(mktemp -d) +mkdir -p "$st/root/vendor/lib64" "$st/stubs" +run_sitril() { + bash -c ' + set -euo pipefail + ROOT=$1/root STUBS=$1/stubs + say() { echo "say: $*"; } + mount() { echo "mount $*"; } + '"$sitril"' + modem_gnss_sitril + ' _ "$st" +} +[[ -z $(run_sitril) ]] || fail "no libsitril-gps.so in the image: nothing mounted" +echo real > "$st/root/vendor/lib64/libsitril-gps.so" +[[ $(run_sitril) == "say: no "*"(omamobile-gnss)"* ]] || fail "no stub: a note and no mount" +echo stub > "$st/stubs/libomamobile-sitril-gps.so" +out=$(run_sitril) +[[ $out == "mount --bind $st/stubs/libomamobile-sitril-gps.so $st/root/vendor/lib64/libsitril-gps.so"$'\n'"mount -o remount,bind,ro $st/root/vendor/lib64/libsitril-gps.so" ]] || + fail "the stub is bound read-only over libsitril-gps.so (got: $out)" +[[ $(cat "$st/root/vendor/lib64/libsitril-gps.so") == real ]] || fail "the image's library is left as it was" +rm -rf "$st" +grep -q '^ modem_gnss_sitril$' profiles/modem.conf || fail "profile_setup binds the stub with the GNSS devices" +pass "gnssd gets the SIT RIL GPS stub instead of the binder library" + # rfsd's job: an exit is a crash (the supervisor stops the profile) unless # this invocation's stop intent is in place; then it stays open for systemd. python3 test/rfsd-lifecycle.py || fail "rfsd's job through an orderly stop" diff --git a/packages/omamobile-modem/version b/packages/omamobile-modem/version index 7db267292..a2e1aa9d9 100644 --- a/packages/omamobile-modem/version +++ b/packages/omamobile-modem/version @@ -1 +1 @@ -0.1.26 +0.1.27