组织介绍

声明

1. 该仓库适配的是香橙派OrangePi AI Studio Pro与极摩客 K11 MiniPC设备,其他设备未使用过,使用时请注意区分
2. 该仓库适配的系统为ubuntu22.04,使用时请确认自己的系统是否为ubuntu22.04

设备推荐

  1. 极摩客 M7 MiniPC:AMD R7-6850H CPU 64GB 内存。

alt text

  1. 极摩客 K11 MiniPC:AMD R9-8945HS CPU 96GB 内存。

alt text

需要的配件

  1. USB4 数据线

    此类数据线一般兼容雷电 4 接口,最大传输速率 40Gbps,用于将OPi AI Studio Pro连接到具有USB4 或者雷电 4 接口的电脑。

    注意:Type-C USB3.x 规格的数据线是无法使用的,必须要用USB4 规格的数据线。
  2. 带有USB4或者雷电4接口的x86_64电脑

    OPi AI Studio Pro 只能通过 USB4 接口接到电脑使用,所以请准备一台具有 USB4 或者雷电 4 接口的电脑。

    注意:
    1. Type-C USB3.x接口的电脑是不能用的,因为USB3.x接口中没有PCIe隧道功能。必须要具有USB4 或者雷电 4 接口的电脑,不推荐使用雷电 3 接口的电脑,因为雷电 3 接口电脑中的雷电控制器固件版本一般比较低,无法识别到OPi AIStudio Pro。
    2. 不是所有具有雷电 4 接口和USB4 接口的电脑就一定能正常识别 OPi AI Studio Pro,对电脑要求的详细说明请下载官方手册查看说明

    香橙派官方网址:http://www.orangepi.cn/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-AI-Studio-Pro.html

  3. Ubuntu22.04系统

    目前 310P NPU 驱动包适配的最新 Ubuntu 系统为 Ubuntu22.04

    ubuntu镜像官方网址1: https://releases.ubuntu.com/jammy

    ubuntu22.04镜像下载链接1: https://releases.ubuntu.com/jammy/ubuntu-22.04.5-desktop-amd64.iso

    ubuntu镜像网址2: https://mirrors.ustc.edu.cn/ubuntu-releases/22.04.5

    ubuntu22.04镜像下载链接2: https://mirrors.ustc.edu.cn/ubuntu-releases/22.04.5/ubuntu-22.04.5-desktop-amd64.iso

  4. Linux-5.15 内核

    (1) 安装适配的内核版本Linux-5.15

    sudo apt update
    sudo apt install -y dkms net-tools gcc g++ make cmake pigz pciutils vim dos2unix unrar python3 python3-pip git-lfs git curl wget
    sudo apt install -y linux-image-5.15.0-126-generic linux-modules-extra-5.15.0-126-generic
    sudo apt install -y linux-headers-5.15.0-126 linux-headers-5.15.0-126-generic

    (2) 设置Linux-5.15内核为默认启动项
    a.打开/etc/default/grub 文件,并找到GRUB_DEFAULT设置,并将GRUB_DEFAULT设置为"Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-126-generic"

    打开并编辑/etc/default/grub

    sudo apt update
    sudo apt install -y nano #或者sudo apt install -y vim
    sudo nano /etc/default/grub #或者sudo vim /etc/default/grub
    GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-126-generic"

    更新GRUB配置

    sudo update-grub
    #重启设备使内核生效
    reboot

    重启设备后使用下面命令查看当前内核版本

    uname -r

    b. 如 果 电 脑 使 用 的 USB4 接 口 或 者 雷 电 4 接 口 , 还 需 要 在 GRUB 中 禁 用 下Thunderbolt 内核模块,不然当电脑接着 OPi AI Studio Pro 启动时会报 PCIe 相关的错误。

    打开并编辑/etc/default/grub文件

    sudo nano /etc/default/grub #或者sudo vim /etc/default/grub

    在 GRUB_CMDLINE_LINUX 中加入 modprobe.blacklist=thunderbolt 配置GRUB_CMDLINE_LINUX_DEFAULT="quiet splash modprobe.lacklist=thunderbolt"

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash modprobe.blacklist=thunderbolt"

    更新GRUB配置并重启

    sudo update-grub
    sudo reboot
    注意:
    由于Ubuntu 22.04 的Linux5.15 内核不是最新的,有些电脑的功能,比如触摸板,会由于驱动没有适配无法使用,此时需要自行适配对应的驱动或者换一台电脑再试下。
  5. 将用户设置为免密模式

    1. 打开visudo文件
    sudo visudo
    1. 在打开的文件末尾添加下面内容。(注意:一定是文件末尾,不然会被其他设置重置)
    username ALL=(ALL) NOPASSWD: ALL  # 替换username为你的用户名
    1. 保存退出(Ctrl+s,Ctrl+x;或者Ctrl+o->enter,Ctrl+x),随便打开一个终端使用sudo命令查看是否生效
    sudo top # 可换成其他命令,只要不提示输入密码即可
  6. 配置清华源

    1. 配置镜像清华源

      a. 备份原文件

      sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak

      b. 新建并编辑/etc/apt/sources.list文件

      sudo nano /etc/apt/sources.list

      c. 在/etc/apt/sources.list文件中添加下面内容

      # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
      # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
      # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
      # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
      
      # 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
      deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
      # deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
      
      # 预发布软件源,不建议启用
      # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
      # # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

      d.保存并退出(Ctrl+s,Ctrl+x),然后更新与升级软件仓

      sudo apt update
      sudo apt upgrade
    2. 配置PyPI(python/pip)清华源

      a. 打开终端并输入如下命令

      pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

      注意:若pip升级了,请再次执行该命令,避免设置被重置

  7. 启动OPi AI Studio Pro

    1. 首先确保 Ubuntu 电脑处于关机状态
    2. 然后使用 USB4 数据线将 OPi AI Studio Pro 连接到电脑的 USB4 或者雷电 4 接口中。 alt text
    3. 然后插入 OPi AI Studio Pro 的 DC 电源 alt text
    4. 打开 OPi AI Studio Pro 的电源开关 alt text
    5. 启动 Ubuntu22.04 电脑,进入系统后等待一段时间,使用 lspci 命令查看ASMedia 相关信息和 OPi AI Studio Pro 的 PCIe 设备信息
    lspci | grep ASMedia

    06:00.0 PCI bridge: ASMedia Technology Inc. Device 2464

    07:00.0 PCI bridge: ASMedia Technology Inc. Device 2464

    lspci | grep Huawei

    08:00.0 Processing accelerators: Huawei Technologies Co., Ltd. Device d500 (rev 23)

    注意:如果先启动Ubuntu电脑,再打开OPi AI Studio Pro的电源会导致电脑无法正常识别到OPi AI Studio Pro的PCIe设备。

