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
20 changes: 16 additions & 4 deletions .claude/skills/build-open-navicore/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,22 @@ workspace that holds this repository, so set them from a linked worktree):
| `OSMAND_QNX_ROOT` | the OsmAnd QNX build tree (`osmand-qnx-build`): compiler, core, Qt |
| `IFSBUILD_DIR` | ifs-build checkout (`ifs-build`), for `make ifs` |

`navigation.ifs` is the whole navigation for the radio (about 100 MiB): the
provider and its config, the backend, OsmAnd core and its resource bundle
(`OSMAND_RESOURCES_BUNDLE`, default next to the core in the OsmAnd build),
all under `/open-navicore`. Maps and other data are not in it.
`make ifs` writes two things (2026-10-28):

- `build/qnx/ifs/navigation.ifs` (~0.8 MB): the provider, its config, `boot.sh`
and `50-navicore.pre`; the slot's `50-navicore.ifs` on the radio.
- `build/qnx/navicore-data/navicore/`: the backend `libOpenNaviBackendOsmAnd.so`,
OsmAnd core and its resource bundle (`OSMAND_RESOURCES_BUNDLE`, default next to
the core in the OsmAnd build) as plain files for the slot's data dir; the image
links them into `/open-navicore` at boot. They left the image on 2026-10-24
(boot time). Maps and other data are in neither.

Install: skill `deploy-open-navicore` (a backend change is the backend file only).

Build trees on the D: drive fail at configure (`configure_file ... Operation not
permitted`): build into a Linux path with `BUILD=<dir>` or from a clone there. A
linked worktree has no `third_party/lvgl` checkout; copy the main checkout's
(same commit) into the clone.

`make ifs` also needs `STOCK_NV_NAVIGATION_CFG=<factory nv_navigation.cfg>`
once (QR39.5, SHA-256 `c889c2b4…d680e`, not committed; take it read-only
Expand Down
109 changes: 62 additions & 47 deletions .claude/skills/deploy-open-navicore/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,103 @@
---
name: deploy-open-navicore
description: Install Open NaviCore on the VP4R bench radio - one image, navigation.ifs (provider, OsmAnd backend, OsmAnd core and resources), staged upload, rename swap, one reboot; verification and rollback. Use when deploying a new build, checking what is installed, or rolling back to the native navigation.
description: Install Open NaviCore on the VP4R bench radio (vp4r layer, A/B slots) - the OsmAnd backend as a plain file in the slot's data dir (deploy_backend.sh), the small provider image 50-navicore.ifs in the slot's ifs dir; staged upload, rename swap, one reboot; verification and rollback. Use when deploying a new build, checking what is installed, or rolling back.
---

# Deploy Open NaviCore to the radio

A new version of the navigation is one file, `navigation.ifs`, and one
reboot:
Checked on the bench unit 2026-10-28. The unit boots through the vp4r layer
(`/datastore/vp4r`, `vp4r-loader`): it picks the A/B slot in
`/datastore/vp4r/slot` (`a` or `b`) and mounts `slots/<slot>/ifs/NN-*.ifs` at `/`.
The navigation is two kinds of file per slot:

| On the unit | What | Installed by |
|---|---|---|
| `/datastore/navicore/navigation.ifs`, mounted at `/` at boot by the boot overlay | all code under `/open-navicore/`: provider `libNaviCore.so`, its `nv_navigation.cfg` and `boot.sh`, the backend `libOpenNaviBackendOsmAnd.so`, OsmAnd core and resource bundle | `deploy/navigation-ifs/deploy_navigation_ifs.sh` |
| `/datastore/navicore-backend/` | data only: `maps/*.obf`, `recents.tsv`, `vectorcache/`, the bench marker files | by hand (maps), or written by the backend |
| `/datastore/vp4r/slots/<slot>/data/navicore/` | plain files: the backend `libOpenNaviBackendOsmAnd.so`, `libOsmAndCore_shared.so`, `libOsmAndCore_ResourcesBundle_shared.so`; the image's `50-navicore.pre` links them into `/open-navicore` at every boot (log `/datastore/vp4r/log/navicore.log`: `link <file> rc=0`) | backend: `deploy/navigation-ifs/deploy_backend.sh`; core and bundle by hand (they rarely change) |
| `/datastore/vp4r/slots/<slot>/ifs/50-navicore.ifs` (~0.8 MB) | `make ifs`'s `navigation.ifs`: provider `libNaviCore.so`, its `nv_navigation.cfg` (also at `/pas/scfg`), `boot.sh`, `/etc/vp4r/init.d/50-navicore.pre`; mounted at `/` | not scripted yet, see 1b |
| `/datastore/navicore-backend/` | data only: `maps/*.obf`, `recents.tsv`, `vectorcache/`, the bench marker files (`osmand-turns`, `disable-ch`, ...) | by hand (maps), or written by the backend |

Every change (UI, map, routing, provider) is a new image. There is no
backend-only install; the code is read-only in the mounted image.
The OsmAnd libraries are out of the image since 2026-10-24: images are mounted
inside the boot barrier and a 100 MB image made boots fail the RH850's J6 startup
window (`50-navicore.pre` header). **Stale:** `/datastore/navicore/navigation.ifs`
(a 110 MB full image of 2026-10-21) is no longer booted, and
`deploy_navigation_ifs.sh` still installs to that path; do not use it for the slot.

Most changes (UI, map, routing, turn instructions: everything in
`backends/osmand`) are the backend only. The image changes only with the provider
(`src/`), its config, `boot.sh` or `50-navicore.pre`.

## 0. Before touching the unit

- Build first (skill `build-open-navicore`): `make test`, `make` and
`make ifs` pass.
- Build first (skill `build-open-navicore`): `make test`, `make` (and `make ifs`
for an image). `make ifs` also writes `build/qnx/navicore-data/navicore/` (the
three libraries).
- Follow the workspace skill `record-unit-modification`: confirm the unit's
identity, write the ledger entry first (`pending restart`), update it
after the check.
- Bench deploy and the one documented reboot are covered by the standing
authorization in the workspace `AGENTS.md`. A second reboot is not: ask.
Never loop a reboot.
Never loop a reboot. Other sessions may be using the unit: ask before rebooting.
- The unit needs dev-tools mounted (`/usr/bin/bench_rename`,
`/usr/bin/vp4r-sync`, `/usr/bin/vp4r-reboot`); the script checks.
- Space: the image is about 100 MiB and the swap keeps one previous image,
so `/datastore` needs one image of free space (it had 128 MiB on
2026-10-15, before the old per-file backend copies were removed).
`/usr/bin/vp4r-sync`, `/usr/bin/vp4r-reboot`, `/usr/bin/sha256sum`).
- Space: a backend is ~31 MB and each install keeps the previous one as
`libOpenNaviBackendOsmAnd.before-<stamp>.so`; delete old ones when space runs low.

