diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index d555d99b9..58f327e0f 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -195,6 +195,9 @@ RUN pip3 wheel --wheel-dir=/wheels -r /requirements-wheels.txt && \ # Install HailoRT & Wheels RUN --mount=type=bind,source=docker/main/install_hailort.sh,target=/deps/install_hailort.sh \ /deps/install_hailort.sh +#Install Synaptics SL1680 runtime library and wheels +RUN --mount=type=bind,source=docker/main/install_synap1680.sh,target=/deps/install_synap1680.sh \ + /deps/install_synap1680.sh # Collect deps in a single layer FROM scratch AS deps-rootfs diff --git a/docker/main/install_synap1680.sh b/docker/main/install_synap1680.sh new file mode 100755 index 000000000..4a2ab79ca --- /dev/null +++ b/docker/main/install_synap1680.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -euxo pipefail + +if [[ "${TARGETARCH}" == "amd64" ]]; then + arch="x86_64" +elif [[ "${TARGETARCH}" == "arm64" ]]; then + arch="aarch64" +fi + +wget -qO- "https://github.com/GaryHuang-ASUS/frigate-synaptics-rt/releases/download/v1.5.0-1.0/synaptics-rt-1.0.tar" | tar -C / -xzf - +wget -P /wheels/ "https://github.com/synaptics-synap/synap-python/releases/download/v0.0.4-preview/synap_python-0.0.4-cp311-cp311-manylinux_2_35_aarch64.whl" + diff --git a/docker/synap1680/Dockerfile b/docker/synap1680/Dockerfile new file mode 100644 index 000000000..93440768b --- /dev/null +++ b/docker/synap1680/Dockerfile @@ -0,0 +1,15 @@ +# syntax=docker/dockerfile:1.4 + +# https://askubuntu.com/questions/972516/debian-frontend-environment-variable +ARG DEBIAN_FRONTEND=noninteractive + +FROM deps AS synap1680-deps +ARG TARGETARCH + +# Install dependencies +RUN --mount=type=bind,source=docker/synap1680/install_deps.sh,target=/deps/install_deps.sh \ + /deps/install_deps.sh + +WORKDIR /opt/frigate/ +COPY --from=rootfs / / +ADD https://raw.githubusercontent.com/synaptics-astra/synap-release/v1.5.0/models/dolphin/object_detection/coco/model/mobilenet224_full80/model.synap /model.synap diff --git a/docker/synap1680/Dockerfile.toolchain b/docker/synap1680/Dockerfile.toolchain new file mode 100644 index 000000000..18e74ad4d --- /dev/null +++ b/docker/synap1680/Dockerfile.toolchain @@ -0,0 +1,34 @@ +# syntax=docker/dockerfile:1.4 + +ARG DEBIAN_FRONTEND=noninteractive + +FROM --platform=linux/amd64 debian:12-slim AS poky-toolchain +ARG DEBIAN_FRONTEND +RUN apt-get update \ + && apt-get install -y wget xz-utils \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /tmp + +RUN wget -O /tmp/toolchain.sh.000 https://github.com/synaptics-astra/sdk/releases/download/v1.5.0/sl1680_oobe-poky-glibc-x86_64-astra-media-oobe-cortexa73-sl1680-toolchain-4.0.17.sh.000 \ + && wget -O /tmp/toolchain.sh.001 https://github.com/synaptics-astra/sdk/releases/download/v1.5.0/sl1680_oobe-poky-glibc-x86_64-astra-media-oobe-cortexa73-sl1680-toolchain-4.0.17.sh.001 \ + && cat /tmp/toolchain.sh.* > /tmp/toolchain.sh \ + && chmod +x /tmp/toolchain.sh \ + && /tmp/toolchain.sh -y -d /opt/poky/4.0.17 + +FROM deps AS synap1680-deps +ARG TARGETARCH + +# Install dependencies +RUN --mount=type=bind,source=docker/synap1680/install_deps.sh,target=/deps/install_deps.sh \ + /deps/install_deps.sh + +WORKDIR /opt/frigate/ +COPY --from=rootfs / / +COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libtim-vx.so /rootfs/usr/lib/ +COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libtensorflow-lite.so /rootfs/usr/lib/ +COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libvx_delegate.so /rootfs/usr/lib/ +COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libsynapnb.so /rootfs/usr/lib/ +COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libebg_utils.so /rootfs/usr/lib/ +COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libovxlib.so /rootfs/usr/lib/ +ADD https://github.com/synaptics-astra/synap-release/blob/v1.5.0/models/dolphin/object_detection/coco/model/mobilenet224_full80/model.synap /model.synap diff --git a/docker/synap1680/install_deps.sh b/docker/synap1680/install_deps.sh new file mode 100755 index 000000000..4ce9149d1 --- /dev/null +++ b/docker/synap1680/install_deps.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -euxo pipefail + +apt-get -qq update + +if [[ "${TARGETARCH}" == "amd64" ]]; then + arch="x86_64" +elif [[ "${TARGETARCH}" == "arm64" ]]; then + arch="aarch64" +fi + +wget -qO- "https://github.com/GaryHuang-ASUS/frigate-synaptics-rt/releases/download/v1.5.0-1.0/synaptics-rt-1.0.tar" | tar -C / -xzf - +wget -P /wheels/ "https://github.com/synaptics-synap/synap-python/releases/download/v0.0.4-preview/synap_python-0.0.4-cp311-cp311-manylinux_2_35_aarch64.whl" +cp /rootfs/usr/local/lib/* /usr/local/lib diff --git a/docker/synap1680/synap1680.hcl b/docker/synap1680/synap1680.hcl new file mode 100644 index 000000000..864f884a0 --- /dev/null +++ b/docker/synap1680/synap1680.hcl @@ -0,0 +1,20 @@ +target deps { + dockerfile = "docker/main/Dockerfile" + platforms = ["linux/arm64"] + target = "deps" +} + +target rootfs { + dockerfile = "docker/main/Dockerfile" + platforms = ["linux/arm64"] + target = "rootfs" +} + +target synap1680 { + dockerfile = "docker/synap1680/Dockerfile" + contexts = { + deps = "target:deps", + rootfs = "target:rootfs" + } + platforms = ["linux/arm64"] +} diff --git a/docker/synap1680/synap1680.mk b/docker/synap1680/synap1680.mk new file mode 100644 index 000000000..a8df23fbd --- /dev/null +++ b/docker/synap1680/synap1680.mk @@ -0,0 +1,15 @@ +BOARDS += synap1680 + +local-synap1680: version + docker buildx bake --file=docker/synap1680/synap1680.hcl synap1680 \ + --set synap1680.tags=frigate:latest-synap1680 \ + --load + +build-synap1680: version + docker buildx bake --file=docker/synap1680/synap1680.hcl synap1680 \ + --set synap1680.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-synap1680 + +push-synap1680: build-synap1680 + docker buildx bake --file=docker/synap1680/synap1680.hcl synap1680 \ + --set synap1680.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-synap1680 \ + --push