diff --git a/kas/iot2050.yml b/kas/iot2050.yml index ba472229f..82cd88e47 100644 --- a/kas/iot2050.yml +++ b/kas/iot2050.yml @@ -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" diff --git a/kas/opt/meta-hailo.yml b/kas/opt/meta-hailo.yml new file mode 100644 index 000000000..b7ba9aeeb --- /dev/null +++ b/kas/opt/meta-hailo.yml @@ -0,0 +1,16 @@ +# +# Copyright (c) Siemens AG, 2024 +# +# Authors: +# Li Hua Qian +# +# 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 diff --git a/meta-hailo/.gitignore b/meta-hailo/.gitignore new file mode 100644 index 000000000..567609b12 --- /dev/null +++ b/meta-hailo/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/meta-hailo/.gitlab-ci.yml b/meta-hailo/.gitlab-ci.yml new file mode 100644 index 000000000..c30716f0e --- /dev/null +++ b/meta-hailo/.gitlab-ci.yml @@ -0,0 +1,42 @@ +# SPDX-FileCopyrightText: Copyright 2023 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +include: + - project: "ebsy/components/kas-patterns" + ref: main + file: "gitlab-ci/common.yml" + +stages: + - build + +variables: + KAS_CONFIG: kas/opt/hailo.inc.yml + KAS_VERSION: "4.2" + +.kas-build: + stage: build + image: ghcr.io/siemens/kas/kas-isar:${KAS_VERSION} + tags: [privileged, region-eu] + extends: + - .kaspat-kas-build + after_script: + - !reference [.kaspat-sstate-analyze, script] + - !reference [.kaspat-sstate-upload, script] + +######## Build jobs ######## +bookworm-packages-amd64: + extends: + - .kas-build + script: + - kas build kas/hailo-packages-bookworm-amd64.yml + +bookworm-packages-arm64: + extends: + - .kas-build + script: + - kas build kas/hailo-packages-bookworm-arm64.yml + +bookworm-image-amd64: + extends: + - .kas-build + script: + - kas build kas/hailo-img-ci-amd64.yml diff --git a/meta-hailo/CONTRIBUTING.md b/meta-hailo/CONTRIBUTING.md new file mode 100644 index 000000000..17893fee5 --- /dev/null +++ b/meta-hailo/CONTRIBUTING.md @@ -0,0 +1,99 @@ +# Developer Notes for Contributing Code + +We welcome and appreciate any kind of use case evaluations, feature requests, +bug reports and code contributions. To simplify cooperation, we follow the +guidelines described in the following. + +## Developer Notes + +### Versioning + +The whole layer is versioned according to the hailo drivers version (e.g. 4). +For each major version, a corresponding branch `v` is created. +When using this layer in downstream projects, we highly recommend to point your builder +to a versioned branch and in addition pin the version (e.g. with kas lockfiles). + +In addition to that, the individual components are versioned according to the +corresponding package / artifact versions. + +### Issues + +Before opening an issue, check if the following conditions are met: + +- The issue is related to the integration (and not to a bug in a component itself) +- There is no similar issue + +### Code Contributions + +We follow the [Conventional Changelog](https://www.conventionalcommits.org/en/) strategy. +Please write your commit message(s) according to this standard. + +To contribute code, please use the merge-request workflow. If you are a member of the project, +please directly create a MR in this project. If you are not a member, please fork the project +and create a cross-repo merge request. As we cannot run the CI on foreign repositories, we will +not merge the MR directly, but use an integration branch and cherry-pick the changes. + +For a code change to be integrated, the following conditions must be met: + +- The series (MR) passes the CI +- The series (MR) is approved by at least one maintainer (see `MAINTAINERS.md`) + +In case of major version updates of the drivers, please get in contact with the maintainers. + +## Siemens Developer Notes + +Every planned contribution to Siemens Inner Source projects has to satisfy the following: + +* **Do not "release"** any code or other material without having received + permission from the person with the proper authority within Siemens. + +* **Do not "release"** any code or other material without review from an + experienced developer. _"release" means that the code will be integrated in a + product or delivered to a customer._ + +* **Do not contribute** any code from 3rd parties to Siemens Inner Source + projects, i.e. do not copy code from code sharing sites (stackoverflow, + codeguru,...), open source projects, commercial code available in source code + form, books, journals, etc.). + +* **Do not remove** copyrights and/or license references and/or license texts. + +* If an entire package will be contributed, ensure that the text of the + Inner Source License is provided in the file `LICENSE.md` in the root directory of the project. + +* Additionally, create a file `COPYING.md` with an appropriate copyright notice. E.g.: + + ```txt + Copyright YEAR Siemens AG + Licensed under the Siemens Inner Source License 1.4 or at your option any later version + ``` + +* Include a link to the files `LICENSE.md` and `COPYING.md` in the `README.md` of your project + +* Please adhere to the following comment header format for code files which designates + author, year and copyright information: + + ```c++ + /* + * SPDX-FileCopyrightText: Copyright YEAR Siemens AG + * + * SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License + */ + ``` + +* Ensure that the comments and file headers **do not contain**: + * product and/or project names, release numbers and their release dates + * inappropriate language + * any words and/or phrases like "stolen from" or "copied from". A + contribution is a serious matter and not the place for jokes. If you have + the need to provide information like "derived from" ensure that you also + provide the "license information" of the code you derived from. + +* Ensure that files **do not contain**: + * configuration information + * credentials for real IT-environments, like server names, IP-addresses, + login information, or passwords. + +* **Do notify** the authors/maintainers of projects under the Siemens Inner + Source License if you find code or other parts failing to fulfill the + requirements of the license or this checklist. diff --git a/meta-hailo/COPYING.md b/meta-hailo/COPYING.md new file mode 100644 index 000000000..89b3bb110 --- /dev/null +++ b/meta-hailo/COPYING.md @@ -0,0 +1,2 @@ +Copyright 2023 Siemens AG +Licensed under the [Siemens Inner Source License 1.4](LICENSES/LicenseRef-Siemens-Inner-Source-License.txt) or at your option any later version diff --git a/meta-hailo/EXPORT.yml b/meta-hailo/EXPORT.yml new file mode 100644 index 000000000..1f82536c5 --- /dev/null +++ b/meta-hailo/EXPORT.yml @@ -0,0 +1,10 @@ +AL: 'N' +ECCN: 'N' +NECC: 'N' +OTR: not relevant +CCATS: not relevant +COO: not relevant +# Documentation: https://code.siemens.io/docs/export/ +# Generated by: https://code.siemens.com/code-ops/ecc-wizard/tree/86e3fe95 +# Decision Path: Q1,Q2,Q3,Q4,Q5,Q6,Q6exit2 +# Creation Date: 2023-12-18T05:53:53.414Z diff --git a/meta-hailo/LICENSES/LicenseRef-Siemens-Inner-Source-License.txt b/meta-hailo/LICENSES/LicenseRef-Siemens-Inner-Source-License.txt new file mode 100644 index 000000000..d1313a41e --- /dev/null +++ b/meta-hailo/LICENSES/LicenseRef-Siemens-Inner-Source-License.txt @@ -0,0 +1,67 @@ +Siemens Inner Source License v1.4 + +Preamble +This License serves the purpose to facilitate exchange of source code among Siemens’ AFFILIATES on an internal code sharing platform. It applies to Siemens Aktiengesellschaft and all of its AFFILIATES that either have concluded the “Agreement on the use of the Inner Source Platform in collaborative software development projects” with Siemens Aktiengesellschaft (“AGREEMENT”) or participate in the inner source code sharing by means of any other valid agreement. + +1. Definitions +Terms with capital letters are defined in Exhibit 1 to this Annex 4. + +2. Grants +To the extent and as long as it has the right to do so, the PARTICIPATING SIEMENS ENTITY, which has uploaded the SOFTWARE, as well as the Siemens Aktiengesellschaft grant all other PARTICIPATING SIEMENS ENTITIES with respect to the SOFTWARE and the associated documentation file(s) under its copyrights and intellectual property rights a non-exclusive, worldwide, and irrevocable right and license to: + i. use, have used, copy, have copied, modify, have modified the SOFTWARE, + ii. incorporate and have incorporated the SOFTWARE and/or modified versions thereof in binary form into PRODUCTS; and + iii. to market, have market, distribute, have distributed, make available, have made available (including online distribution and hosting as a service) to third parties for use in virtual and/or non-virtual environments, the SOFTWARE solely in binary form and as part of PRODUCTS. If the SOFTWARE can only be used and distributed in source code form (e.g. scripting languages), the rights granted under this section ii.-iii.) shall also apply to the source code of the SOFTWARE. + iv. deposit the source code of the SOFTWARE with third parties acting as escrow agents and grant customers of PRODUCTS, into which the SOFTWARE or modified versions thereof have been incorporated, non-exclusive rights to use and modify the SOFTWARE under the conditions specified in the escrow agreement for the purpose of manufacturing and using such PRODUCTS, which incorporate the SOFTWARE and modified versions thereof. + +If SOFTWARE is software which has been developed and/or enhanced by or for a SIEMENS GAS AND POWER OPERATING COMPANY and for which the SIEMENS GAS AND POWER OPERATING COMPANY had granted to INNER SOURCE CONTRIBUTOR corresponding sublicensing rights, the license of this Section 2 shall be limited to the SIEMENS CURRENT FIELD. + +3. Restrictions +For avoidance of doubt, a PARTICIPATING SIEMENS ENTITY shall not be entitled to grant third parties exclusive rights to the SOFTWARE and to make available to third parties its PRODUCTS containing SOFTWARE and/or modified versions thereof under license terms that violate or conflict with the terms of this license or any applicable agreement referring to this license. +Furthermore all PARTICIPATING SIEMENS ENTITIES shall + i. comply with all current restrictions, obligations and guidelines posted on or referenced by the SIEMENS CODE REPOSITORY and additional restrictions and/or obligations – if any available – in an optional file named “RESTRICTIONS.md file” associated with the respective SOFTWARE on the SIEMENS CODE REPOSITORY; and + ii. use reasonable efforts to make all enhancements and/or modifications made to the SOFTWARE available to all other PARTICIPATING SIEMENS ENTITY on the SIEMENS CODE REPOSITORY under the terms of this license, as amended from time to time. + +4. Liability +All PARTICIPATING SIEMENS ENTITIES shall be solely responsible for their use of SOFTWARE and/or modified versions thereof and shall be liable to third parties for their PRODUCTS containing SOFTWARE and/or modified versions thereof and shall not be entitled to assert warranty or compensation claims against other PARTICIPATING SIEMENS ENTITIES for defects or third party intellectual property rights infringement in the SOFTWARE, notwithstanding any contrary provisions in the Terms and Conditions for Deliveries and Services for Siemens-internal Transactions (Siemens Conditions). + +5. Newer Versions +The license administrator of this license is Siemens Aktiengesellschaft, SOP IT. This license may be changed from time to time. Any change and its effective date have to be agreed by the Divisional Support Group / Steering Committee or any successor organization thereof. No one other than the license administrator has the right to publish the changes to this license agreed by the Divisional Support Group / Steering Committee or any successor organization thereof. The released version of this license has a unique version number. The license administrator shall publish revised and/or new versions of this license at least 30 days before the change effective date. Such revised/new versions will be similar in spirit to the current version, but may differ in detail to address new problems or concerns. Revised and/or new versions of this license released on the SIEMENS CODE REPOSITORY become binding at the given change effective date. +The SIEMENS CODE REPOSITORY shall show which version of the license applies to which SOFTWARE. + +6. Termination +If the AGREEMENT or any other agreement from which PARTICIPATING SIEMENS ENTITY derives its right to participate in the inner source code sharing terminates, the former PARTICIPATING SIEMENS ENTITY retains the right to use the SOFTWARE downloaded during the term of the respective terminated agreement under the terms of this License. In contrast, the former PARTICIPATING SIEMENS ENTITY is no longer entitled to access the SIEMENS CODE REPOSITORY or use SOFTWARE made available on the SIEMENS CODE REPOSITORY after termination of the respective agreement. + +Exhibit 1 to Annex 4 +Definitions + +"AFFILIATE" shall mean a corporation or other entity directly or indirectly, owned or controlled by, or owning or controlling, or under common control with Siemens Aktiengesellschaft where “control” shall mean to have, directly or indirectly, the power to direct or cause the direction of the management and policies of a corporation or other entity. + +“BUSINESS MANDATE” shall mean BUSINESS MANDATES published in the Business Mandate Directory of Siemens on 1 October 2019, provided that, if omissions or errors that may be contained in the Business Mandate Directory on 1 October 2019 are corrected by the Parties until the Loss of Control Date in accordance with the procedure of approval and release of the BUSINESS MANDATES of Siemens, such corrected version of the Business Mandate Directory shall apply. + +“GP CURRENT FIELD” shall mean the portfolio of products and services, including legacy products and services, of the BUSINESS as conducted on PORTFOLIO REFERENCE DATE, whereas such portfolio shall consist of: + (i) products and services set out in the BUSINESS MANDATES of the SIEMENS GAS AND POWER OPERATING COMPANY, + (ii) products and services which are actually part of the portfolio of the BUSINESS on the PORTFOLIO REFERENCE DATE and are neither set out in the BUSINESS MANDATES of the SIEMENS GAS AND POWER OPERATING COMPANY nor in the BUSINESS MANDATES of SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and + (iii) products or services which are not set out in the BUSINESS MANDATES of either Party but are on the PORTFOLIO REFERENCE DATE part of the research and development conducted by, or on behalf of, the BUSINESS, provided that, such research and development (a) has been funded by the BUSINESS prior to the PORTFOLIO REFERENCE DATE and (b) is documented in a written BUSINESS or research and development plan. + +For the avoidance of doubt, +(1) in case the products and services are set out in the BUSINESS MANDATES of both SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and the BUSINESS, such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD; +(2) in case products and services are actually part of both, the portfolio of SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and of the BUSINESS, and are not set out in either of the respective BUSINESS MANDATES, such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD; and +(3) in case the products and services are part of the research and development conducted on the PORTFOLIO REFERENCE DATE by both the BUSINESS and SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, but excluding any research and development by Siemens or its AFFILIATES (excluding SIEMENS GAS AND POWER OPERATING COMPANY) for the BUSINESS based on orders placed by the BUSINESS and where such research and development is fully funded by the BUSINESS and as set out in a list agreed between Siemens Aktiengesellschaft and SIEMENS GAS AND POWER OPERATING COMPANY, then such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD. + +“LOSS OF CONTROL DATE” shall mean the date upon which SIEMENS GAS AND POWER OPERATING COMPANY ceases to be an AFFILIATE of Siemens Aktiengesellschaft. +“PARTICIPATING SIEMENS ENTITIES” shall mean Siemens Aktiengesellschaft and all AFFILIATES that i) either have concluded or will conclude the “Agreement on the use of the Inner Source Platform in collaborative software development projects” (hereinafter referred to as “AGREEMENT”) with Siemens Aktiengesellschaft, for as long as the respective entity is a party to the AGREEMENT or that ii) participate in the inner source code sharing by means of any other valid agreement. +“PORTFOLIO REFERENCE DATE” shall mean October 1, 2019. +“PRODUCTS” are products, supplies, services, projects, solutions and systems for internal use and/or for third parties. +“SIEMENS CODE REPOSITORY” shall mean the source code management platform ‘code.siemens.com’. +“SIEMENS GROUP” shall mean Siemens Aktiengesellschaft and its AFFILIATES: +“SOFTWARE” shall mean proprietary code uploaded by a PARTICIPATING SIEMENS ENTITY to the SIEMENS CODE REPOSITORY marked as “internal project” for further use by all other PARTICIPATING SIEMENS ENTITIES. +“SIEMENS CURRENT FIELD” shall mean the portfolio of products and services, including legacy products and services, of SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, as conducted on PORTFOLIO REFERENCE DATE, whereas such portfolio shall consist of: + (i) products and services set out in the BUSINESS MANDATE of the SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, + (ii) products and services which are actually part of the portfolio of the SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, on the PORTFOLIO REFERENCE DATE and are neither set out in the BUSINESS MANDATEs of the SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, nor in the BUSINESS MANDATES of the BUSINESS, and + (iii) products and services which are not set out in the BUSINESS MANDATES of either Party but are on the PORTFOLIO REFERENCE DATE part of the research and development conducted by, or on behalf of, the SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, provided that, such research and development (a) has been funded by SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and (b) is documented in a written business or research and development plan. +For the avoidance of doubt: +(1) in case the products and services are set out in the BUSINESS MANDATES of both SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and the BUSINESS, such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD; +(2) in case products and services are actually part of both, the portfolio of SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and of the BUSINESS, and are not set out in either of the BUSINESS MANDATES, such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD; and +(3) in case the products and services are part of the research and development conducted on the PORTFOLIO REFERENCE DATE by both the BUSINESS and SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, but excluding any research and development by the BUSINESS for the Transferor or its AFFILIATES (excluding SIEMENS GAS AND POWER OPERATING COMPANY) based on orders placed by the TRANSFEROR or its AFFILIATES (excluding SIEMENS GAS AND POWER OPERATING COMPANY) and where such research and development is fully funded by the TRANSFEROR or its AFFILIATE (excluding Gas and Power Operating Company) and as set out in a list agreed between Siemens AG and SIEMENS GAS AND POWER OPERATING COMPANY, then such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD. + +“TRANSFEROR” shall mean Siemens Aktiengesellschaft or its AFFILIATE ((excluding SIEMENS GAS AND POWER OPERATING COMPANY). \ No newline at end of file diff --git a/meta-hailo/MAINTAINERS.md b/meta-hailo/MAINTAINERS.md new file mode 100644 index 000000000..4b80ebbd4 --- /dev/null +++ b/meta-hailo/MAINTAINERS.md @@ -0,0 +1,4 @@ +# Maintainers + +- Diogo Ivo +- Felix Moessbauer diff --git a/meta-hailo/README.md b/meta-hailo/README.md new file mode 100644 index 000000000..fb499295f --- /dev/null +++ b/meta-hailo/README.md @@ -0,0 +1,21 @@ +# 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) + +## 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. diff --git a/meta-hailo/conf/layer.conf b/meta-hailo/conf/layer.conf new file mode 100644 index 000000000..e934e44e5 --- /dev/null +++ b/meta-hailo/conf/layer.conf @@ -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}" diff --git a/meta-hailo/kas/hailo-img-ci-amd64.yml b/meta-hailo/kas/hailo-img-ci-amd64.yml new file mode 100644 index 000000000..7e82b4664 --- /dev/null +++ b/meta-hailo/kas/hailo-img-ci-amd64.yml @@ -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" diff --git a/meta-hailo/kas/hailo-packages-bookworm-amd64.yml b/meta-hailo/kas/hailo-packages-bookworm-amd64.yml new file mode 100644 index 000000000..d47eba16b --- /dev/null +++ b/meta-hailo/kas/hailo-packages-bookworm-amd64.yml @@ -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 diff --git a/meta-hailo/kas/hailo-packages-bookworm-arm64.yml b/meta-hailo/kas/hailo-packages-bookworm-arm64.yml new file mode 100644 index 000000000..7e56c0456 --- /dev/null +++ b/meta-hailo/kas/hailo-packages-bookworm-arm64.yml @@ -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 diff --git a/meta-hailo/kas/opt/hailo.inc.lock.yml b/meta-hailo/kas/opt/hailo.inc.lock.yml new file mode 100644 index 000000000..6a7a45e1e --- /dev/null +++ b/meta-hailo/kas/opt/hailo.inc.lock.yml @@ -0,0 +1,6 @@ +header: + version: 14 +overrides: + repos: + isar: + commit: 9dc362cd7115074c0f60843e687ed89db5c9339a diff --git a/meta-hailo/kas/opt/hailo.inc.yml b/meta-hailo/kas/opt/hailo.inc.yml new file mode 100644 index 000000000..46eac0080 --- /dev/null +++ b/meta-hailo/kas/opt/hailo.inc.yml @@ -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" diff --git a/meta-hailo/recipes-app/hailort/files/debian/control b/meta-hailo/recipes-app/hailort/files/debian/control new file mode 100644 index 000000000..0ab0ac5fd --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/control @@ -0,0 +1,93 @@ +Source: hailort +Maintainer: Felix Moessbauer , Li Hua Qian +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} + +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} \ No newline at end of file diff --git a/meta-hailo/recipes-app/hailort/files/debian/hailort.install b/meta-hailo/recipes-app/hailort/files/debian/hailort.install new file mode 100644 index 000000000..b4944ec20 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/hailort.install @@ -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/ diff --git a/meta-hailo/recipes-app/hailort/files/debian/hailort.service b/meta-hailo/recipes-app/hailort/files/debian/hailort.service new file mode 100644 index 000000000..c9ec090b2 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/hailort.service @@ -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 diff --git a/meta-hailo/recipes-app/hailort/files/debian/hailortcli.install b/meta-hailo/recipes-app/hailort/files/debian/hailortcli.install new file mode 100644 index 000000000..eb44e2a89 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/hailortcli.install @@ -0,0 +1 @@ +usr/bin/hailortcli diff --git a/meta-hailo/recipes-app/hailort/files/debian/libgsthailo-dev.install b/meta-hailo/recipes-app/hailort/files/debian/libgsthailo-dev.install new file mode 100644 index 000000000..214678390 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/libgsthailo-dev.install @@ -0,0 +1 @@ +usr/include/gstreamer-1.0/gst/hailo/tensor_meta.hpp \ No newline at end of file diff --git a/meta-hailo/recipes-app/hailort/files/debian/libgsthailo.install b/meta-hailo/recipes-app/hailort/files/debian/libgsthailo.install new file mode 100644 index 000000000..dc69f1301 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/libgsthailo.install @@ -0,0 +1 @@ +usr/lib/aarch64-linux-gnu/libgsthailo.so \ No newline at end of file diff --git a/meta-hailo/recipes-app/hailort/files/debian/libhailort-dev.install b/meta-hailo/recipes-app/hailort/files/debian/libhailort-dev.install new file mode 100644 index 000000000..5527f1029 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/libhailort-dev.install @@ -0,0 +1,3 @@ +usr/include/hailo +usr/lib/*/libhailort.so +usr/lib/*/cmake/HailoRT diff --git a/meta-hailo/recipes-app/hailort/files/debian/libhailort.install b/meta-hailo/recipes-app/hailort/files/debian/libhailort.install new file mode 100644 index 000000000..e98bce3f8 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/libhailort.install @@ -0,0 +1 @@ +usr/lib/*/libhailort.so.* diff --git a/meta-hailo/recipes-app/hailort/files/debian/libhailort.so.4.18.0 b/meta-hailo/recipes-app/hailort/files/debian/libhailort.so.4.18.0 new file mode 100644 index 000000000..780498b1b Binary files /dev/null and b/meta-hailo/recipes-app/hailort/files/debian/libhailort.so.4.18.0 differ diff --git a/meta-hailo/recipes-app/hailort/files/debian/not-installed b/meta-hailo/recipes-app/hailort/files/debian/not-installed new file mode 100644 index 000000000..1406d22b8 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/not-installed @@ -0,0 +1,3 @@ +usr/bin/hailo +usr/lib/systemd/system/hailort.service +usr/lib/python3.*/dist-packages/hailo_tutorials/* diff --git a/meta-hailo/recipes-app/hailort/files/debian/python3-hailort.install b/meta-hailo/recipes-app/hailort/files/debian/python3-hailort.install new file mode 100644 index 000000000..cb668641a --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/python3-hailort.install @@ -0,0 +1,2 @@ +usr/lib/python3*/dist-packages/hailort-*.egg-info +usr/lib/python3*/dist-packages/hailo_platform diff --git a/meta-hailo/recipes-app/hailort/files/debian/rules b/meta-hailo/recipes-app/hailort/files/debian/rules new file mode 100644 index 000000000..e835b7351 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/rules @@ -0,0 +1,28 @@ +#!/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_PYBIND=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 diff --git a/meta-hailo/recipes-app/hailort/files/patches/0001-do-not-use-spdlog-formatting-internals.patch b/meta-hailo/recipes-app/hailort/files/patches/0001-do-not-use-spdlog-formatting-internals.patch new file mode 100644 index 000000000..252a73e60 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0001-do-not-use-spdlog-formatting-internals.patch @@ -0,0 +1,122 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Felix Moessbauer +Date: Fri, 12 Jan 2024 18:56:16 +0100 +Subject: [PATCH] do not use spdlog formatting internals + +As a preparation for using the packaged versions of spdlog, we need +to avoid including spdlog internal headers. These headers are only +available when using the builtin fmt library, but distros ususally +ship an external version of libfmt. Also, the external version is more +strict w.r.t formatting of enums by requiring either a formatter, or +an explicit cast to the underlaying integer type. For the sake of +simplicity, we introduce the cast. + +Signed-off-by: Felix Moessbauer +Signed-off-by: Li Hua Qian +--- + hailort/common/utils.hpp | 4 +++- + .../resource_manager/resource_manager_builder.cpp | 3 ++- + .../libhailort/src/stream_common/nms_stream.cpp | 15 ++++++++++----- + .../libhailort/src/vdma/channel/channel_id.hpp | 2 +- + 4 files changed, 16 insertions(+), 8 deletions(-) + +diff --git a/hailort/common/utils.hpp b/hailort/common/utils.hpp +index 3eb719e2c13c..1de45bd0b325 100644 +--- a/hailort/common/utils.hpp ++++ b/hailort/common/utils.hpp +@@ -17,7 +17,8 @@ + #include "hailo/buffer.hpp" + + #include "common/logger_macros.hpp" +-#include ++#include ++#include + + #include + #include +@@ -26,6 +27,7 @@ + #include + #include + #include ++#include + + + namespace hailort +diff --git a/hailort/libhailort/src/core_op/resource_manager/resource_manager_builder.cpp b/hailort/libhailort/src/core_op/resource_manager/resource_manager_builder.cpp +index 0f8985f0ae77..627273b8bfe5 100644 +--- a/hailort/libhailort/src/core_op/resource_manager/resource_manager_builder.cpp ++++ b/hailort/libhailort/src/core_op/resource_manager/resource_manager_builder.cpp +@@ -1096,7 +1096,8 @@ static Expected create_switch_lcu_batch_action(con + CHECK_AS_EXPECTED((ContextSwitchConfigAction::Type::EnableLcuDefault == action->get_type()) || + (ContextSwitchConfigAction::Type::SwitchLcuBatch == action->get_type()) || + (ContextSwitchConfigAction::Type::EnableLcuNonDefault == action->get_type()), HAILO_INVALID_ARGUMENT, +- "Invalid action type - must be enable lcu (default or non default) or switch lcu batch, Received type {}", action->get_type()); ++ "Invalid action type - must be enable lcu (default or non default), Received type {}", ++ static_cast(action->get_type())); + + TRY(const auto params_buffer, action->serialize_params(context_resources)); + +diff --git a/hailort/libhailort/src/stream_common/nms_stream.cpp b/hailort/libhailort/src/stream_common/nms_stream.cpp +index 79aa29c4b4d8..7d43948a1f1a 100644 +--- a/hailort/libhailort/src/stream_common/nms_stream.cpp ++++ b/hailort/libhailort/src/stream_common/nms_stream.cpp +@@ -77,7 +77,8 @@ hailo_status NMSStreamReader::advance_state_machine(NMSBurstState *burst_state, + if (HAILO_BURST_TYPE_H8_PER_CLASS == burst_type) { + CHECK_IN_DEBUG((NMSBurstState::NMS_BURST_STATE_WAITING_FOR_DELIMETER == (*burst_state)) || + (NMSBurstState::NMS_BURST_STATE_WAITING_FOR_PADDING == (*burst_state)), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H8 NMS burst cannot receive delimeter while in state {}", (*burst_state)); ++ "Invalid state, H8 NMS burst cannot receive delimeter while in state {}", ++ static_cast(*burst_state)); + // To differentiate from H8 padding - where we should not increment amount of delimeters found + if ((*burst_state) == NMSBurstState::NMS_BURST_STATE_WAITING_FOR_DELIMETER) { + (*num_delimeters_received)++; +@@ -99,12 +100,14 @@ hailo_status NMSStreamReader::advance_state_machine(NMSBurstState *burst_state, + + } else if (HAILO_BURST_TYPE_H15_PER_CLASS == burst_type) { + CHECK_IN_DEBUG(NMSBurstState::NMS_BURST_STATE_WAITING_FOR_DELIMETER == (*burst_state), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H15 Per class NMS burst cannot receive delimeter while in state {}", (*burst_state)); ++ "Invalid state, H15 Per class NMS burst cannot receive delimeter while in state {}", ++ static_cast(*burst_state)); + (*num_delimeters_received)++; + *burst_state = NMSBurstState::NMS_BURST_STATE_WAITING_FOR_IMAGE_DELIMETER; + } else { + CHECK_IN_DEBUG(NMSBurstState::NMS_BURST_STATE_WAITING_FOR_DELIMETER == (*burst_state), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H15 Per Frame NMS burst cannot receive delimeter while in state {}", (*burst_state)); ++ "Invalid state, H15 Per Frame NMS burst cannot receive delimeter while in state {}", ++ static_cast(*burst_state)); + // in hailo15 per frame - if number of delimeter is same as num classes - we expect image delimeter next + // otherwise expect another delimeter + (*num_delimeters_received)++; +@@ -121,7 +124,8 @@ hailo_status NMSStreamReader::advance_state_machine(NMSBurstState *burst_state, + "Invalid state, H8 NMS burst cannot receive image delimeter"); + + CHECK_IN_DEBUG(NMSBurstState::NMS_BURST_STATE_WAITING_FOR_IMAGE_DELIMETER == (*burst_state), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H15 NMS burst cannot receive image delimeter in state {}", (*burst_state)); ++ "Invalid state, H15 NMS burst cannot receive image delimeter in state {}", ++ static_cast(*burst_state)); + + // in both hailo15 per class and per frame - when receiving image delimeter we move to expecting padding + *burst_state = NMSBurstState::NMS_BURST_STATE_WAITING_FOR_PADDING; +@@ -143,7 +147,8 @@ hailo_status NMSStreamReader::advance_state_machine(NMSBurstState *burst_state, + { + if ((HAILO_BURST_TYPE_H15_PER_CLASS == burst_type) || (HAILO_BURST_TYPE_H15_PER_FRAME == burst_type)) { + CHECK_IN_DEBUG(NMSBurstState::NMS_BURST_STATE_WAITING_FOR_PADDING == (*burst_state), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H15 NMS burst cannot receive padding in state {}", (*burst_state)); ++ "Invalid state, H15 NMS burst cannot receive padding in state {}", ++ static_cast(*burst_state)); + } + // In case of padding next state is wait for padding unless it is last padding of burst - then next state will be + // Wait for delimeter - will only get to this stage in debug - in release once image delimeter is read we ignore rest of +diff --git a/hailort/libhailort/src/vdma/channel/channel_id.hpp b/hailort/libhailort/src/vdma/channel/channel_id.hpp +index 09fb0432edd3..9928c31a343a 100644 +--- a/hailort/libhailort/src/vdma/channel/channel_id.hpp ++++ b/hailort/libhailort/src/vdma/channel/channel_id.hpp +@@ -12,7 +12,7 @@ + + #include "hailo/hailort.h" + #include "common/logger_macros.hpp" +-#include ++#include + #include + + diff --git a/meta-hailo/recipes-app/hailort/files/patches/0002-use-distro-version-of-packages-if-possible.patch b/meta-hailo/recipes-app/hailort/files/patches/0002-use-distro-version-of-packages-if-possible.patch new file mode 100644 index 000000000..8ade3fed3 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0002-use-distro-version-of-packages-if-possible.patch @@ -0,0 +1,451 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Felix Moessbauer +Date: Fri, 12 Jan 2024 18:12:26 +0100 +Subject: [PATCH] use distro version of packages if possible + +This patch replaces the vendored components with the version shipped +by the linux distribution (if possible). + +Signed-off-by: Felix Moessbauer +Signed-off-by: Li Hua Qian +--- + hailort/CMakeLists.txt | 15 +++++- + hailort/hailort_server/CMakeLists.txt | 3 +- + hailort/hailort_service/CMakeLists.txt | 5 +- + hailort/hailortcli/CMakeLists.txt | 7 +-- + hailort/hrpc/server.cpp | 33 ++++++++++++ + hailort/hrpc_protocol/CMakeLists.txt | 2 +- + hailort/libhailort/CMakeLists.txt | 6 +-- + .../bindings/python/src/CMakeLists.txt | 21 +++----- + hailort/libhailort/src/CMakeLists.txt | 7 +-- + .../src/network_group/network_group.cpp | 33 ++++++++++++ + .../src/utils/measurement_utils.hpp | 2 +- + .../src/vdma/driver/hailort_driver.cpp | 52 +++++++++++++++++++ + hailort/prepare_externals/CMakeLists.txt | 11 ---- + hailort/rpc/CMakeLists.txt | 4 +- + 14 files changed, 149 insertions(+), 52 deletions(-) + +diff --git a/hailort/CMakeLists.txt b/hailort/CMakeLists.txt +index 5dcaa06c2537..edea76ee3804 100644 +--- a/hailort/CMakeLists.txt ++++ b/hailort/CMakeLists.txt +@@ -46,9 +46,20 @@ endif() + # TODO: move protobuf and grpc to inner cmake files + set(HAILO_EXTERNAL_DIR ${CMAKE_CURRENT_LIST_DIR}/external) + set(HAILO_EXTERNALS_CMAKE_SCRIPTS ${CMAKE_CURRENT_LIST_DIR}/cmake/external/) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/protobuf.cmake) ++find_package(Protobuf REQUIRED) ++find_package(nlohmann_json 3.9.1 REQUIRED) ++find_package(benchmark REQUIRED) ++find_package(spdlog 1.8 REQUIRED) ++find_package(Eigen3 REQUIRED) ++find_path(RWQ_FOUND name readerwriterqueue.h REQUIRED) + if(HAILO_BUILD_SERVICE) +- include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/grpc.cmake) ++ find_package(gRPC REQUIRED) ++endif() ++if(HAILO_BUILD_PYBIND) ++ find_package(pybind11 REQUIRED) ++endif() ++if(ENABLE_TESTING) ++ find_package(Catch2 REQUIRED) + endif() + + set(HAILORT_INC_DIR ${PROJECT_SOURCE_DIR}/hailort/libhailort/include) +diff --git a/hailort/hailort_server/CMakeLists.txt b/hailort/hailort_server/CMakeLists.txt +index d288066dc741..b9263c8282dc 100644 +--- a/hailort/hailort_server/CMakeLists.txt ++++ b/hailort/hailort_server/CMakeLists.txt +@@ -1,6 +1,5 @@ + cmake_minimum_required(VERSION 3.0.0) + +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/spdlog.cmake) + include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/readerwriterqueue.cmake) + + set(THREADS_PREFER_PTHREAD_FLAG ON) +@@ -52,4 +51,4 @@ target_link_libraries(hailort_server PRIVATE + rpc_proto + spdlog::spdlog + readerwriterqueue +-) +\ No newline at end of file ++) +diff --git a/hailort/hailort_service/CMakeLists.txt b/hailort/hailort_service/CMakeLists.txt +index a470a3ddf0a0..4d3c52095f58 100644 +--- a/hailort/hailort_service/CMakeLists.txt ++++ b/hailort/hailort_service/CMakeLists.txt +@@ -1,7 +1,5 @@ + cmake_minimum_required(VERSION 3.0.0) + +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/spdlog.cmake) +- + if(WIN32) + set(HAILORT_SERVICE_OS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/windows") + elseif(UNIX) +@@ -23,9 +21,8 @@ set_property(TARGET hailort_service PROPERTY CXX_STANDARD 14) + target_link_libraries(hailort_service + libhailort + spdlog::spdlog +- grpc++_unsecure ++ gRPC::grpc++_unsecure + hailort_rpc_grpc_proto +- readerwriterqueue + ) + if(WIN32) + # Needed in order to compile eth utils (we compile here ${HAILORT_COMMON_CPP_SOURCES}, consider removing) +diff --git a/hailort/hailortcli/CMakeLists.txt b/hailort/hailortcli/CMakeLists.txt +index 8b180dadc291..1add7146af56 100644 +--- a/hailort/hailortcli/CMakeLists.txt ++++ b/hailort/hailortcli/CMakeLists.txt +@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.0.0) + + include(GNUInstallDirs) + include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/cli11.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/json.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/spdlog.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/readerwriterqueue.cmake) + include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/dotwriter.cmake) + + set(HAILORTCLI_CPP_FILES +@@ -69,10 +66,8 @@ set_property(TARGET hailortcli PROPERTY INSTALL_RPATH "$ORIGIN" "../lib/") # Lin + target_link_libraries(hailortcli + libhailort + CLI11::CLI11 +- nlohmann_json ++ nlohmann_json::nlohmann_json + spdlog::spdlog +- readerwriterqueue +- eigen + DotWriter + scheduler_mon_proto + profiler_proto) +diff --git a/hailort/hrpc/server.cpp b/hailort/hrpc/server.cpp +index 304c41c67a25..e72de4112f1a 100644 +--- a/hailort/hrpc/server.cpp ++++ b/hailort/hrpc/server.cpp +@@ -9,6 +9,39 @@ + + #include "server.hpp" + ++// Add a formatter spec for HailoRpcActionID ++template <> ++struct fmt::formatter { ++ constexpr auto parse(format_parse_context& ctx) { ++ return ctx.begin(); ++ } ++ ++ template ++ auto format(const HailoRpcActionID& id, FormatContext& ctx) { ++ std::string name; ++ switch (id) { ++ case HailoRpcActionID::VDEVICE__CREATE: name = "VDEVICE__CREATE"; break; ++ case HailoRpcActionID::VDEVICE__DESTROY: name = "VDEVICE__DESTROY"; break; ++ case HailoRpcActionID::VDEVICE__CREATE_INFER_MODEL: name = "VDEVICE__CREATE_INFER_MODEL"; break; ++ case HailoRpcActionID::INFER_MODEL__DESTROY: name = "INFER_MODEL__DESTROY"; break; ++ case HailoRpcActionID::INFER_MODEL__CREATE_CONFIGURED_INFER_MODEL: name = "INFER_MODEL__CREATE_CONFIGURED_INFER_MODEL"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__DESTROY: name = "CONFIGURED_INFER_MODEL__DESTROY"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__SET_SCHEDULER_TIMEOUT: name = "CONFIGURED_INFER_MODEL__SET_SCHEDULER_TIMEOUT"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__SET_SCHEDULER_THRESHOLD: name = "CONFIGURED_INFER_MODEL__SET_SCHEDULER_THRESHOLD"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__SET_SCHEDULER_PRIORITY: name = "CONFIGURED_INFER_MODEL__SET_SCHEDULER_PRIORITY"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__GET_HW_LATENCY_MEASUREMENT: name = "CONFIGURED_INFER_MODEL__GET_HW_LATENCY_MEASUREMENT"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__ACTIVATE: name = "CONFIGURED_INFER_MODEL__ACTIVATE"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__DEACTIVATE: name = "CONFIGURED_INFER_MODEL__DEACTIVATE"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__SHUTDOWN: name = "CONFIGURED_INFER_MODEL__SHUTDOWN"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__RUN_ASYNC: name = "CONFIGURED_INFER_MODEL__RUN_ASYNC"; break; ++ case HailoRpcActionID::CALLBACK_CALLED: name = "CALLBACK_CALLED"; break; ++ case HailoRpcActionID::MAX_VALUE: name = "MAX_VALUE"; break; ++ default: name = "UNKNOWN"; break; ++ } ++ return format_to(ctx.out(), "{}", name); ++ } ++}; ++ + namespace hrpc + { + +diff --git a/hailort/hrpc_protocol/CMakeLists.txt b/hailort/hrpc_protocol/CMakeLists.txt +index d6b925ad1b87..591b3928be91 100644 +--- a/hailort/hrpc_protocol/CMakeLists.txt ++++ b/hailort/hrpc_protocol/CMakeLists.txt +@@ -4,7 +4,7 @@ protobuf_generate_cpp(PROTO_RPC_SRC PROTO_RPC_HEADER rpc.proto) + get_filename_component(PROTO_HEADER_DIRECTORY ${PROTO_RPC_HEADER} DIRECTORY) + + add_library(rpc_proto STATIC EXCLUDE_FROM_ALL ${PROTO_RPC_SRC} ${PROTO_RPC_HEADER}) +-target_link_libraries(rpc_proto libprotobuf-lite) ++target_link_libraries(rpc_proto protobuf::libprotobuf-lite) + set_target_properties(rpc_proto PROPERTIES CXX_STANDARD 14 GENERATED TRUE POSITION_INDEPENDENT_CODE ON) + if(CMAKE_HOST_WIN32) + # https://github.com/protocolbuffers/protobuf/tree/master/cmake#notes-on-compiler-warnings +diff --git a/hailort/libhailort/CMakeLists.txt b/hailort/libhailort/CMakeLists.txt +index 33e183a98910..ab46f83483ad 100644 +--- a/hailort/libhailort/CMakeLists.txt ++++ b/hailort/libhailort/CMakeLists.txt +@@ -14,7 +14,7 @@ protobuf_generate_python(PROTO_HEF_PY hef.proto) # TODO (HRT-12504): Copy hef_pb + protobuf_generate_python(PROTO_HEF_PY tracer_profiler.proto) + + add_library(hef_proto ${PROTO_HEF_SRC} ${PROTO_HEF_HEADER} ${PROTO_HEF_PY}) +-target_link_libraries(hef_proto libprotobuf-lite) ++target_link_libraries(hef_proto protobuf::libprotobuf-lite) + set_target_properties(hef_proto PROPERTIES CXX_STANDARD 14 GENERATED TRUE POSITION_INDEPENDENT_CODE ON) + if(CMAKE_HOST_WIN32) + # https://github.com/protocolbuffers/protobuf/tree/master/cmake#notes-on-compiler-warnings +@@ -33,7 +33,7 @@ endif() + + protobuf_generate_cpp(PROTO_SCHEDULER_MON_SRC PROTO_SCHEDULER_MON_HEADR scheduler_mon.proto) + add_library(scheduler_mon_proto ${PROTO_SCHEDULER_MON_SRC} ${PROTO_SCHEDULER_MON_HEADR}) +-target_link_libraries(scheduler_mon_proto libprotobuf-lite) ++target_link_libraries(scheduler_mon_proto protobuf::libprotobuf-lite) + set_target_properties(scheduler_mon_proto PROPERTIES CXX_STANDARD 14 GENERATED TRUE POSITION_INDEPENDENT_CODE ON) + if(CMAKE_HOST_WIN32) + target_compile_options(scheduler_mon_proto PRIVATE /wd4244) +@@ -47,7 +47,7 @@ target_include_directories(scheduler_mon_proto + + protobuf_generate_cpp(PROTO_PROFILER_SRC PROTO_PROFILER_HEADR tracer_profiler.proto) + add_library(profiler_proto ${PROTO_PROFILER_SRC} ${PROTO_PROFILER_HEADR}) +-target_link_libraries(profiler_proto libprotobuf-lite) ++target_link_libraries(profiler_proto protobuf::libprotobuf-lite) + set_target_properties(profiler_proto PROPERTIES CXX_STANDARD 14 GENERATED TRUE POSITION_INDEPENDENT_CODE ON) + if(CMAKE_HOST_WIN32) + target_compile_options(profiler_proto PRIVATE /wd4244) +diff --git a/hailort/libhailort/bindings/python/src/CMakeLists.txt b/hailort/libhailort/bindings/python/src/CMakeLists.txt +index 1b5706c98862..913716297564 100644 +--- a/hailort/libhailort/bindings/python/src/CMakeLists.txt ++++ b/hailort/libhailort/bindings/python/src/CMakeLists.txt +@@ -13,7 +13,6 @@ option(HAILORT_INCLUDE_DIR "Path to include dir of libhailort" "") + + include(ExternalProject) + include(GNUInstallDirs) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/pybind11.cmake) + include_directories(${HAILORT_COMMON_DIR}) + + FUNCTION(exclude_archive_libs_symbols target) # should be same as in common_compiler_options.cmake +@@ -26,19 +25,7 @@ FUNCTION(exclude_archive_libs_symbols target) # should be same as in common_comp + endif() + ENDFUNCTION() + +-if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +- if(NOT DEFINED PYBIND11_PYTHON_VERSION) +- message(FATAL_ERROR "PYBIND11_PYTHON_VERSION is not defined. To build _pyhailort, pass python version") +- endif() +- string(REPLACE "." "" dpython ${PYBIND11_PYTHON_VERSION}) # E.g "3.5" -> "35" +- if(${dpython} LESS "38") +- set(m_flag "m") +- else() +- set(m_flag "") +- endif() +- set(PYTHON_MODULE_EXTENSION ".cpython-${dpython}${m_flag}-${CMAKE_SYSTEM_PROCESSOR}-linux-gnu.so") +-endif() +- ++find_package(pybind11 REQUIRED) + pybind11_add_module(_pyhailort + pyhailort.cpp + device_api.cpp +@@ -82,8 +69,12 @@ if(LIBHAILORT_PATH AND HAILORT_INCLUDE_DIR) + elseif(LIBHAILORT_PATH OR HAILORT_INCLUDE_DIR) + message(FATAL_ERROR "Both LIBHAILORT_PATH and HAILORT_INCLUDE_DIR must be defined or none of them") + else() ++ message(STATUS "skip find_package, CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}") ++ message(STATUS "CMAKE_SYSTEM_PROCESSOR is ${CMAKE_SYSTEM_PROCESSOR}") + find_package(HailoRT 4.18.0 EXACT REQUIRED) +- target_link_libraries(_pyhailort PRIVATE HailoRT::libhailort) ++ ++ include_directories("${HAILORT_PROJECT_SOURCE_DIR}/hailort/libhailort/include") ++ target_link_libraries(_pyhailort PRIVATE libhailort) + endif() + + if(WIN32) +diff --git a/hailort/libhailort/src/CMakeLists.txt b/hailort/libhailort/src/CMakeLists.txt +index 5136024403c5..8a3e9b8e0a50 100644 +--- a/hailort/libhailort/src/CMakeLists.txt ++++ b/hailort/libhailort/src/CMakeLists.txt +@@ -5,9 +5,6 @@ find_package(Threads REQUIRED) + include(GNUInstallDirs) + include(CMakePackageConfigHelpers) + include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/common_compiler_options.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/spdlog.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/readerwriterqueue.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/eigen.cmake) + + FUNCTION(relative_to_absolute_paths output) + SET(listVar "") +@@ -91,11 +88,11 @@ target_link_libraries(libhailort PRIVATE hef_proto) + target_link_libraries(libhailort PRIVATE profiler_proto) + target_link_libraries(libhailort PRIVATE scheduler_mon_proto) + target_link_libraries(libhailort PRIVATE spdlog::spdlog) +-target_link_libraries(libhailort PRIVATE readerwriterqueue) + target_link_libraries(libhailort PRIVATE Eigen3::Eigen) ++ + target_link_libraries(libhailort PRIVATE rpc_proto) + if(HAILO_BUILD_SERVICE) +- target_link_libraries(libhailort PRIVATE grpc++_unsecure) ++ target_link_libraries(libhailort PRIVATE gRPC::grpc++_unsecure) + target_link_libraries(libhailort PRIVATE hailort_rpc_grpc_proto) + endif() + if(CMAKE_SYSTEM_NAME STREQUAL QNX) +diff --git a/hailort/libhailort/src/network_group/network_group.cpp b/hailort/libhailort/src/network_group/network_group.cpp +index bc3de09bae4c..de1a2a06cd58 100644 +--- a/hailort/libhailort/src/network_group/network_group.cpp ++++ b/hailort/libhailort/src/network_group/network_group.cpp +@@ -27,6 +27,39 @@ + #include "utils/buffer_storage.hpp" + #include "hef/hef_internal.hpp" + ++namespace fmt { ++ // Add a formatter spec for BufferType ++ template <> ++ struct formatter { ++ constexpr auto parse(format_parse_context& ctx) { ++ return ctx.begin(); ++ } ++ ++ template ++ auto format(const hailort::BufferType& type, FormatContext& ctx) { ++ std::string type_str; ++ switch (type) { ++ case hailort::BufferType::UNINITIALIZED: ++ type_str = "UNINITIALIZED"; ++ break; ++ case hailort::BufferType::VIEW: ++ type_str = "VIEW"; ++ break; ++ case hailort::BufferType::PIX_BUFFER: ++ type_str = "PIX_BUFFER"; ++ break; ++ case hailort::BufferType::DMA_BUFFER: ++ type_str = "DMA_BUFFER"; ++ break; ++ default: ++ type_str = "UNKNOWN"; ++ break; ++ } ++ return fmt::format_to(ctx.out(), "{}", type_str); ++ } ++ }; ++} ++ + namespace hailort + { + +diff --git a/hailort/libhailort/src/utils/measurement_utils.hpp b/hailort/libhailort/src/utils/measurement_utils.hpp +index ae9e3fbfe8b5..6923c6d13e49 100644 +--- a/hailort/libhailort/src/utils/measurement_utils.hpp ++++ b/hailort/libhailort/src/utils/measurement_utils.hpp +@@ -87,7 +87,7 @@ + #define _HAILO_MEASUREMENT_UTILS_HPP_ + + #include "measurement_utils_internal.hpp" +-#include ++#include + + namespace hailort { + namespace utils { +diff --git a/hailort/libhailort/src/vdma/driver/hailort_driver.cpp b/hailort/libhailort/src/vdma/driver/hailort_driver.cpp +index 891eb92eb379..f7d3f1263f25 100755 +--- a/hailort/libhailort/src/vdma/driver/hailort_driver.cpp ++++ b/hailort/libhailort/src/vdma/driver/hailort_driver.cpp +@@ -25,6 +25,58 @@ + #error "unsupported platform!" + #endif + ++namespace fmt { ++ // Add a formatter spec for HailoRTDriver::PcieSessionType ++ template <> ++ struct formatter { ++ constexpr auto parse(format_parse_context& ctx) { ++ return ctx.begin(); ++ } ++ ++ template ++ auto format(const hailort::HailoRTDriver::PcieSessionType& type, FormatContext& ctx) { ++ std::string type_str; ++ switch (type) { ++ case hailort::HailoRTDriver::PcieSessionType::CLIENT: ++ type_str = "CLIENT"; ++ break; ++ case hailort::HailoRTDriver::PcieSessionType::SERVER: ++ type_str = "SERVER"; ++ break; ++ default: ++ type_str = "UNKNOWN"; ++ break; ++ } ++ return fmt::format_to(ctx.out(), "{}", type_str); ++ } ++ }; ++ ++ // Add a formatter spec for HailoRTDriver::DmaDirection ++ template <> ++ struct formatter { ++ constexpr auto parse(format_parse_context& ctx) { ++ return ctx.begin(); ++ } ++ ++ template ++ auto format(const hailort::HailoRTDriver::DmaBufferType& type, FormatContext& ctx) { ++ std::string type_str; ++ switch (type) { ++ case hailort::HailoRTDriver::DmaBufferType::USER_PTR_BUFFER: ++ type_str = "USER_PTR_BUFFER"; ++ break; ++ case hailort::HailoRTDriver::DmaBufferType::DMABUF_BUFFER: ++ type_str = "DMABUF_BUFFER"; ++ break; ++ default: ++ type_str = "UNKNOWN"; ++ break; ++ } ++ return fmt::format_to(ctx.out(), "{}", type_str); ++ } ++ }; ++} ++ + namespace hailort + { + +diff --git a/hailort/prepare_externals/CMakeLists.txt b/hailort/prepare_externals/CMakeLists.txt +index 6166c4ce4f0c..6f518610689f 100644 +--- a/hailort/prepare_externals/CMakeLists.txt ++++ b/hailort/prepare_externals/CMakeLists.txt +@@ -4,19 +4,8 @@ project(hailort_prebuild) + set(HAILO_EXTERNALS_EXCLUDE_TARGETS ON) + + message("Downloading dependencies to ${HAILO_EXTERNAL_DIR} ...") +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/pybind11.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/catch2.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/spdlog.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/json.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/dotwriter.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/benchmark.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/readerwriterqueue.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/eigen.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/cli11.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/protobuf.cmake) +-if(HAILO_BUILD_SERVICE) +- include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/grpc.cmake) +-endif() + if(CMAKE_SYSTEM_NAME STREQUAL QNX) + include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/pevents.cmake) + endif() +diff --git a/hailort/rpc/CMakeLists.txt b/hailort/rpc/CMakeLists.txt +index 7823cb57f0ba..c2a89df1de43 100644 +--- a/hailort/rpc/CMakeLists.txt ++++ b/hailort/rpc/CMakeLists.txt +@@ -12,7 +12,7 @@ set(hailort_rpc_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/hailort_rpc.grpc.pb.h") + set(HAILO_PROTOBUF_PROTOC $) + if(HAILO_BUILD_SERVICE) + if(CMAKE_HOST_UNIX) +- set(HAILO_GRPC_CPP_PLUGIN_EXECUTABLE "${HAILO_EXTERNAL_DIR}/grpc-build/grpc_cpp_plugin") ++ set(HAILO_GRPC_CPP_PLUGIN_EXECUTABLE "$") + else() + set(HAILO_GRPC_CPP_PLUGIN_EXECUTABLE "${HAILO_EXTERNAL_DIR}/grpc-build/Release/grpc_cpp_plugin.exe") + endif() +@@ -36,7 +36,7 @@ add_library(hailort_rpc_grpc_proto STATIC EXCLUDE_FROM_ALL + ${hailort_rpc_proto_hdrs}) + + set_target_properties(hailort_rpc_grpc_proto PROPERTIES POSITION_INDEPENDENT_CODE ON) +-target_link_libraries(hailort_rpc_grpc_proto libprotobuf-lite grpc++_unsecure) ++target_link_libraries(hailort_rpc_grpc_proto protobuf::libprotobuf-lite gRPC::grpc++_unsecure) + # Include generated *.pb.h files + target_include_directories(hailort_rpc_grpc_proto PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") + disable_exceptions(hailort_rpc_grpc_proto) +\ No newline at end of file diff --git a/meta-hailo/recipes-app/hailort/files/patches/0003-install-independent-of-build-target.patch b/meta-hailo/recipes-app/hailort/files/patches/0003-install-independent-of-build-target.patch new file mode 100644 index 000000000..3ac36d526 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0003-install-independent-of-build-target.patch @@ -0,0 +1,107 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Felix Moessbauer +Date: Sat, 13 Jan 2024 12:12:14 +0100 +Subject: [PATCH] install independent of build target + +Previously, cmake did only install the components when building the +Release target. However, the configuration should be selectable by the +user (or the distro). This patch removes this condition, so the user can +always install the currently built configuration. + +Signed-off-by: Felix Moessbauer +Signed-off-by: Li Hua Qian +--- + hailort/hailort_service/CMakeLists.txt | 3 --- + hailort/hailortcli/CMakeLists.txt | 1 - + hailort/libhailort/bindings/gstreamer/CMakeLists.txt | 2 +- + hailort/libhailort/bindings/python/src/CMakeLists.txt | 2 -- + hailort/libhailort/doc/CMakeLists.txt | 2 +- + hailort/libhailort/src/CMakeLists.txt | 1 - + 6 files changed, 2 insertions(+), 9 deletions(-) + +diff --git a/hailort/hailort_service/CMakeLists.txt b/hailort/hailort_service/CMakeLists.txt +index 4d3c52095f58..5f7facc48c0b 100644 +--- a/hailort/hailort_service/CMakeLists.txt ++++ b/hailort/hailort_service/CMakeLists.txt +@@ -52,7 +52,6 @@ if (UNIX) + install( + FILES "${HAILORT_SERVICE_ENV_VARS_FILE}" + DESTINATION "${ENV_VARS_FILE_DIR}" +- CONFIGURATIONS Release + COMPONENT hailort_service + ) + +@@ -61,7 +60,6 @@ if (UNIX) + install( + FILES "${HAILORT_SERVICE_UNIT_FILE}" + DESTINATION "${SYSTEMD_UNIT_DIR}" +- CONFIGURATIONS Release + COMPONENT hailort_service + ) + endif() +@@ -69,7 +67,6 @@ endif() + install( + TARGETS hailort_service + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- CONFIGURATIONS Release + ) + + set(DAEMON_PID_DIR "/run/hailo") +diff --git a/hailort/hailortcli/CMakeLists.txt b/hailort/hailortcli/CMakeLists.txt +index 1add7146af56..4a2d5e751802 100644 +--- a/hailort/hailortcli/CMakeLists.txt ++++ b/hailort/hailortcli/CMakeLists.txt +@@ -88,6 +88,5 @@ target_include_directories(hailortcli + + install(TARGETS hailortcli + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- CONFIGURATIONS Release + ) + cli11_install_completion_file(hailortcli) +\ No newline at end of file +diff --git a/hailort/libhailort/bindings/gstreamer/CMakeLists.txt b/hailort/libhailort/bindings/gstreamer/CMakeLists.txt +index 5a601802738a..012e17c4bfea 100644 +--- a/hailort/libhailort/bindings/gstreamer/CMakeLists.txt ++++ b/hailort/libhailort/bindings/gstreamer/CMakeLists.txt +@@ -61,4 +61,4 @@ install(TARGETS gsthailo + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + # TODO: get gstreamer-1.0 in an automate way + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/gstreamer-1.0/gst/hailo/" +- CONFIGURATIONS Release) ++) +diff --git a/hailort/libhailort/bindings/python/src/CMakeLists.txt b/hailort/libhailort/bindings/python/src/CMakeLists.txt +index 913716297564..4d25762df8d9 100644 +--- a/hailort/libhailort/bindings/python/src/CMakeLists.txt ++++ b/hailort/libhailort/bindings/python/src/CMakeLists.txt +@@ -99,6 +99,4 @@ add_dependencies(pyhailort_venv _pyhailort) + + install(TARGETS _pyhailort + LIBRARY DESTINATION ${HAILO_PYHAILORT_TARGET_DIR} +- CONFIGURATIONS Release + ) +- +diff --git a/hailort/libhailort/doc/CMakeLists.txt b/hailort/libhailort/doc/CMakeLists.txt +index 73d0964c5e6f..9f2ea9c2778c 100644 +--- a/hailort/libhailort/doc/CMakeLists.txt ++++ b/hailort/libhailort/doc/CMakeLists.txt +@@ -25,7 +25,7 @@ if(DOXYGEN_FOUND) + + install( + DIRECTORY "${DOXYGEN_OUTPUT_DIR}" DESTINATION "doc/" +- CONFIGURATIONS Release) ++ ) + + add_custom_target(doc ALL DEPENDS doxygen) + +diff --git a/hailort/libhailort/src/CMakeLists.txt b/hailort/libhailort/src/CMakeLists.txt +index 8a3e9b8e0a50..048fdd0ffe38 100644 +--- a/hailort/libhailort/src/CMakeLists.txt ++++ b/hailort/libhailort/src/CMakeLists.txt +@@ -163,7 +163,6 @@ target_compile_definitions(libhailort PUBLIC + + install(TARGETS libhailort + EXPORT HailoRTTargets +- CONFIGURATIONS Release + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/meta-hailo/recipes-app/hailort/files/patches/0004-install-python-bindings-into-dist-packages.patch b/meta-hailo/recipes-app/hailort/files/patches/0004-install-python-bindings-into-dist-packages.patch new file mode 100644 index 000000000..e20029fa1 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0004-install-python-bindings-into-dist-packages.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Felix Moessbauer +Date: Tue, 16 Jan 2024 16:28:15 +0100 +Subject: [PATCH] install python bindings into dist-packages + +This patch installs the hailort python bindings into the python +site-packages location, so python can automatically find this +dependency. + +Signed-off-by: Felix Moessbauer +Signed-off-by: Li Hua Qian +--- + .../bindings/python/src/CMakeLists.txt | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/hailort/libhailort/bindings/python/src/CMakeLists.txt b/hailort/libhailort/bindings/python/src/CMakeLists.txt +index 4d25762df8d9..b96d64a77895 100644 +--- a/hailort/libhailort/bindings/python/src/CMakeLists.txt ++++ b/hailort/libhailort/bindings/python/src/CMakeLists.txt +@@ -90,12 +90,19 @@ target_compile_options(_pyhailort PRIVATE ${HAILORT_COMPILE_OPTIONS}) + exclude_archive_libs_symbols(_pyhailort) + + # TODO (HRT-8637): change this hard-coded path +-set(HAILO_PYHAILORT_TARGET_DIR ${CMAKE_CURRENT_LIST_DIR}/../platform/hailo_platform/pyhailort/) ++if(WIN32) ++ set(HAILO_PYHAILORT_TARGET_DIR ${CMAKE_CURRENT_LIST_DIR}/../platform/hailo_platform/pyhailort/) ++else() ++ find_package(Python3 COMPONENTS Interpreter Development REQUIRED) ++ set(HAILO_PYHAILORT_TARGET_DIR "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/dist-packages/hailo_platform/pyhailort") ++endif() + +-add_custom_target(pyhailort_venv ALL +- COMMAND ${CMAKE_COMMAND} -E copy $ ${HAILO_PYHAILORT_TARGET_DIR} +-) +-add_dependencies(pyhailort_venv _pyhailort) ++if(WIN32) ++ add_custom_target(pyhailort_venv ALL ++ COMMAND ${CMAKE_COMMAND} -E copy $ ${HAILO_PYHAILORT_TARGET_DIR} ++ ) ++ add_dependencies(pyhailort_venv _pyhailort) ++endif() + + install(TARGETS _pyhailort + LIBRARY DESTINATION ${HAILO_PYHAILORT_TARGET_DIR} diff --git a/meta-hailo/recipes-app/hailort/files/patches/0005-Fix-cross-compilation-issue-for-pybuild.patch b/meta-hailo/recipes-app/hailort/files/patches/0005-Fix-cross-compilation-issue-for-pybuild.patch new file mode 100644 index 000000000..ec657e68c --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0005-Fix-cross-compilation-issue-for-pybuild.patch @@ -0,0 +1,138 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Li Hua Qian +Date: Tue, 12 Nov 2024 16:56:33 +0800 +Subject: [PATCH] Fix cross-compilation issue for pybuild + +This patch fix the pybuild cross-comiplation issue. Since it is not +possible to use the previous intermediate artifacts in Isar, we rebuild +the libhailort in pybuild. + +Signed-off-by: Li Hua Qian +--- + hailort/libhailort/CMakeLists.txt | 3 ++ + .../bindings/python/src/CMakeLists.txt | 16 ++++++++- + hailort/libhailort/src/CMakeLists.txt | 35 ++++++++++++++++++- + 3 files changed, 52 insertions(+), 2 deletions(-) + +diff --git a/hailort/libhailort/CMakeLists.txt b/hailort/libhailort/CMakeLists.txt +index ab46f83483ad..259debb87301 100644 +--- a/hailort/libhailort/CMakeLists.txt ++++ b/hailort/libhailort/CMakeLists.txt +@@ -27,6 +27,9 @@ target_include_directories(hef_proto + $ + ) + ++if(NOT HAILO_BUILD_PROFILER) ++ option(HAILO_BUILD_PROFILER "Build hailort profiler" ON) ++endif() + if(HAILO_BUILD_PROFILER) + add_definitions( -DHAILO_ENABLE_PROFILER_BUILD ) + endif() +diff --git a/hailort/libhailort/bindings/python/src/CMakeLists.txt b/hailort/libhailort/bindings/python/src/CMakeLists.txt +index b96d64a77895..920c9395fd97 100644 +--- a/hailort/libhailort/bindings/python/src/CMakeLists.txt ++++ b/hailort/libhailort/bindings/python/src/CMakeLists.txt +@@ -15,6 +15,14 @@ include(ExternalProject) + include(GNUInstallDirs) + include_directories(${HAILORT_COMMON_DIR}) + ++if(NOT Protobuf_FOUND) ++ find_package(Protobuf REQUIRED) ++endif() ++if(NOT TARGET libhailort) ++ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../hrpc_protocol/ ${CMAKE_BINARY_DIR}/rpc_proto) ++ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../ ${CMAKE_BINARY_DIR}/libhailort) ++endif() ++ + FUNCTION(exclude_archive_libs_symbols target) # should be same as in common_compiler_options.cmake + if(WIN32) + # TODO: check if there are required actions for Windows +@@ -71,10 +79,16 @@ elseif(LIBHAILORT_PATH OR HAILORT_INCLUDE_DIR) + else() + message(STATUS "skip find_package, CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}") + message(STATUS "CMAKE_SYSTEM_PROCESSOR is ${CMAKE_SYSTEM_PROCESSOR}") +- find_package(HailoRT 4.18.0 EXACT REQUIRED) + + include_directories("${HAILORT_PROJECT_SOURCE_DIR}/hailort/libhailort/include") + target_link_libraries(_pyhailort PRIVATE libhailort) ++ target_compile_definitions( ++ _pyhailort ++ PUBLIC ++ HAILORT_MAJOR_VERSION=4 ++ HAILORT_MINOR_VERSION=18 ++ HAILORT_REVISION_VERSION=0 ++ ) + endif() + + if(WIN32) +diff --git a/hailort/libhailort/src/CMakeLists.txt b/hailort/libhailort/src/CMakeLists.txt +index 048fdd0ffe38..10809b150694 100644 +--- a/hailort/libhailort/src/CMakeLists.txt ++++ b/hailort/libhailort/src/CMakeLists.txt +@@ -38,7 +38,7 @@ if(HAILO_BUILD_SERVICE) + add_subdirectory(service) + endif() + +-set(common_dir "${PROJECT_SOURCE_DIR}/common/src") ++set(common_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../../common/src") + set(COMMON_C_SOURCES + ${common_dir}/firmware_status.c + ${common_dir}/md5.c +@@ -64,6 +64,12 @@ set(HAILORT_SRCS_ABS ${HAILORT_CPP_SOURCES} ${HAILORT_COMMON_CPP_SOURCES} ${COMM + SET_SOURCE_FILES_PROPERTIES(${C_SOURCES} PROPERTIES LANGUAGE CXX) + add_library(libhailort SHARED ${HAILORT_SRCS_ABS}) + ++if(NOT DEFINED FIRMWARE_VERSION_MAJOR) ++ add_definitions( -DFIRMWARE_VERSION_MAJOR=4 ) ++ add_definitions( -DFIRMWARE_VERSION_MINOR=18 ) ++ add_definitions( -DFIRMWARE_VERSION_REVISION=0 ) ++endif() ++ + # Include libraries + if(WIN32) + target_link_libraries(libhailort PRIVATE +@@ -87,7 +93,13 @@ target_link_libraries(libhailort PRIVATE Threads::Threads) + target_link_libraries(libhailort PRIVATE hef_proto) + target_link_libraries(libhailort PRIVATE profiler_proto) + target_link_libraries(libhailort PRIVATE scheduler_mon_proto) ++if(NOT spdlog_FOUND) ++ find_package(spdlog REQUIRED) ++endif() + target_link_libraries(libhailort PRIVATE spdlog::spdlog) ++if(NOT Eigen3_FOUND) ++ find_package(Eigen3 REQUIRED) ++endif() + target_link_libraries(libhailort PRIVATE Eigen3::Eigen) + + target_link_libraries(libhailort PRIVATE rpc_proto) +@@ -143,6 +155,27 @@ target_compile_options(libhailort PRIVATE ${HAILORT_COMPILE_OPTIONS}) + disable_exceptions(libhailort) + exclude_archive_libs_symbols(libhailort) + ++if(NOT HAILORT_INC_DIR) ++ set(HAILORT_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../include") ++endif() ++if(NOT HAILORT_COMMON_DIR) ++ set(HAILORT_COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../") ++endif() ++if(NOT HAILORT_SRC_DIR) ++ set(HAILORT_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}") ++endif() ++if(NOT COMMON_INC_DIR) ++ set(COMMON_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../common/include") ++endif() ++if(NOT DRIVER_INC_DIR) ++ set(DRIVER_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../drivers/common") ++endif() ++if(NOT RPC_DIR) ++ set(RPC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../rpc") ++endif() ++if(NOT HRPC_DIR) ++ set(HRPC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../hrpc") ++endif() + target_include_directories(libhailort + PUBLIC + $ +-- +2.34.1 + diff --git a/meta-hailo/recipes-app/hailort/hailort_4.18.0.bb b/meta-hailo/recipes-app/hailort/hailort_4.18.0.bb new file mode 100644 index 000000000..454967057 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/hailort_4.18.0.bb @@ -0,0 +1,52 @@ +# SPDX-FileCopyrightText: Copyright 2023-2024 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +DESCRIPTION = "userspace API for running inference on the hailo8 chip" + +LICENSE = "MIT" + +inherit dpkg + +HAILO_EXTERNAL_DIR = "${P}/hailort/external" + +SRC_URI = " \ + git://git@github.com/hailo-ai/hailort.git;protocol=https;branch=master;name=hailort;destsuffix=${P} \ + git://github.com/hailo-ai/CLI11.git;protocol=https;nobranch=1;name=cli11;destsuffix=${HAILO_EXTERNAL_DIR}/cli11-src \ + git://github.com/hailo-ai/DotWriter.git;protocol=https;nobranch=1;name=dotwriter;destsuffix=${HAILO_EXTERNAL_DIR}/dotwriter-src" +SRC_URI += " \ + file://patches/0001-do-not-use-spdlog-formatting-internals.patch \ + file://patches/0002-use-distro-version-of-packages-if-possible.patch \ + file://patches/0003-install-independent-of-build-target.patch \ + file://patches/0004-install-python-bindings-into-dist-packages.patch \ + file://patches/0005-Fix-cross-compilation-issue-for-pybuild.patch \ +" + +SRC_URI += " \ + file://debian/control \ + file://debian/hailort.install \ + file://debian/hailort.service \ + file://debian/hailortcli.install \ + file://debian/libhailort-dev.install \ + file://debian/libhailort.install \ + file://debian/python3-hailort.install \ + file://debian/libgsthailo.install \ + file://debian/libgsthailo-dev.install \ + file://debian/not-installed \ + file://debian/rules \ + file://debian/libhailort.so.4.18.0 \ +" + +DEPENDS += "python3-verboselogs" +PROVIDES += "hailortcli libhailort libhailort-dev python3-hailort libgsthailo libgsthailo-dev" + +SRCREV_hailort = "01e4c7f5a7463cc61ef1b2d22c31dd80a3a07d95" +SRCREV_cli11 = "ae78ac41cf225706e83f57da45117e3e90d4a5b4" +SRCREV_dotwriter = "e5fa8f281adca10dd342b1d32e981499b8681daf" + +S = "${WORKDIR}/${P}" + +do_prepare_build[cleandirs] += "${S}/debian" +do_prepare_build() { + deb_debianize + rm -f ${S}/debian/compat + cp -r ${WORKDIR}/debian/* ${S}/debian/ +} diff --git a/meta-hailo/recipes-bsp/hailo-firmware/hailo-firmware_4.18.0.bb b/meta-hailo/recipes-bsp/hailo-firmware/hailo-firmware_4.18.0.bb new file mode 100644 index 000000000..e6189e98e --- /dev/null +++ b/meta-hailo/recipes-bsp/hailo-firmware/hailo-firmware_4.18.0.bb @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: Copyright 2023 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +DESCRIPTION = "hailo firmware - hailo8 chip firmware (hailo_fw.bin)" + +BASE_URI = "https://hailo-hailort.s3.eu-west-2.amazonaws.com" +FW_AWS_DIR = "Hailo8/${PV}/FW" +FW = "hailo8_fw.${PV}.bin" +LICENSE_FILE = "LICENSE" + +SRC_URI = "${BASE_URI}/${FW_AWS_DIR}/${FW};name=firmware \ + ${BASE_URI}/${FW_AWS_DIR}/${LICENSE_FILE};name=license" +SRC_URI[firmware.sha256sum] = "bfa576dd782359d74cabcb19e87c3a934dce03dea0785e41f86fecc9a687a92b" +SRC_URI[license.md5sum] = "263ee034adc02556d59ab1ebdaea2cda" + +LICENSE = "LICENSE" +LIC_FILES_CHKSUM = "file://${WORKDIR}/${LICENSE_FILE};md5=263ee034adc02556d59ab1ebdaea2cda" + +FW_PATH = "${WORKDIR}/${FW}" + +DPKG_ARCH = "all" + +inherit dpkg-raw + +do_install() { + # Stores hailo8_fw.bin in the rootfs under /lib/firmware/hailo/ + install -d ${D}/lib/firmware/hailo + install -m 0644 ${FW_PATH} ${D}/lib/firmware/hailo/hailo8_fw.bin +} diff --git a/meta-hailo/recipes-core/images/hailo-image-ci.bb b/meta-hailo/recipes-core/images/hailo-image-ci.bb new file mode 100644 index 000000000..c9aa0e95b --- /dev/null +++ b/meta-hailo/recipes-core/images/hailo-image-ci.bb @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: Copyright 2024 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +inherit image + +DESCRIPTION = "CI test image for HAILO" + +IMAGE_INSTALL += " \ + hailo-pci-${KERNEL_NAME} \ + hailo-firmware \ + hailortcli \ + python3-hailort \ +" diff --git a/meta-hailo/recipes-kernel/hailo-pci/hailo-pci_4.18.0.bb b/meta-hailo/recipes-kernel/hailo-pci/hailo-pci_4.18.0.bb new file mode 100644 index 000000000..0d6fea739 --- /dev/null +++ b/meta-hailo/recipes-kernel/hailo-pci/hailo-pci_4.18.0.bb @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: Copyright 2023 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +DESCRIPTION = "hailo pcie driver - the kernel driver for pci communication with hailo8" + +LICENSE = "gpl-2.0" +LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe" + +SRC_URI = "git://git@github.com/hailo-ai/hailort-drivers.git;protocol=https;branch=master" +SRCREV = "7161f9ee5918029bd4497f590003c2f87ec32507" + +require recipes-kernel/linux-module/module.inc + +S = "${WORKDIR}/git" +MODULE_DIR = "$(PWD)/linux/pcie" + +do_prepare_build:append() { + cp ${S}/linux/pcie/51-hailo-udev.rules ${S}/debian/${BPN}.udev +} diff --git a/meta-hailo/recipes-python/python-verboselogs/files/debian/control b/meta-hailo/recipes-python/python-verboselogs/files/debian/control new file mode 100644 index 000000000..ccee6b70f --- /dev/null +++ b/meta-hailo/recipes-python/python-verboselogs/files/debian/control @@ -0,0 +1,22 @@ +Source: python-verboselogs +Section: python +Priority: optional +Maintainer: Felix Moessbauer +Build-Depends: debhelper-compat (= 13), + dh-python, + python3-setuptools (>=42), + libpython3-all-dev (>=3.2), + python3-all-dev:any (>=3.2), + python3-wheel:native, +Standards-Version: 4.6.1 +Homepage: https://verboselogs.readthedocs.io/ +Vcs-Browser: https://github.com/xolox/python-verboselogs +Vcs-Git: https://github.com/xolox/python-verboselogs.git +Rules-Requires-Root: no + +Package: python3-verboselogs +Architecture: all +Multi-Arch: foreign +Depends: ${python3:Depends}, ${misc:Depends} +Description: extends Pythons logging module to add the log levels + The levels NOTICE, SPAM, SUCCESS and VERBOSE are added diff --git a/meta-hailo/recipes-python/python-verboselogs/files/debian/rules b/meta-hailo/recipes-python/python-verboselogs/files/debian/rules new file mode 100644 index 000000000..a6e3156fe --- /dev/null +++ b/meta-hailo/recipes-python/python-verboselogs/files/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +export PYBUILD_NAME=verboselogs + +%: + dh $@ --with python3 --buildsystem=pybuild diff --git a/meta-hailo/recipes-python/python-verboselogs/python-verboselogs_1.7.bb b/meta-hailo/recipes-python/python-verboselogs/python-verboselogs_1.7.bb new file mode 100644 index 000000000..eb2a53a05 --- /dev/null +++ b/meta-hailo/recipes-python/python-verboselogs/python-verboselogs_1.7.bb @@ -0,0 +1,30 @@ +# SPDX-FileCopyrightText: Copyright 2024 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License + +# Warning: This package seems abandoned. Latest commit is from 7 years ago + +inherit dpkg + +SRC_URI = "git://github.com/xolox/python-verboselogs.git;protocol=https;branch=master" +SRCREV ="3cebc69e03588bb6c3726c38c324b12732989292" + +SRC_URI += " \ + file://debian/control \ + file://debian/rules \ +" + +S = "${WORKDIR}/git" + +PROVIDES += "python3-verboselogs" + +DEB_BUILD_PROFILES = "nocheck" +DEB_BUILD_OPTIONS = "nocheck" + +do_prepare_build[cleandirs] += "${S}/debian" +do_prepare_build() { + deb_debianize + rm -f ${S}/debian/compat + cp ${WORKDIR}/debian/control \ + ${WORKDIR}/debian/rules \ + ${S}/debian/ +} diff --git a/recipes-core/images/iot2050-image-example.bb b/recipes-core/images/iot2050-image-example.bb index a3195aa83..08617e60e 100644 --- a/recipes-core/images/iot2050-image-example.bb +++ b/recipes-core/images/iot2050-image-example.bb @@ -43,6 +43,15 @@ IMAGE_INSTALL += " \ tee-supplicant \ iot2050-event-record \ linux-headers-${KERNEL_NAME} \ + hailo-pci-${KERNEL_NAME} \ + hailo-firmware \ + hailortcli \ + libhailort \ + libhailort-dev \ + libgsthailo \ + libgsthailo-dev \ + python3-hailort \ + hailort \ " IOT2050_NODE_RED_SUPPORT ?= "1"