mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-09-26 19:41:29 +08:00
Hailo amd64 support (#12820)
* Support building docker image for amd64 and arm64 * Support installations on amd64 and arm64 * Run build in new job * Update docs
This commit is contained in:
@@ -17,20 +17,27 @@ RUN mkdir /h8l-wheels
|
||||
RUN pip3 wheel --wheel-dir=/h8l-wheels -c /requirements-wheels.txt -r /requirements-wheels-h8l.txt
|
||||
|
||||
# Build HailoRT and create wheel
|
||||
FROM deps AS build-hailort
|
||||
FROM wheels AS build-hailort
|
||||
ARG TARGETARCH
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
# Install necessary APT packages
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
git \
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y \
|
||||
apt-transport-https \
|
||||
gnupg \
|
||||
wget \
|
||||
python3-dev \
|
||||
gcc-9 \
|
||||
g++-9 \
|
||||
libzmq3-dev \
|
||||
pciutils \
|
||||
rsync \
|
||||
# the key fingerprint can be obtained from https://ftp-master.debian.org/keys.html
|
||||
&& wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA4285295FC7B1A81600062A9605C66F00D6C9793" | \
|
||||
gpg --dearmor > /usr/share/keyrings/debian-archive-bullseye-stable.gpg \
|
||||
&& echo "deb [signed-by=/usr/share/keyrings/debian-archive-bullseye-stable.gpg] http://deb.debian.org/debian bullseye main contrib non-free" | \
|
||||
tee /etc/apt/sources.list.d/debian-bullseye-nonfree.list \
|
||||
&& apt-get -qq update \
|
||||
&& apt-get -qq install -y \
|
||||
python3.9 \
|
||||
python3.9-dev \
|
||||
build-essential cmake git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Extract Python version and set environment variables
|
||||
@@ -39,9 +46,6 @@ RUN PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2)
|
||||
echo "PYTHON_VERSION=$PYTHON_VERSION" > /etc/environment && \
|
||||
echo "PYTHON_VERSION_NO_DOT=$PYTHON_VERSION_NO_DOT" >> /etc/environment
|
||||
|
||||
#ENV PYTHON_VER=$PYTHON_VERSION
|
||||
#ENV PYTHON_VER_NO_DOT=$PYTHON_VERSION_NO_DOT
|
||||
|
||||
# Clone and build HailoRT
|
||||
RUN . /etc/environment && \
|
||||
git clone https://github.com/hailo-ai/hailort.git /opt/hailort && \
|
||||
@@ -50,7 +54,7 @@ RUN . /etc/environment && \
|
||||
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DHAILO_BUILD_PYBIND=1 -DPYBIND11_PYTHON_VERSION=${PYTHON_VERSION} && \
|
||||
cmake --build build --config release --target libhailort && \
|
||||
cmake --build build --config release --target _pyhailort && \
|
||||
cp build/hailort/libhailort/bindings/python/src/_pyhailort.cpython-${PYTHON_VERSION_NO_DOT}-aarch64-linux-gnu.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/ && \
|
||||
cp build/hailort/libhailort/bindings/python/src/_pyhailort.cpython-${PYTHON_VERSION_NO_DOT}-$(if [ $TARGETARCH == "amd64" ]; then echo 'x86_64'; else echo 'aarch64'; fi )-linux-gnu.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/ && \
|
||||
cp build/hailort/libhailort/src/libhailort.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/
|
||||
|
||||
RUN ls -ahl /opt/hailort/build/hailort/libhailort/src/
|
||||
@@ -94,7 +98,7 @@ COPY --from=rootfs / /
|
||||
|
||||
# Set environment variables for Hailo SDK
|
||||
ENV PATH="/opt/hailort/bin:${PATH}"
|
||||
ENV LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu:${LD_LIBRARY_PATH}"
|
||||
ENV LD_LIBRARY_PATH="/usr/lib/$(if [ $TARGETARCH == "amd64" ]; then echo 'x86_64'; else echo 'aarch64'; fi )-linux-gnu:${LD_LIBRARY_PATH}"
|
||||
|
||||
# Set workdir
|
||||
WORKDIR /opt/frigate/
|
||||
|
@@ -1,18 +1,18 @@
|
||||
target wheels {
|
||||
dockerfile = "docker/main/Dockerfile"
|
||||
platforms = ["linux/arm64"]
|
||||
platforms = ["linux/arm64","linux/amd64"]
|
||||
target = "wheels"
|
||||
}
|
||||
|
||||
target deps {
|
||||
dockerfile = "docker/main/Dockerfile"
|
||||
platforms = ["linux/arm64"]
|
||||
platforms = ["linux/arm64","linux/amd64"]
|
||||
target = "deps"
|
||||
}
|
||||
|
||||
target rootfs {
|
||||
dockerfile = "docker/main/Dockerfile"
|
||||
platforms = ["linux/arm64"]
|
||||
platforms = ["linux/arm64","linux/amd64"]
|
||||
target = "rootfs"
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ target h8l {
|
||||
deps = "target:deps"
|
||||
rootfs = "target:rootfs"
|
||||
}
|
||||
platforms = ["linux/arm64"]
|
||||
platforms = ["linux/arm64","linux/amd64"]
|
||||
}
|
||||
|
35
docker/hailo8l/user_installation.sh
Normal file
35
docker/hailo8l/user_installation.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Update package list and install dependencies
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential cmake git wget linux-modules-extra-$(uname -r)
|
||||
|
||||
arch=$(uname -m)
|
||||
|
||||
if [[ $arch == "x86_64" ]]; then
|
||||
sudo apt install -y linux-headers-$(uname -r);
|
||||
else
|
||||
sudo apt install -y linux-modules-extra-$(uname -r);
|
||||
fi
|
||||
|
||||
# Clone the HailoRT driver repository
|
||||
git clone --depth 1 --branch v4.17.0 https://github.com/hailo-ai/hailort-drivers.git
|
||||
|
||||
# Build and install the HailoRT driver
|
||||
cd hailort-drivers/linux/pcie
|
||||
sudo make all
|
||||
sudo make install
|
||||
|
||||
# Load the Hailo PCI driver
|
||||
sudo modprobe hailo_pci
|
||||
|
||||
# Download and install the firmware
|
||||
cd ../../
|
||||
./download_firmware.sh
|
||||
sudo mv hailo8_fw.4.17.0.bin /lib/firmware/hailo/hailo8_fw.bin
|
||||
|
||||
# Install udev rules
|
||||
sudo cp ./linux/pcie/51-hailo-udev.rules /etc/udev/rules.d/
|
||||
sudo udevadm control --reload-rules && sudo udevadm trigger
|
||||
|
||||
echo "HailoRT driver installation complete."
|
Reference in New Issue
Block a user