Skip to content

Commit

Permalink
Add support for Hailo Card
Browse files Browse the repository at this point in the history
This commit integrates the following main components:

- hailo-pci (OSS kernel module)
- hailo-firmware (proprietary firmware for hailo8 chip)
- hailort (Userspace Libraries)
  - hailortcli (tool)
  - hailort (service)
  - libhailort (c library)
  - libhailort-dev (dev package)
  - python3-hailort (python library)
  - libgsthailo (gstreamer element)

Signed-off-by: Li Hua Qian <[email protected]>
  • Loading branch information
huaqianli committed Nov 21, 2024
1 parent 088f2a9 commit ac22992
Show file tree
Hide file tree
Showing 38 changed files with 1,400 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kas/iot2050.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ repos:
url: https://gitlab.com/cip-project/cip-core/isar-cip-core.git
commit: bafd102601ae21c2b2643d536d62fb7cc5f98767

meta-hailo:
path: ${TOPDIR}/../meta-hailo

local_conf_header:
standard: |
CONF_VERSION = "1"
Expand Down
16 changes: 16 additions & 0 deletions kas/opt/meta-hailo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) Siemens AG, 2024
#
# Authors:
# Li Hua Qian <[email protected]>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
#

header:
version: 14

repos:
meta-hailo:
path: ${TOPDIR}/../meta-hailo
5 changes: 5 additions & 0 deletions meta-hailo/MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Maintainers

- Diogo Ivo <[email protected]>
- Felix Moessbauer <[email protected]>
- Li Hua Qian <[email protected]>
25 changes: 25 additions & 0 deletions meta-hailo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# meta-hailo - Support for HAILO NPU chips

This repo provides recipes to build the kernel and userspace drivers and utilities
for the Hailo-8 NPU chip.
This includes the following main components:

- hailo-pci (OSS kernel module)
- hailo-firmware (proprietary firmware for hailo8 chip)
- hailort (Userspace API)
- hailortcli (tool)
- hailort (service)
- libhailort (c library)
- libhailort-dev (dev package)
- python3-hailort (python library)

> Note: `numpy==1.23.3` was preinstalled. Please do not upgrade it, as
> `hailort v4.18.0` requires this specific version. Upgrading `numpy` may cause
> `pyhailort` to fail to execute.
## Versioning

This layer is versioned according to the major hailo driver version.
Note, that the kernel ABI is not stable and by that the version of the
userspace components need to perfectly match the version of the firmware
and the kernel module.
15 changes: 15 additions & 0 deletions meta-hailo/conf/layer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: Copyright 2023 Siemens AG
# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License
BBPATH .= ":${LAYERDIR}"

BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "hailo"
BBFILE_PATTERN_hailo = "^${LAYERDIR}/recipes-"
BBFILE_PRIORITY_hailo = "6"
LAYERVERSION_hailo = "3"

LAYERSERIES_COMPAT_hailo = "next"

LAYERDIR_hailo = "${LAYERDIR}"
19 changes: 19 additions & 0 deletions meta-hailo/kas/hailo-img-ci-amd64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: Copyright 2024 Siemens AG
# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License
header:
version: 10
includes:
- kas/opt/hailo.inc.yml

build_system: isar
machine: qemuamd64
distro: debian-bookworm
target: hailo-image-ci

local_conf_header:
default-user: |
USERS += "root"
USER_root[flags] += "clear-text-password"
USER_root[password] ??= "root"
ccache: |
USE_CCACHE = "1"
14 changes: 14 additions & 0 deletions meta-hailo/kas/hailo-packages-bookworm-amd64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: Copyright 2023 Siemens AG
# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License
header:
version: 10
includes:
- kas/opt/hailo.inc.yml

build_system: isar
machine: qemuamd64
distro: debian-bookworm
target:
- hailo-pci-amd64
- hailo-firmware
- hailort
14 changes: 14 additions & 0 deletions meta-hailo/kas/hailo-packages-bookworm-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: Copyright 2023 Siemens AG
# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License
header:
version: 10
includes:
- kas/opt/hailo.inc.yml

build_system: isar
machine: qemuarm64
distro: debian-bookworm
target:
- hailo-pci-arm64
- hailo-firmware
- hailort
6 changes: 6 additions & 0 deletions meta-hailo/kas/opt/hailo.inc.lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
header:
version: 14
overrides:
repos:
isar:
commit: 9dc362cd7115074c0f60843e687ed89db5c9339a
24 changes: 24 additions & 0 deletions meta-hailo/kas/opt/hailo.inc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: Copyright 2023 Siemens AG
# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License
header:
version: 15

repos:
isar:
url: https://github.com/ilbers/isar.git
branch: next
layers:
meta:
meta-isar:
patches:
01-kmod-cross:
repo: hailo
path: patches/isar/0001-auto-disable-cross-for-kmod-build-against-distro-ker.patch

hailo:

build_system: isar