Linux环境拉取代码

  1. 更新需要的软件库与依赖
sudo apt update
sudo apt install -y  dkms net-tools gcc g++ make cmake pigz pciutils vim dos2unix unrar python3 python3-pip git-lfs git curl wget
echo "alias python=python3" >> ~/.bashrc
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
pip install --upgrade pip
  1. 配置git
# 设置全局用户名
git config --global user.name "你的姓名"

# 设置全局邮箱
git config --global user.email "你的邮箱"
  1. 配置repo

打开"Git Bash",输入如下命令下载repo(使用如下命令前请确保python3已下载),

mkdir -p ~/tools/bin
curl -L https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o ~/tools/bin/repo
chmod +x ~/tools/bin/repo
pip3 install requests
echo "export REPO_PATH=~/tools/bin" >> ~/.bashrc
echo "export PATH=\$REPO_PATH:\$PATH"  >> ~/.bashrc
echo "export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'" >> ~/.bashrc
source ~/.bashrc
  1. 代码拉取

    新建一个目录,名字自己命名

    mkdir -p ~/origange #名字可改成自己的,也可以直接用该名字

    执行如下命令拉取代码

    # http下载
    cd ~/origange
    yes | repo init -u https://gitee.com/li_orangepi/user.git
    repo sync -c -j20
    repo forall -c 'git lfs pull'
    # ssh下载
    cd ~/origange
    yes | repo init -u git@gitee.com:li_orangepi/user.git
    repo sync -c -j20
    repo forall -c 'git lfs pull'
  2. 一键安装环境

    进入origange目录(自己新建的那个目录),并运行安装脚本

    cd ~/origange
    sudo ./setup/build.sh
    注意:安装过程中请不要退出,否则会存在文件下载不完整导致安装失败,若中途退出了安装,请执行如下命令再继续安装:
    cd ~/origange
    sudo rm -rf software
    sudo ./setup/build.sh

    执行完该步骤会拉取与下载驱动和基础软件包,并自动安装与更新,若安装完之后,或在安装出现错误,请查看官方文档:https://gitee.com/li_orangepi/doc

  3. 若安装过程中没有出现错误,重启设备加载驱动

    reboot
成就
0
Star
0
Fork
成员(1)
lixingfu

搜索帮助