## 1. Install
## 1a. Install the backend (the usual case)

```sh
deploy/navigation-ifs/deploy_navigation_ifs.sh build/qnx/ifs/navigation.ifs \
<ifs-build>/bin/ifs-deploy --dry-run # plan only
deploy/navigation-ifs/deploy_navigation_ifs.sh build/qnx/ifs/navigation.ifs \
<ifs-build>/bin/ifs-deploy
deploy/navigation-ifs/deploy_backend.sh build/qnx/navicore-data/navicore/libOpenNaviBackendOsmAnd.so --dry-run
deploy/navigation-ifs/deploy_backend.sh build/qnx/navicore-data/navicore/libOpenNaviBackendOsmAnd.so
```

It uploads with ifs-build's `ifs-deploy` as `navigation.ifs.new` (read-back
verified by scp), pulls the current image to local `ifs-deploy-backups/`,
then on the unit renames `navigation.ifs` to `navigation.previous.ifs` and
`navigation.ifs.new` to `navigation.ifs` (no copies), flushes and checks the
installed file with the unit's `/usr/bin/sha256sum` (dev-tools) against the
host hash, renaming the previous image back on a mismatch. Never copy over a
mounted IFS in place (a truncated in-place copy once made `mountifs` crash
at boot); renaming is safe. Do **not** use ifs-build's generic `deploy-ifs`
target: it uploads to `/datastore/ifs-overrides`, which the navigation hook
does not read.
It reads the booted slot, uploads (`scp -O`) as `libOpenNaviBackendOsmAnd.so.new`,
checks its sha256 on the unit, renames the active file to
`libOpenNaviBackendOsmAnd.before-<stamp>.so` and the new one into place (no copies),
flushes and reads back the hash. Then one reboot: `/usr/bin/vp4r-sync`, then
`/usr/bin/vp4r-reboot` (workspace skill `dev-tools-on-radio`). ssh returns in
about a minute. It installs into the booted slot only; the other slot keeps its
own files.

