软件准备

所需镜像/代码版本

  • Debian12(202409)
  • debian-deb (为适配hailo所需更新的Debian内核包等文件)
  • Tappas(v3.30.0,daffd36ecab5110d47107255fd7ec4c779758f2e
  • HailoRT(v4.19.0,ac19e12b86170e1b0967e7d8aa607a0100cb0077
  • HailoRT-driver(v4.19.0,eb2a8649752abd424c6d2e5109e9ec92d6d2d5f6
  • Hailort与Tappas补丁(用于适配昉·星光 2的HailoRT与Tappas补丁)
  • NpuDetectorLib demo

镜像烧录/依赖库安装

  1. 请参考该链接,将Debian烧录到SD卡。
    注: 后续操作建议均在user用户下操作,避免root下操作导致权限异常。
  2. 更新内核、头文件等:
    1. 执行以下命令,下载并解压hailort-deb-1.tar.gz文件:
      $ tar -xzvf hailort-deb-1.tar.gz
    2. 执行以下命令,更新u-boot-menu:
      $ cd hailort-deb
      $ sudo dpkg -i u-boot-menu_4.2.2-SF113_all.deb
    3. 执行以下命令,更新内核、头文件、libc库以及VPU驱动:
      $ cd 6.6
      $ sudo dpkg -i ./*
    4. 执行以下命令,重启系统:
      $ sudo reboot
  3. 执行以下命令,安装编译环境依赖:
    $ sudo apt install make cmake automake build-essential autoconf bc bison meson flex wget curl git git-lfs libgirepository1.0-dev gcc g++ rsync x11-utils -y
  4. 安装Python环境。安装python3-platformdirs,新版本Snapshot不支持低于3.0版本的python3-platformdirs,需要手动获取并安装:
    $ wget https://snapshot.debian.org/archive/debian/20221210T034654Z/pool/main/p/platformdirs/python3-platformdirs_2.6.0-1_all.deb && sudo dpkg -i python3-platformdirs_2.6.0-1_all.deb
    $ sudo apt install python3.11 python3.11-dev  python3-setuptools python3-virtualenv python3-pip python-gi-dev -y
  5. 执行以下命令,安装GStreamer相关库:
    $ sudo apt install libgstreamer-plugins-bad1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev -y
  6. 执行以下命令,安装OpenCV与GStreamer插件:
    $ sudo apt install libopencv*-dev libssl-dev pciutils libcairo2-dev libzmq3-dev gstreamer1.0-tools -y
  7. 执行以下命令,安装Rust:
    注: 编译pydantic等包时需要该语言。
    $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    如下图所示,弹出Rust安装选项时,请选择选项1:
    1. 选择选项1
    完成安装后,添加Rust的环境变量:
    $ source "$HOME/.cargo/env"
  8. 执行以下命令,指定python3为python3.11:
    $ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1

获取源码并应用补丁

  • 执行以下命令,获取Tappas源码并应用:
    $ git clone https://github.com/hailo-ai/tappas.git
    $ cd tappas
    $ git checkout daffd36ecab5110d47107255fd7ec4c779758f2e
    $ cp path_to_hailo_patches/tappas_h8l/* ./
    $ git apply 0001-Added-tappas-adaptation-to-VisionFive2.patch
    $ git apply 0002-Add-demo-for-h8l-on-vf2.patch
  • 执行以下命令,获取HailoRT源码并应用:
    注: 请拉取并存放在tappas路径下,便于后续Tappas编译。
    $ mkdir -p tappas/hailort
    $ cd tappas/hailort
    $ git clone https://github.com/hailo-ai/hailort.git sources
    $ cd source
    $ git checkout ac19e12b86170e1b0967e7d8aa607a0100cb0077
    $ cp path_to_hailo_patches/0001-Added-HailoRT-adaptation-to-VisionFive2.patch ./
    $ git apply 0001-Added-HailoRT-adaptation-to-VisionFive2.patch
  • 执行以下命令,获取HailoRT-drivers源码并应用:
    $ cd ~
    $ git clone https://github.com/hailo-ai/hailort-drivers.git
    $ cd hailort-driver
    $ git checkout eb2a8649752abd424c6d2e5109e9ec92d6d2d5f6