local_conf_header:
crossbuild: |
ISAR_CROSS_COMPILE = "1"
94 changes: 94 additions & 0 deletions meta-hailo/recipes-app/hailort/files/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Source: hailort
Maintainer: Felix Moessbauer <[email protected]>, Li Hua Qian <[email protected]>
Section: devel
Priority: optional
Standards-Version: 4.6.1
Build-Depends:
debhelper-compat (=13),
cmake,
bash-completion,
libspdlog-dev,
libprotobuf-dev,
nlohmann-json3-dev,
libgrpc-dev,
libgrpc++-dev,
libreaderwriterqueue-dev:native,
protobuf-compiler,
protobuf-compiler-grpc,
libbenchmark-dev,
dh-python,
libpython3-all-dev,
python3-all-dev:any,
pybind11-dev,
python3-setuptools,
python3-wheel:native,
python3-verboselogs (>= 1.7~),
libeigen3-dev,
pkg-config,
libglib2.0-dev,
libgstreamer1.0-dev,
libgstreamer-plugins-base1.0-dev

Package: hailortcli
Architecture: any
Multi-Arch: foreign
Description: userspace API for running inference on the hailo8 chip (tool)
Depends:
libhailort,
${misc:Depends},
${shlibs:Depends}
Suggests:
bash-completion

Package: hailort
Architecture: any
Multi-Arch: foreign
Description: userspace API for running inference on the hailo8 chip (service)
Depends:
libhailort,
${misc:Depends},
${shlibs:Depends}

Package: libhailort
Architecture: any
Multi-Arch: same
Description: userspace API for running inference on the hailo8 chip (lib)
Depends:
${misc:Depends},
${shlibs:Depends}

Package: python3-hailort
Architecture: any
Multi-Arch: same
Description: userspace API for running inference on the hailo8 chip (python package)
Depends:
${python3:Depends},
${misc:Depends},
${shlibs:Depends},
python3-numpy (= 1.23.3)

Package: libhailort-dev
Architecture: any
Multi-Arch: foreign
Description: userspace API for running inference on the hailo8 chip (dev)
Depends:
libhailort (=${binary:Version}),
${misc:Depends},
${shlibs:Depends}

Package: libgsthailo
Architecture: any
Multi-Arch: same
Description: hailort GStreamer element (HailoNet) (lib)
Depends:
${misc:Depends},
${shlibs:Depends}

Package: libgsthailo-dev
Architecture: any
Multi-Arch: foreign
Description: hailort GStreamer element (HailoNet) (dev)
Depends:
libgsthailo (=${binary:Version}),
${misc:Depends},
${shlibs:Depends}
4 changes: 4 additions & 0 deletions meta-hailo/recipes-app/hailort/files/debian/hailort.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
etc/default/hailort_service
usr/bin/hailort_service
# erronous upstream install path, fix here
usr/usr/share/bash-completion/completions/hailortcli usr/share/bash-completion/completions/
16 changes: 16 additions & 0 deletions meta-hailo/recipes-app/hailort/files/debian/hailort.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=HailoRT service
Documentation=https://github.com/hailo-ai/hailort

[Service]
Type=forking
EnvironmentFile=/etc/default/hailort_service
ExecStart=/usr/bin/hailort_service
Restart=on-failure
RemainAfterExit=yes
PIDFile=/run/hailo/hailort_service.pid
ExecReload=/bin/kill -HUP $MAINPID
ExecStartPost=/bin/sleep 0.1

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/bin/hailortcli
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/include/gstreamer-1.0/gst/hailo/tensor_meta.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/aarch64-linux-gnu/libgsthailo.so
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
usr/include/hailo
usr/lib/*/libhailort.so
usr/lib/*/cmake/HailoRT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libhailort.so.*
Binary file not shown.
3 changes: 3 additions & 0 deletions meta-hailo/recipes-app/hailort/files/debian/not-installed
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
usr/bin/hailo
usr/lib/systemd/system/hailort.service
usr/lib/python3.*/dist-packages/hailo_tutorials/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
usr/lib/python3*/dist-packages/hailort-*.egg-info
usr/lib/python3*/dist-packages/hailo_platform
27 changes: 27 additions & 0 deletions meta-hailo/recipes-app/hailort/files/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
dh $@ --with python3

ifeq ($(DEB_HOST_ARCH),arm64)
CMAKE_TOOLCHAIN_FILE := $(CURDIR)/hailort/libhailort/cmake/toolchains/linux.aarch64.cmake
endif

override_dh_auto_configure:
dh_auto_configure --buildsystem=pybuild --sourcedir=hailort/libhailort/bindings/python/platform
dh_auto_configure --buildsystem=cmake -- \
-DHAILO_BUILD_SERVICE=ON \
-DHAILO_BUILD_GSTREAMER=ON \
-DCMAKE_BUILD_TYPE=Release

override_dh_auto_build:
CMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) \
dh_auto_build --buildsystem=pybuild --sourcedir=hailort/libhailort/bindings/python/platform
dh_auto_build --buildsystem=cmake

override_dh_auto_install:
CMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) \
dh_auto_install --buildsystem=pybuild --sourcedirectory=hailort/libhailort/bindings/python/platform
dh_auto_install --buildsystem=cmake
Loading

0 comments on commit ac22992

Please sign in to comment.