Settings: `RADIO_HOST` (default the bench unit), `RADIO_SSH_KEY` (default
`$HOME/priv_openssh`), `NAVIGATION_IFS_DIR`, `BACKUP_DIR`, `RADIO_SYNC`,
`RADIO_RENAME` (script header).
## 1b. Install the provider image

Then one reboot: `/usr/bin/vp4r-sync`, then `/usr/bin/vp4r-reboot`
(workspace skill `dev-tools-on-radio`). ssh returns in about a minute.
Not scripted for the slot layout yet. By hand, the same pattern: upload
`build/qnx/ifs/navigation.ifs` as `slots/<slot>/ifs/50-navicore.ifs.new`, check its
sha256 on the unit, `bench_rename` the active `50-navicore.ifs` away (keep it),
`bench_rename` the new one into place, `vp4r-sync`, one reboot. Never copy over a
mounted IFS in place (a truncated in-place copy once made `mountifs` crash at
boot); renaming is safe. Do **not** use ifs-build's generic `deploy-ifs` target.

## 2. Verify

- `/bin/cat /datastore/boot_overlay.log`: the last block has
`open_navicore_mount_rc=0` and `open_navicore_config_link_rc=0`.
- `for f in /open-navicore/*; do echo $f; done` lists the provider, backend,
core and bundle; `nv_navigation` maps them:
- `/bin/cat /datastore/vp4r/log/navicore.log`: the last three lines are
`link <library> rc=0`; `/bin/cat /datastore/vp4r/log/boot.log` for the mounts.
- `ls -l /open-navicore/` (dev-tools `ls`): the three libraries are links into
`slots/<slot>/data/navicore/`; `nv_navigation` maps them:
`/proc/boot/pidin -p <pid> mem` (pid from `/proc/boot/pidin -f an`).
- Provider trace `/bin/cat /tmp/open-navi.log`; backend trace
`/bin/cat /tmp/open-navicore-osmand.log` (start, attach,
`init=resources`, `surface_created=...`, `cluster=publish_status`).
`init=resources`, `surface_created=...`, `cluster=publish_status`; per route
`worker=turns source=organic_maps`, `worker=omaps turns=N ms=M`, or
`worker=omaps_error why=...`).
- On screen: hold the day/night button 1.5 s in free drive for the
developer menu (build commit, frame rate, raw car inputs, cluster).
- Hash on the unit: `/usr/bin/sha256sum /datastore/navicore/navigation.ifs`
equals the host's `sha256sum build/qnx/ifs/navigation.ifs`.
- Hash on the unit: `/usr/bin/sha256sum
/datastore/vp4r/slots/<slot>/data/navicore/libOpenNaviBackendOsmAnd.so` equals
the host's.
- Update the ledger entry to `active`, or record what failed.

## 3. Rollback

- Previous version: on the unit `/bin/rm navigation.ifs;
/usr/bin/bench_rename navigation.previous.ifs navigation.ifs`, flush,
reboot (or install a local backup from `ifs-deploy-backups/` with the
script).
- Back to the native navigation: `touch /datastore/navicore/disabled` and
reboot (the boot hook leaves the factory config in place).
- Previous backend: on the unit, in `slots/<slot>/data/navicore/`,
`/usr/bin/bench_rename libOpenNaviBackendOsmAnd.so libOpenNaviBackendOsmAnd.bad.so`
and the wanted `libOpenNaviBackendOsmAnd.before-<stamp>.so` back to
`libOpenNaviBackendOsmAnd.so`, flush, reboot.
- Turn instructions from OsmAnd instead of Organic Maps, no reinstall:
`touch /datastore/navicore-backend/osmand-turns`, restart the navigation.
- Without the three library files the provider keeps its built-in backend
(`50-navicore.pre`).
- Back to the native navigation: the old marker `touch
/datastore/navicore/disabled` was read by the pre-vp4r boot hook; not
checked with the vp4r layer (2026-10-28).
- A provider that crashes at every start makes System Manager reset the unit
after three relaunches; ssh comes up first, so the marker can be created
between resets.
Expand Down
10 changes: 10 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Agent notes for open_navicore

## Failures: obvious, not silent

