Skip to content

Builds and packages the ptpd2 server into an ACAP for smooth deployment on an Axis device.

License

Notifications You must be signed in to change notification settings

AxisCommunications/ptpd2-acap

Copyright (C) 2022, Axis Communications AB, Lund, Sweden. All Rights Reserved.

Precision Time Protocol daemon ACAP

Build ACAP packages GitHub Super-Linter

Precision Time Protocol (PTP) comes in handy in use cases where time synchronization with high precision is needed. As of AXIS OS 12.7, PTP is a standard feature in AXIS OS, but for devices running AXIS OS LTS 2024 11.11 or older this repository enables PTP functionality using ACAP to cross-compile and package the open source PTP implementation ptpd2.

Note

The ptpd2 implementation does a startup check to explicitly make sure it is run as the root user (startup.c#L748-L753), which is not supported in AXIS OS 12 and later after the root removal.
Since these newer versions already have PTP, you wouldn't need to install the ptpd2 ACAP package anyway. However, this repo is still a valid example of how to cross-compile and package other programs with ACAP, as long as they do not need to be run as root.

Prerequisites

The build procedure assumes the existence of Docker or Podman (and Internet connectivity) on the build machine.

Build

On host with ACAP SDK installed

# With the environment initialized, use:
acap-build -a ptpd2 -a ptpd2.conf .

Using ACAP SDK build container and Docker (or Podman)

This repository has a Makefile that wraps cross-compiling the ptpd2 binary for the target architectures and to build for all targets, simply type

make

or perhaps

make -j

(to build in parallel). Then you will find the built ACAP packages in the ./eap directory upon successful build.

If you would like to build for, say, armv7hf only, please use

make armv7hf.eap

The Makefile has Docker as the default container runtime. If you would like to use Podman instead, use the environment variable CONTAINER_RUNTIME=podman:

CONTAINER_RUNTIME=podman make

or

CONTAINER_RUNTIME=podman make -j

If you do have Docker but no make on your system:

# 32-bit ARM, e.g. ARTPEC-6- and ARTPEC-7-based devices
DOCKER_BUILDKIT=1 docker build --build-arg ARCH=armv7hf -o type=local,dest=eap .
# 64-bit ARM, e.g. ARTPEC-8- and ARTPEC-9-based devices
DOCKER_BUILDKIT=1 docker build --build-arg ARCH=aarch64 -o type=local,dest=eap .

If you do have Podman but no make on your system:

# 32-bit ARM, e.g. ARTPEC-6- and ARTPEC-7-based devices
podman build --build-arg ARCH=armv7hf -o type=local,dest=eap .
# 64-bit ARM, e.g. ARTPEC-8- and ARTPEC-9-based devices
podman build --build-arg ARCH=aarch64 -o type=local,dest=eap .

Running

Install the application like you normally do (e.g. in the target device's web UI). It will automatically start running with the default options set in ptpd2.conf. (More info about the configuration options can be found in ptpd2.conf (5).)

If you would like to alter the configuration, you will find it in the directory /usr/local/packages/ptpd2/ on the target device. Please edit it and then restart the ACAP for the new changes to be used.

License

Apache 2.0

About

Builds and packages the ptpd2 server into an ACAP for smooth deployment on an Axis device.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors 2

  •  
  •