Part of the Librescoot open-source platform.
The Version Service is a one-shot Go program that publishes the local operating-system release metadata to a Redis or Valkey hash. Platform images install a board-specific systemd unit that writes either version:mdb or version:dbc.
- Reads key/value fields from
/etc/os-release, lowercases their keys, and writes them to a configured hash. - Derives
serial_numberandserial_number_realwhen the required i.MX OTP values can be read. - Reads OTP values first from
/sys/bus/nvmem/devices/imx-ocotp0/nvmem, then falls back to/sys/fsl_otp/HW_OCOTP_CFG0and/sys/fsl_otp/HW_OCOTP_CFG1. - Fails when
/etc/os-releaseor the Redis/Valkey endpoint cannot be read; an unavailable OTP value is logged as a warning and does not prevent release metadata from being published.
The program runs once: it parses /etc/os-release, connects to Redis/Valkey, writes all fields with HSET, and exits. It does not subscribe to commands or remain resident.
The packaged MDB unit runs:
/usr/bin/version-service -hash="version:mdb"It requires and starts after valkey.service. The DBC unit writes version:dbc, starts after the network target, and retries on failure. In both cases the recipe installs the selected unit as librescoot-version.service.
Consumers can read the published values directly, for example:
redis-cli HGET version:mdb version_id
redis-cli HGET version:dbc variant_idversion_id and variant_id are values supplied by the local /etc/os-release; the service does not define or transform their values.
| Flag | Default | Purpose |
|---|---|---|
-redis |
192.168.7.1:6379 |
Redis/Valkey server address |
-hash |
os-release |
Destination hash |
-version |
— | Print the build version and exit |
No configuration file or environment-variable interface is implemented.
A Go toolchain is required. The default target produces a Linux ARMv7 binary.
make build # bin/version-service for ARMv7
make build-host # bin/version-service for the current host
make testmake lint, make fmt, make deps, and make clean are also available.
The image recipe installs /usr/bin/version-service and one board-specific unit at /usr/lib/systemd/system/librescoot-version.service. The service needs readable OS-release data and network access to the configured Redis/Valkey endpoint. OTP-derived serial fields additionally require one of the supported NVMEM or OTP interfaces; their absence only omits those derived fields.
Use the packaged unit on a target:
systemctl status librescoot-version.service
journalctl -u librescoot-version.service- The destination hash is configurable. Use a dedicated, trusted Redis/Valkey endpoint and avoid pointing it at a shared untrusted instance.
- The service publishes operating-system metadata and, when available, device serial identifiers. Apply the same Redis/Valkey access controls used for other vehicle metadata.
- Because it is one-shot, rerun or restart
librescoot-version.serviceafter replacing/etc/os-releaseif consumers need the new values before the next boot.
This project is licensed under the GNU Affero General Public License v3.0.
Made with ❤️ by the Librescoot community