- An obvious failure is better than a silent fallback (owner preference, 2026-10-28).
When a component fails, make it visible (the feature visibly missing, an error
trace line), do not quietly substitute an older or weaker path that hides it.
- A fallback is only for an explicit switch: e.g. OsmAnd's own manoeuvres run only
when Organic Maps' turns are switched off (marker `osmand-turns`), never because
Organic Maps' code failed on a route (that route gets no turns and
`worker=omaps_error`).

## Merging pull requests

- Merge with **rebase**, not squash (owner preference, 2026-10-20):
Expand Down
14 changes: 13 additions & 1 deletion backends/osmand/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,20 @@ add_custom_target(build_info_git
-P ${ONC_ROOT}/cmake/build_info.cmake
BYPRODUCTS ${_build_info} VERBATIM)

# Turn instructions: Organic Maps' car turn generator on OsmAnd's routes
# (omaps_turns.cpp; the vendored OM code in third_party/organicmaps-routing). A
# static library so that OM's shim headers stay out of the backend's include path.
include(${ONC_ROOT}/third_party/organicmaps-routing/sources.cmake)
add_library(organicmaps_turns STATIC omaps_turns.cpp ${ONC_ORGANICMAPS_SOURCES})
target_include_directories(organicmaps_turns PRIVATE ${ONC_ORGANICMAPS_INCLUDES}
${ONC_OSMAND_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(organicmaps_turns PRIVATE ${ONC_OSMAND_DEFINES})
# Vendored code: its warnings are upstream's.
target_compile_options(organicmaps_turns PRIVATE ${ONC_OSMAND_FLAGS} -w)

add_library(osmand_backend SHARED
osmand_backend.cpp config.cpp session.cpp osmand_engine.cpp navigation_worker.cpp ch_planner.cpp
route_maneuvers.cpp
thread_priority.cpp crash_reporter.cpp frame_metrics.cpp build_info.cpp
gpu_upload_context.cpp
ui/gl_overlay_compositor.cpp
Expand All @@ -111,7 +123,7 @@ target_include_directories(osmand_backend PRIVATE ${ONC_OSMAND_INCLUDES}
${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions(osmand_backend PRIVATE ${ONC_OSMAND_DEFINES})
target_compile_options(osmand_backend PRIVATE ${ONC_WARNINGS} ${ONC_OSMAND_FLAGS})
target_link_libraries(osmand_backend PRIVATE navigation_ui osmand_core EGL GLESv2 z c)
target_link_libraries(osmand_backend PRIVATE navigation_ui organicmaps_turns osmand_core EGL GLESv2 z c)
set_target_properties(osmand_backend PROPERTIES OUTPUT_NAME OpenNaviBackendOsmAnd
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} SKIP_BUILD_RPATH ON)
target_link_options(osmand_backend PRIVATE -Wl,--as-needed -static-libstdc++ -static-libgcc
Expand Down
2 changes: 2 additions & 0 deletions backends/osmand/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ Config Config::from_environment()
map_is_directory ? config.map + "/car.chr" : config.map + ".chr");
if (marker_or_environment("OPEN_NAVICORE_OSMAND_CH_DISABLE", "/datastore/navicore-backend/disable-ch"))
config.ch_sidecar.clear();
config.osmand_turns = marker_or_environment("OPEN_NAVICORE_OSMAND_TURNS",
"/datastore/navicore-backend/osmand-turns");
config.fonts = path("OPEN_NAVICORE_OSMAND_FONTS", config.fonts);
config.search_index = path("OPEN_NAVICORE_OSMAND_SEARCH_INDEX", config.search_index);
config.recents = path("OPEN_NAVICORE_OSMAND_RECENTS", config.recents);
Expand Down
4 changes: 4 additions & 0 deletions backends/osmand/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ struct Config {
// cannot serve a route. Empty when disabled (marker
// /datastore/navicore-backend/disable-ch, or OPEN_NAVICORE_OSMAND_CH_DISABLE=1).
std::string ch_sidecar = "";
// Turn instructions come from Organic Maps' turn generator (omaps_turns.h).
// OsmAnd's own only with the marker /datastore/navicore-backend/osmand-turns
// (or OPEN_NAVICORE_OSMAND_TURNS=1); never as a fallback when OM fails.
bool osmand_turns = false;

// Bench tools (markers in /datastore/navicore-backend, see README).
bool simulate_route = false; // enable-route-simulation
Expand Down
Loading