Ultra96安装指导和无线配置

    科技2022-07-21  126

    目 录

    一、开发板接口 1 二、镜像文件 2 三、DNNDK解压缩文件 3 四、安装与授权 4 五、ssh和resolv.conf配置 5 5.1 ssh配置 5 5.2 ping地址测试 6 5.3增加域名服务器 7 5.4 ping域名测试 7 六、有线配置方法 7 6.1 Interfaces配置 7 6.2 使用MobaXterm工具 9 6.3 使用命令行 10 七、四种无线配置方法 10 7.1 初始配置wifi 10 7.1.1 Interfaces地址文件 10 7.1.2 配置wap_supplicant.conf文件 12 7.2 设置启动脚本 13 7.3 单次启动wicd-cureses 14 7.4 命令行启动 14 7.5 手机热点 15 7.5.1 计算机侧设置 15 7.5.2开发板侧设置 16 7.6 热点连接 17 八、图像的本地显示 17 九、安装镜像源: 18 十、环境变量添加: 19 十一、SD卡扩容: 20 十二、交叉编译环境: 20

    一、开发板接口

    Ultra96v2:

    Ultra96v1:

    注意USB3.0接口形式

    这一页让你搞清所有规格USB接口_主板新闻-中关村在线 http://mb.zol.com.cn/514/5147157.html

    二、镜像文件

    PYNQ - Python productivity for Zynq - Board http://www.pynq.io/board.html PYNQ-Z2 v2.5 PYNQ image Ultra96 PYNQ documentation AI Developer Hub https://www.xilinx.com/products/design-tools/ai-inference/ai-developer-hub.html#edge

    https://coldnew.github.io/f4865ec/ 博客介绍了硬体

    Zedboard http://zedboard.org/support/design/24166/156

    三、DNNDK解压缩文件

    john@john-virtual-machine:~$ tar zxvf xilinx_dnndk_v3.1_190809.tar.gz john@john-virtual-machine:~$ cd xilinx_dnndk_v3.1 john@john-virtual-machine:~/xilinx_dnndk_v3.1$ tar zxvf xilinx_ai_sdk_v2.0.5.tar.gz

    Please check for updates. https://www.xilinx.com/products/design-tools/ai-inference/ai-developer-hub.html#edge

    SDK directory structure introduction ------------------------------------

    ├── ai_sdk_install.sh #sdk install script for host ├── doc │ ├── ug1354-xilinx-ai-sdk-user-guide.pdf #ug1354 document │ └── ug1355-xilinx-ai-sdk-programming-guide.pdf #ug1355 ducument ├── README #README file ├── Ultra96 │ └── xilinx_ai_model_Ultra96_2019.1-r1.deb #model install packet for Ultra96 ├── xilinx_ai_sdk #AI sdk all source directory │ ├── cmake-3.12 #cmake config files │ ├── config #AI model config file │ ├── demo #demo directory, including classification, squeezenet, ssd, yolov3, seg_and_pose_detect and segs_roadline_detect │ ├── include #the header files required by the SDK │ ├── libsrc #AI lib open source code │ └── samples #AI lib test samples ├── xilinx_ai_sdk_2019.1-r1.deb #sdk install packet for the target, including ZCU102, ZCU104 and Ultra96 ├── ZCU102 │ └── xilinx_ai_model_ZCU102_2019.1-r1.deb #model install packet for ZCU102 └── ZCU104 └── xilinx_ai_model_ZCU104_2019.1-r1.deb #model install packet for ZCU104

    四、安装与授权

    Caffe Version: Installing Dependent Libraries Run the following command to install the dependent libraries required by Caffe v1.0. $ apt-get install -y --force-yes build-essential autoconf libtool libopenblasdev libgflags-dev libgoogle-glog-dev libopencv-dev protobuf-compiler libleveldbdev liblmdb-dev libhdf5-dev libsnappy-dev libboost-all-dev libssl-dev

    TensorFlow Version: Installing with Anaconda 取系统自带

    root@xilinx-ultra96-v2019:~/Ultra96# sudo ./install.sh sudo: ./install.sh: command not found root@xilinx-ultra96-v2019:~/Ultra96# chmod 777 ./*.sh root@xilinx-ultra96-v2019:~/Ultra96# ./install.sh Begin to install Xilinx DNNDK … Install DPU Driver … root@xilinx-ultra96-v2019:~# tar zxvf xilinx_ai_sdk_v2.0.5.tar.gz -C /

    root@xilinx-ultra96-v2019:~/Ultra96# ./install.sh root@xilinx-ultra96-v2019:~/Ultra96# chmod a+x /usr/local/bin/dexplorer root@xilinx-ultra96-v2019:~/Ultra96# chmod a+x /usr/local/bin/dsight root@xilinx-ultra96-v2019:~/Ultra96# dexplorer -v DNNDK version 3.1 Copyright @ 2018-2019 Xilinx Inc. All Rights Reserved.

    DExplorer version 2.0 Build Label: Aug 7 2019 18:28:41

    DSight version 1.4 Build Label: Aug 7 2019 18:28:42 sh: /usr/local/bin/ddump: Permission denied

    ddump -v N2Cube Core library version 3.0 Build Label: Aug 7 2019 18:28:37

    DPU Driver version 3.0.0 Build Label: Aug 7 2019 18:28:16

    五、ssh和resolv.conf配置

    5.1 ssh配置

    1、 确认ssh服务已安装,通过普通用户连接成功, service ssh status systemctl status ssh

    下面是scp拷贝命令。 #scp XILINX_AI_SDK-ZCU102.tar.gz root@IP_OF_CARD:~/

    2、ssh远端显示配置 #cat /etc/ssh/sshd_config X11Forwarding yes X11UseLocalhost no – 禁止将X11转发请求绑定到本地回环地址上 AddressFamily inet – 强制使用IPv4通道

    3、确认ssh配置对root进行特殊设置,修改/etc/ssh/sshd_config文件中 PermitRootLogin without-password将 without-password改为yes。

    4、重启ssh服务/etc/init.d/ssh restart。 #systemctl restart sshd.service #systemctl restart sshd

    5.2 ping地址测试 5.3增加域名服务器 编辑域名服务器 vi /etc/resolvconf/run/resolv.conf dns-nameservers 8.8.8.8

    亦可在/etc/network/interfaces文件中设置。

    5.4 ping域名测试

    六、有线配置方法

    硬件使用以下USB以太网卡进行连接

    6.1 Interfaces配置 route print netstat -nr tracert

    netsh interface ip set address “以太网” static 192.168.1.7 255.255.255.0 192.168.1.1 1 auto: the interface should be configured during boot time. iface : interface inet: interface uses TCP/IP networking. That means interface eth0 should be configured during boot time , and interface name eth0 uses TCP/IP protocol and can be configured by Dhcp . Gateway 192.168.1.1 Route -n root@pynq:/etc/network# vi interfaces #interfaces(5) file used by ifup(8) and ifdown(8) #Include files from /etc/network/interfaces.d: #source-directory /etc/network/interfaces.d auto eth0 iface eth0 inet static address 192.168.1.15 gateway 192.168.1.1 netmask 255.255.255.0 dns-nameservers 8.8.8.8 #network 192.168.1.0 #broadcast 192.168.1.255

    sudo /etc/init.d/networking restart route del default route add default gw 192.168.1.1

    6.2 使用MobaXterm工具 6.3 使用命令行 Using the Ethernet Interface SSH service is enabled by default. You can log into the system using an SSH client after the board has booted.

    Figure 15: Logging into the Evaluation Board Using SSH

    Use the ifconfig command via the UART interface to set the IP address of the board, then use the SSH client to log into the system. 通过以下命令配置网络:

    ifconfig eth0 192.168.1.10 netmask 255.255.255.0

    Note:The DNNDK examples won’t work through a UART connection due to the lack of Linux windows.

    七、四种无线配置方法

    以下介绍四种方法,总有一款适合你。 7.1 初始配置wifi 7.1.1 Interfaces地址文件 打开MobaXterm的串口进行配置

    其原因是原有的启动文件默认不启动无线网卡,可使用vi编辑启动文件,命令是: root@xilinx-ultra96-v2019:/etc/network# vi interfaces 在wireless interfaces区域增加命令auto wlan0即可,接入的无线网络配置可在wap_supplicant.conf文件中完成,实现多网络自动切换; 另一种方法是通过wicd-curses中的高级设置也可完成,只不过后一种方法每次启动都要重设。

    vi /etc/network# vi interfaces

    下图为动态配置 下图为静态配置 #interfaces(5) file used by ifup(8) and ifdown(8) #Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d

    allow-hotplug eth0 iface eth0 inet static address 192.168.1.15 gateway 192.168.1.1 netmask 255.255.255.0

    dns-nameservers 8.8.8.8

    vi /etc/network/interfaces.d

    auto wlan0 iface wlan0 inet static address 192.168.1.16 gateway 192.168.1.1 netmask 255.255.255.0 wpa-conf /etc/wpa_supplicant.conf

    或者 iface wlan0 inet dhcp #ifconfig wlan0 192.168.1.16 #gateway 192.168.1.1 wireless_mode managed wireless_essid any wpa-driver wext wpa-conf /etc/wpa_supplicant.conf 7.1.2 配置wap_supplicant.conf文件 #vi wpa_supplicant.conf

    ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 update_config=1

    network={ key_mgmt=WPA-PSK ssid=“JOHNAP” psk=“91823615” priority=1 }

    network={ key_mgmt=WPA-PSK ssid="star " psk=“418418418” priority=3 }

    network={ key_mgmt=WPA-PSK ssid=“CMCC-407” psk=“91823615” priority=5 }

    或使用命令行写入 wpa_passphrase TPLINK 12345678 |sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf

    #priority:连接优先级,数字越大优先级越高 7.2 设置启动脚本 在某些情况下,采用7.1中介绍的方法可能无效,原因未究,可采用下面的办法。 在/etc/init.d/ 下新建脚本wifi.sh root@pynq:~# sudo vi /etc/init.d/wifi.sh

    #!/bin/bash ###BEGIN INIT INFO #Provides: wifi #Required-Start: $all #Required-Stop: #Default-Start: 2 3 4 5 #Default-Stop: ###END INIT INFO ifconfig wlan0 up ifconfig wlan0 192.168.1.16 wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf –B

    上面的程序前段必须设置启动优先级。

    改变执行权限与重启网络: chmod +x /etc/init.d/wifi.sh sudo systemctl enable wifi.sh

    如果未设置启动优先级,则出现: 7.3 单次启动wicd-cureses 配置wicd-cureses文件 running ‘wicd-curses’ from the terminal or over the UART

    点击-〉,进入配置页面,用箭头一直往下走,走到走不动为止,配置密码帐号。

    网络重启 sudo /etc/init.d/networking restart 7.4 命令行启动 netsh interface ip set address “WLAN” static 192.168.1.10 255.255.255.0 192.168.0.1 1 netsh interface ip set address “WLAN” dhcp 查看网络并输入帐号密码 iwlist scanning | grep ESSID #iwlist wlan0 scanning iwconfig wlan0 essid “CMCC-407” key 9182-3615 #iwconfig wlan0 key s:12345 iwconfig wlan0 ap auto" ip route show 192.168.3.0/24 dev wlan0 proto kernel scope link src 192.168.3.3

    参考文献: https://blog.csdn.net/jacobywu/article/details/7366080 Solved: Ultra96 Connect to WiFi - Community Forums https://forums.xilinx.com/t5/Deephi-DNNDK/Ultra96-Connect-to-WiFi/td-p/1010629 最新发布树莓派2代Wi-Fi自动连接实战(适合初学者) https://www.bbsmax.com/A/E35p6nQ8zv/ How to Configure Wireless on Any Linux Desktop - Linux.com https://www.linux.com/tutorials/how-configure-wireless-any-linux-desktop/ 7.5 手机热点 在有些情况下,无线网络无法使用,可以用手机设置热点实现。 7.5.1 计算机侧设置 以管理员权限进入DOS命令行 DOS输入下面一行命令,手工设置计算机的IP地址 netsh interface ip set address “WLAN” static 192.168.1.10 255.255.255.0 192.168.0.1 1

    用ipconfig察看WLAN IP 地址是否是192.168.1.10

    7.5.2开发板侧设置 计算机上打开MobaXterm软件 双击SSH,输入下图中的三个框中的数值 IP地址和username 双击左侧刚建立的192.168.1.16(root)

    展示进入Ultra96开发板上的文件界面

    由于计算机的IP地址可能设置与网关的网段不一致,可能导致计算机无法上网,恢复计算机IP地址自由分配命令如下: netsh interface ip set address “WLAN” dhcp 当然亦可以将开发板与计算机的IP地址与无线局域网设成一个网段,既可以连通,也可以上网。 UP Board 网络设置一本通 - 思兼 - 开发者的网上家园 https://www.cnblogs.com/sjqlwy/p/up_nwm.html 7.6 热点连接 请注意,本节内容作者并未试过,仅转载。

    具体方法如下:使用ap-hotspot来创建WIFI热点,而不要用Ad hoc。终端输入: $ sudo add-apt-repository ppa:nilarimogard/webupd8 $ sudo apt-get update $ sudo apt-get install ap-hotspot $ sudo ap-hotspot configure //这一步会检查ubuntu的网络和WIFI接口,确定后会提示你配置热点,输入ssid和密码之类的就行了 $ sudo ap-hotspot start

    https://blog.csdn.net/u012160954/article/details/47976307 ubuntu创建wifi热点plasma-nm - weixin_33898233的博客 - 博客 https://blog.csdn.net/weixin_33898233/article/details/93258821

    八、图像的本地显示

    Connect with SSH and use X11-Forwarding to PC 在使用MobaXterm工具软件时,只要点击ssh连接时输入正确的开发板IP地址,会自动设置好。 Make sure to enable X11 forwarding with the following command (supposed that host machine IP address is 192.168.0.16) when logging in to the board since all the examples require a Linux windows system to work properly. On Windows, connect to the target over the network using an SSH client that provides an X-server, such as MobaXterm. Ensure that X11-forwarding is enabled, and the DISPLAY environment variable is setup correctly. When an application is launched from this shell, the output will be forwarded back to the PC and displayed in a separate window.

    默认运行X11时,通过本人亲测,远端开发板DISPLAY以下设置,可以在本地计算机上显示图形, DISPLAY=localhost:10.0 DISPLAY=主机IP地址:0.0 以下是不能在本地计算机上显示的: DISPLAY=localhost:0.0 DISPLAY=主机IP地址:10.0 DISPLAY=开发板IP地址:0.0 DISPLAY=开发板IP地址:10.0 设置方法举例: export DISPLAY=192.168.1.4:0.0 查看命令:env

    以下命令应该有用,未证实 For Linux (or windows command line) you can use the following command: ssh -X root@[IP address of Ultra96]. ssh –X root@192.168.1.2 ssh -X xxx.xxx.xxx.xxx

    使用命令行配置SSH terminal ssh -X root@[IP address of Ultra96]. ssh –X root@192.168.1.15 export DISPLAY=192.168.0.15:0.0 Host *

    那么登录之后DISPLAY变量自动设置为本地的X Window. 在这个登录中打开的所有X程序,其图形会自动转发到本地. 这样可以省却指定display参数,而且不用担心xhost的权限问题. 在这里只是简单介绍一下ssh的X转发。

    root@xilinx-ultra96-v2019:~# export DISPLAY=:0.0 root@xilinx-ultra96-v2019:~# xrandr

    九、安装镜像源

    本地离线安装 sudo dpkg -i /path/to/package.deb gcc version 8.2.0 (GCC)) aarch64 GNU/Linux cat /proc/version 配置镜像源,建议使用清华源 虚拟机Ubuntun

    先备份: sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup ubuntu 16.04 xenial

    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

    ubuntu 18.04 bionic

    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse #deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse #deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse #deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

    如果更新源中,缺少公匙,请参考: https://www.linuxidc.com/Linux/2014-11/108918.htm root@xilinx-ultra96-v2019:/# apt-key update root@xilinx-ultra96-v2019:/# apt-get -y upgrade root@xilinx-ultra96-v2019:/# sudo apt-get -f install

    root@xilinx-ultra96-v2019:~/Ultra96/samples/resnet50# xrandr Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192 XWAYLAND0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm 1024x768 59.92*+

    十、环境变量添加

    临时运行增加环境变量命令 export LD_LIBRARY_PATH=/home/john/xilinx_dnndk_v3.1/Ultra96/pkgs/lib 如果想永久增加Linux环境变量,需要用管理员权限编辑文件: sudo vi /etc/profile 或者 sudo vi /home/.bashrc 在文件末尾增加命令行 export CPLUS_INCLUDE_PATH=/home/john/xilinx_dnndk_v3.1/Ultra96/pkgs/include export LD_LIBRARY_PATH=/home/john/xilinx_dnndk_v3.1/Ultra96/pkgs/lib 如果环境变量已经有LD_LIBRARY_PATH,需要用下面的方式在末尾添加: export LD_LIBRARY_PATH= $LD_LIBRARY_PATH :/home/john/xilinx_dnndk_v3.1/Ultra96/pkgs/lib 若不想重新开机,可以用下面的命令激活文件 source /etc/profile 或者 sudo vi /home/.bashrc 检查环境变量是否已经添加,可使用命令: echo $CPLUS_INCLUDE_PATH echo $LD_LIBRARY_PATH

    十一、SD卡扩容

    进入CMD命令窗体,Vista及7下右键以管理员方式运行DOS窗体 输入DISKPART,会显示计算机名,及DISKPART>命令行 在此状态下输入LIST DISK查看机器磁盘,正常Disk 0是本地硬盘,如果有多个硬盘那么以此类推,根据USB设备容量选择磁盘,例如要选择第二块磁盘 则需输入SELECT DISK 2 输入CLEAN删除磁盘(PS:操作之前要记得备份USB设备内的文件) 输入CREATE PARTITION PRIMARY创建主磁盘分区 输入ACTIVE激活磁盘分区 输入FORMAT FS=FAT32 QUICK以FAT32格式快速格式化磁盘分区

    十二、交叉编译环境

    编译文件时须分清是在开发板上还是计算机上做编译,查看版本信息: (base) john@john-virtual-machine:~/xilinx_dnndk_v3.1/Ultra96/pkgs/lib$ file libhineon.so libhineon.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=b7beca2a42e4a7325b5ef0ec3a75dec81cb9f8bd, not stripped

    (base) john@john-virtual-machine:~/xilinx_dnndk_v3.1/Ultra96/pkgs/lib$ gcc -v Target: x86_64-linux-gnu

    Ultra96 资料页面: | Zedboard http://www.microzed.org/support/design/24166/156

    Processed: 0.010, SQL: 8