Skip to content

omamobile-modem 0.1.8, extract-vendor-chroot: gnssd's custom GNSS library and the CP state it waits for - #141

Merged
derekross merged 2 commits into
derekross:mainfrom
W4HO-ham:modem-tegu-gnss-libs
Oct 29, 2026
Merged

derekross merged 2 commits into
derekross:mainfrom
W4HO-ham:modem-tegu-gnss-libs

Conversation

@W4HO-ham

Copy link
Copy Markdown
Contributor

Two gaps in the 9a's modem chroot that I found tonight with an strace of gnssd. They don't cure the GPS fault yet, but stock has both.

  • Three missing libraries. gps.cfg sets GlueLayer_IsUseCustomGnssLib=1, and gnssd dlopen()s /vendor/lib64/libcustomgnss.so (ENOENT in the trace). That library waits for the CP to be ONLINE, then dlopen()s libsitril-gps.so, which uses libsitril-client.so (RIL's GPS channel, over binder to the radioExternal HAL). Stock's vendor image has all three. The extractor never copied them because nothing links them. They're now VENDOR_LIBS in the tegu modem profile, so they come with their closure.
  • The CP state path. libcustomgnss reads /sys/bus/platform/devices/cpif/modem_state, but the chroot's /sys only binds /sys/devices/platform/cpif. So it logged an empty state ("Modem state online overtime") until it gave up. The profile now binds the same device at its bus path, read-only.

Tested on the palmtop (7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, on the charger, the libraries copied by hand from the BP3A vendor image). libcustomgnss now logs "Modem state ONLINE". GpsOpen() still fails, because there's no radioExternal HAL in the chroot (no binder). Kepler still faults at every engine start: 9 times in 4 minutes, the same KEP M7 HARDFAULT ... LR,PC 600B5B39 0000062C. Turning DVS/DFS off through gnssd's gps_overlay.conf didn't help either. The full write-up goes into MODEM-PLAN's G3 after #138, which edits the same section. I haven't re-run the extractor on a factory image with this change. packages/omamobile-modem/test/all and tools/pr-check pass.

…rary and the CP state it waits for

On the 9a gps.cfg sets GlueLayer_IsUseCustomGnssLib, and gnssd dlopen()s libcustomgnss.so, which waits for ONLINE at /sys/bus/platform/devices/cpif/modem_state and then opens RIL's GPS channel through libsitril-gps and libsitril-client. The extractor left all three out, since nothing links them, and the chroot's /sys had only the device path, not its bus link. Neither fixes Kepler's engine-start fault yet.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

A follow-up that changes how to read G3. With gnssd's debug log on, the 9a's Kepler tracks satellites (four SVs at C/N0 29-35 dB-Hz within about 10 s of the start). The "KEP M7 HARDFAULT" we've been chasing is gnssd's own soft watchdog: after "pos req timeout" and "sw version timeout" it resets Kepler and deliberately triggers a hard fault to get a RAM dump (BLC ID 6, "Try and trigger hard fault to see if CPU is locked up"). The watchdog fires because the CHPP link over the GNSS SPI loses packets. In the raw reads, many frames are shifted one bit late (34 21 where the preamble 68 43 belongs). I tried SPI modes 0/1/3, 32- and 64-byte reads, feedback delay 0 and 2, and 1 MHz, each on a fresh boot. Mode 1 makes receive clean but breaks transmit, and nothing fixes both. Stock drives this SPI with 32-bit words, swap-mode and DMA, where our port uses 8-bit PIO, so that's next. This PR's libraries and CP-state fix still stand; the details go in MODEM-PLAN.

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

More from tonight's GNSS SPI work (16 boots, all logged in MODEM-PLAN locally):

  • Mainline spi-s3c64xx cuts every PIO transfer of 64 bytes or more into 63-byte pieces. That's why 32-bit words time out (len-63). Stock never cuts, because it uses DMA. Cutting into 60-byte pieces ourselves, so every pause falls on a 32-bit boundary, didn't help, so the split isn't the cause.
  • Stock's pdma1 (PL330 at 0x10130000) works from Linux: a runtime test ran a DMA memcpy through it, and a DT node probes it at boot. But with dmas on the GNSS SPI (0x14/0x15, either order), RX DMA moves nothing. Some routing stock sets up is still missing.
  • SPI modes 1 and 3, feedback delay 0, 1 MHz and auto CS were tried too. None fixes receive without breaking transmit.

The palmtop is back on the as-ported setting.

@W4HO-ham

W4HO-ham commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

More GPS SPI results from tonight (all module-only tests, each on a fresh boot of the gn3 kernel):

  • The real SPI clock is 6.24 MHz, not the 3.125 MHz the DT asks for. clk-zumapro keeps USI3's mux read-only on the 399.36 MHz parent and the divider stops at /16, so the IP clock is 24.96 MHz whatever spi-s3c64xx requests. Last night's "1 MHz" run was 6.24 MHz too. Google's zuma CMU table gets 12 MHz from OSCCLK / 2.
  • In the as-ported setup the errors are single bytes: one byte of a frame comes in with its top bit taken from the previous byte's last bit, and the rest of the frame is right. That's the controller sampling a little before Kepler's data settles.
  • Running the clock the way stock does (OSCCLK / 2, about 3.07 MHz) breaks the link differently: Kepler's frames arrive shifted by 4 to 6 bits for whole stretches, across many separate reads, so its bit counter isn't reset by chip select. 32-bit words and chip-select toggles mid-frame do the same. So the clock alone isn't the fix, and I haven't sent the clk-zumapro change.

The palmtop is back on the as-ported modules. The details are in MODEM-PLAN.md on #138 (G3, fifth to twenty-fourth tries).

@derekross

Copy link
Copy Markdown
Owner

Thanks, this is a tidy fix, and the strace work behind it shows. Finding the dlopen()ed libraries and the bus-path read of modem_state is exactly what the chroot needed, and the follow-ups that pin the "hardfault" on gnssd's own watchdog and the CHPP losses on the SPI really change how we read G3.

I checked:

  • tools/pr-check and the package tests pass here too, and CI is green.
  • The NV side is untouched. The new bind is read-only, on the chroot's sysfs skeleton.
  • The modem profile has no binder and no umts_ipc* node, so libsitril-client has no way to send the CP anything.
  • The extractor change only applies with -d tegu, so cheetah and raven get the same trees as before.

One thing before I merge: please run the extractor once with this change (tools/extract-vendor-chroot -p modem -d tegu <factory zip>). You mentioned you copied the three libraries by hand. The extractor walks every VENDOR_LIBS entry's NEEDED list, and any library it can't find in vendor/lib64 or system/lib64 stops the whole -p modem -d tegu run with "unresolved libraries", not only the GNSS part. libsitril-client is a binder client, so it's the one I'd expect to pull in something we don't stage yet. Pasting the ==> lines, and the file paths that are new in the MANIFEST compared with your previous tree, is enough. Paths only, no checksums. If something doesn't resolve, a stub in STUB_LIBS (as for the tethering library) or a word on why it's safe to leave out would do.

Smaller things, none of them blocking:

  • Could you paste a tools/phone-smoke report from the build you tested, and fill in the PR template's phone section? It's what we ask of every change that runs on a phone.
  • Existing 9a chroots only get the libraries when the owner re-extracts. A line saying so in the G3 write-up would save someone a confused afternoon.
  • The second /sys bind is shared by every phone's modem profile. It's harmless on the 7 Pro and the 6 Pro (cbd never looks there), but please either say so in the commit body or bind it only when gnssd's nodes go in.

I'll merge this first, then #148 on top of it.

The extractor was run once more with this change on the owner's BP3A factory image: 195 files against the previous 188, nothing removed, every library resolved, nothing new to stub. The seven new paths are the three GNSS libraries and their closure (libbinder, libbinder_ndk, libapexsupport and the Samsung radioExternal NDK library). MODEM-PLAN's G3 section records that, and that an existing 9a chroot gets the libraries only when its owner re-extracts.

The second /sys bind is shared by every phone's modem profile. It is harmless on the 7 Pro and the 6 Pro: cbd never looks there.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Done. I ran the extractor with this change on my BP3A factory image (on maclab, where the image lives):

==> Unpacking tegu-bp3a.250905.014/image-tegu-bp3a.250905.014.zip from the factory zip
==> Unpacking vendor.img
==> Unpacking system.img
==> Vendor partition: google/tegu/tegu:16/BP3A.250905.014/13873947:user/release-keys
==> Reading the vendor partition
==> Reading the system partition
==> Reading com.android.runtime
==> 195 files, 24M, in out-modem/root
==> Source: google/tegu/tegu:16/BP3A.250905.014/13873947:user/release-keys

Everything resolves, nothing to stub beyond the tethering library. New paths against my previous tree (188 files, nothing removed):

  • system/lib64/libapexsupport.so
  • system/lib64/libbinder_ndk.so
  • vendor/lib64/libbinder.so
  • vendor/lib64/libcustomgnss.so
  • vendor/lib64/libsitril-client.so
  • vendor/lib64/libsitril-gps.so
  • vendor/lib64/vendor.samsung_slsi.telephony.hardware.radioExternal-V1-ndk.so

libsitril-client pulls libbinder and the radioExternal NDK library, as you expected, and both are in the image. They're only ever dlopen()ed, so with no binder in the chroot they sit there unused.

A G3 bullet in MODEM-PLAN records the re-extract note (an existing 9a chroot gets the libraries only when its owner re-extracts), and the commit body of c393e0e says the second /sys bind is harmless on the 7 Pro and the 6 Pro, since cbd never looks there. That is a second commit on the branch rather than an amend (I can't force-push from where I am today); the squash subject stays the first one's. pr-check and the package tests pass. #148 is still stacked on the old head; rebasing it at merge, as you offered, is easiest.

The smoke report below is from today's boot. The palmtop runs the branch's profile and lib/ files copied by hand over omamobile-modem 0.1.4 (the chroot tree is the one above), with the modem brought up and ONLINE this morning for the watcher count on #148.

phone-smoke: tegu

Kernel 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, tools at 34778a2, 2026-10-29T16:56Z.

Check Result Detail
boot (required) ok kernel 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, slot b, up 77s
storage guard (required) ok 62 partitions; only userdata and slot B's boot images writable
root (required) ok ext4 on userdata, 19G free
kernel health (required) ok no oops or BUG; 0 WARN, 306 error lines in dmesg
systemd units ok none failed
USB gadget (required) ok bound to 11210000.usb
display ok card1-DSI-1 connected, 1080x2424
GPU ok render node on panthor
session (required) ok Hyprland and the Omarchy shell running
lock ok PAM file present, the shell can lock (passwordPam true, locked false)
touch ok Synaptics TouchComm Touchscreen
buttons ok gpio-keys
Wi-Fi ok wlan0 on brcmfmac, link up
Bluetooth ok hci0, powered true
battery ok 90% Unknown, 32 °C
sound cards ok googleteguaocsn
sensors ok Accelerometer AmbientLight Proximity
cameras ok 3 listed by libcamera
thermal ok hottest zone 42 °C

Packages: hyprland 0.56.2-5.1, libcamera 0.7.2-4.22, mesa 1:26.2.4-1.4, omacam 0.3.3-1, omamobile-apps 0.2.0-1, omamobile-audio 0.4.1-1, omamobile-device-tegu 0.2.0-1, omamobile-fingerprint 0.1.8-1, omamobile-firstboot 0.1.0-1, omamobile-gnss 0.2.1-1, omamobile-keyring 20261013-1, omamobile-mirror 0.1.1-1, omamobile-modem 0.1.4-1, omamobile-omarchy 0.1.12-1, omamobile-owl-widgets 0.1.1-1, omamobile-sensors 0.2.1-1, omamobile-shell 0.2.36-1, omarchy 4.0.6-1

@derekross

Copy link
Copy Markdown
Owner

Thanks, that's everything I asked for. The extractor run is exactly what I wanted to see. All 195 files resolve, and the seven new paths are the three libraries plus the binder closure we expected (libbinder, libbinder_ndk, libapexsupport and the radioExternal NDK library). Nothing new needs a stub. The G3 note about re-extracting, the commit body on the shared /sys bind and the smoke report all answer the rest.

I re-checked on the new head:

  • tools/pr-check and the package tests pass.
  • CI is green.
  • The branch still merges cleanly onto today's main.
  • Both commit bodies read well together, so the squash can use them as they are.

One small thing for later, not for this PR. Once #153 merges, this G3 bullet (dated 10-28) will sit inside the "second try (10-27)" section, and #153 has its own "Missing libraries" bullet under the fifth to eighth tries. Folding the two into one place in a later docs commit would keep G3 easy to follow. I'm happy to do that myself if you'd rather not.

I'll merge this now, then rebase #148 onto it as offered.

@derekross
derekross merged commit d3b7c07 into derekross:main Oct 29, 2026
2 checks passed
derekross pushed a commit to W4HO-ham/omarchy-mobile that referenced this pull request Oct 29, 2026
device/tegu/MODEM-PLAN.md conflicted on the status line: this branch's
file already carries everything derekross#138 added. It is resolved to this
branch's file, plus the "gnssd's custom GNSS library (2026-10-28,
omamobile-modem 0.1.8)" bullet that derekross#141 added on main, which this branch
never had and a plain checkout of its file would have dropped.
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…rary and the CP state it waits for (derekross#141)

* omamobile-modem 0.1.8, extract-vendor-chroot: gnssd's custom GNSS library and the CP state it waits for

On the 9a gps.cfg sets GlueLayer_IsUseCustomGnssLib, and gnssd dlopen()s libcustomgnss.so, which waits for ONLINE at /sys/bus/platform/devices/cpif/modem_state and then opens RIL's GPS channel through libsitril-gps and libsitril-client. The extractor left all three out, since nothing links them, and the chroot's /sys had only the device path, not its bus link. Neither fixes Kepler's engine-start fault yet.

* omamobile-modem 0.1.8: the extractor re-run, and the shared /sys bind

The extractor was run once more with this change on the owner's BP3A factory image: 195 files against the previous 188, nothing removed, every library resolved, nothing new to stub. The seven new paths are the three GNSS libraries and their closure (libbinder, libbinder_ndk, libapexsupport and the Samsung radioExternal NDK library). MODEM-PLAN's G3 section records that, and that an existing 9a chroot gets the libraries only when its owner re-extracts.

The second /sys bind is shared by every phone's modem profile. It is harmless on the 7 Pro and the 6 Pro: cbd never looks there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants