VCU1525 安装过程记录 SDx 2018.2 Ubuntu 16.04.5(kernel 4.15.0.36)

ml-suite-1.3 重新安装记录:https://blog.csdn.net/u014386899/article/details/103108277

一,  安装硬件板卡;

注意该板卡只支持linux ubuntu 16.04 ;UG中暂时这么说明,但在后来的官方github上有说支持18.04.

二,安装SDx(SDAccel)开发环境(2018.2!)

SDAceel 下载地址(需要xilinx 账号):

https://china.xilinx.com/support/download/index.html/content/xilinx/zh/downloadNav/sdaccel-development-environment/2018-2.html

查看ug1268-vcu1525-reconfig-accel-platform.pdf 文档,安装SDx开发环境,内含vivado 2018.2版本(该板卡即VCU1525对应的版本);

三,申请xilinx.license 给SDAceel

内含各种软件以及IP核的license,申请用的code是买板卡带的那张证书上的(仅仅对应一台机器上的MAC),时间为1年,即到2019年10月。

四,安装JTAG驱动

首先,要安装JTAG驱动,不然,在vivado 的hardware manager 中找不到板子,具体步骤如下:
原文地址: http://blog.csdn.net/cirs_q/article/details/60777912
1.命令行切换到root目录:
#sudo -s
2.去vivado的安装目录下,我的是/xilinx/Vivado/2018.2/data/xicom/cable_drivers/lin64 找到文件夹install_script
3.将文件夹 install_script拷贝到/opt目录下
4.因为现在是root目录,所以cd到/xilinx/Vivado/2018.2/data/xicom/cable_drivers/lin64目录下,直接运行命令:
#cp install_script /opt
5.将目录切换到/opt/install_script/install_drivers/ 目录下,运行命令:
#./install_drivers
6.重新拔掉JTAG,然后在插上,就能找到板卡了。

上述步骤可以做成一个脚本:

#!/bin/bash

sudo -s 
cd /media/orange/D/Xilinx/Vivado/2018.2/data/xicom/cable_drivers/lin64/
cp -r install_script /opt
cd /opt/install_script/install_drivers/
./install_drivers

五,FPGA VCU1525 配置文件烧写

找到板卡后,根据文档 ug1023-SDAccel-user-guide.pdf 中 installing the VCU1525 card 的说明进行配置文件的下载

六,安装 board 驱动,用SDAccel所带的xbinst;

(参考ug1268-vcu1525-reconfig-accel-platform.pdf 和 ug1023-SDAccel-user-guide.pdf 的installing the VCU1525 card部分)
目前需要解决的问题:
我下载了一个该平台的文件包,关于VCU1525的,该怎么处理;是直接安装 board 驱动呢?还是先将该文件包与SDA安装文件融合呢?
先看所下载platform文件包下的readme文件。
最终,决定按照 readme 文档中的步骤完成 platform文件夹与SDA软件安装文件的合体。

打开SDAccel的安装路径找到 SDx/2018.2/bin 目录下,空白处右键->点击在终端打开->输入

sudo ./xbinst --platform xilinx_vcu1525_dynamic_5_1 -d /opt/dsa/xilinx_vcu1525_dynamic_5_1


接着会在 /opt/dsa/xilinx_vcu1525_dynamic_5_1 目录下生成一个xbinst文件夹

接着进入到xbinst文件夹下,在命令行输入

sudo ./install.sh -f yes


该命令的作用是:
1,Compile and force (-f yes) the install of Linux kernel device drivers.
即,编译并强制安装linux 核的设备驱动;
2,Install the firmware to the Linux firmware area.
即,在linux 防火墙区域安装防火墙;
3,Install the Xilinx ® OpenCLTM Installable Client Driver (ICD) to /etc/OpenCL/vendors. The
OpenCL ICD allows multiple implementations of OpenCL to co-exist on the same system. It
allows applications to choose a platform from the list of installed platforms and dispatches
OpenCL API calls to the underlying implementation.
即,安装xilinx 面向 openCL 的客户端驱动(ICD)到 /etc/OpenCL/vendors目录下,ICD可以允许多个 OpenCL平台联合工作在同一个系统中,并允许应用程序从安装的平台中选择一个平台,以调度OpenCL API来调用底层应用;
4,Generate a setup.sh (Bash) or setup.csh (for csh/tcsh) to set up the runtime
environment. You must source the setup script before running any application on the target
FPGA card.for example :

source /opt/dsa/xilinx_vcu1525_dynamic_5_1/xbinst/setup.sh


即,生成 setup.sh 或者 setup.csh 来安装运行环境,当你在FPGA板卡上运行任何程序之前,你必须先编译(source)一下该脚本文件;
注意事项!:
Note : If -k no is used,only the setup scripts are generated, no driver is generated and this can be run
without sudo privileges.

 

出现错误,其中一个错误是在编译ubuntu内核时出错,说是缺少libelf-dev这个库,提示如下:
 please install libelf-dev, libelf-devel or elfutils-libelf-devel"
于是,我们按照提示安装该库文件,即在命令行输入:sudo apt-get install libelf-dev
成功安装,该错误解决;

于是,重新输入命令:

sudo ./install.sh -f yes


仍旧有错误提示,如下:(1)出现的错误中第一个是:
 

 INSTALL /tmp/25519/0/driver/xclng/mgmt/xclmgmt.ko
At main.c:160:
- SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:175
- SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:178

sign-file: certs/signing_key.pem: No such file or directory

这个错误是由于,证书文件确认不成功,即没有找到 certs/signing_key.pem 文件导致。

论坛上也有说是secure_boot 没有disable的,但我没管,其实这个错误可以忽略,不影响使用!

注意更新版本(用ubuntu 16.04.5),在system setting->software&updates->other software 中将关于http://dl.google.com/linux
那一行勾掉,不然会卡在访问dl.ssl.google.com那里,因为有外墙的原因;

(2)出现的第二个错误是:
类似与这些的错误:

/tmp/25519/0/driver/xclng/drm/xocl/xocl_bo.c: In function ‘xocl_init_unmgd’:
/tmp/25519/0/driver/xclng/drm/xocl/xocl_bo.c:908:2: error: too many arguments to function ‘release_pages’


该错误是由于版本原因所致,解决方法见下面的最终解决方案。
(3)出现了第三个错误:
报错文件:
/opt/dsa/xilinx_vcu1525_dynamic_5_1/xbinst/runtime/platforms/xilinx_vcu1525_dynamic_5_1/driver/driver/xclng/drm/xocl/lib/qdma_mbox.c

/tmp/38365/0/driver/xclng/drm/xocl/userpf/../lib/libqdma/qdma_mbox.c:498:2: error: implicit declaration of function ‘init_timer’ [-Werror=implicit-function-declaration]
  init_timer(timer);
  ^
/tmp/38365/0/driver/xclng/drm/xocl/userpf/../lib/libqdma/qdma_mbox.c:499:7: error: ‘struct timer_list’ has no member named ‘data’
  timer->data = (unsigned long)xdev;
       ^
/tmp/38365/0/driver/xclng/drm/xocl/userpf/../lib/libqdma/qdma_mbox.c: In function ‘qdma_mbox_timer_start’:
/tmp/38365/0/driver/xclng/drm/xocl/userpf/../lib/libqdma/qdma_mbox.c:508:25: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
         timer->function = qdma_mbox_proc;


错误原因:
该错误是由于Ubuntu内核中没有 timer.h文件导致
解决方法:
该问题可以通过下文中的最终解决方案解决!
该问题也可以通过 下载timer.h文件添加到 /usr/include/linux/ 路径下来解决
下载地址:https://elixir.bootlin.com/linux/v4.15/source/include/linux/timer.h
然后将qdma_mbox.c 的
498\499两行改为:
     init_timers();
     timer->flags = (unsigned long)xdev;
215\324两行改为:
    static void qdma_mbox_proc(struct timer_list *arg /* unsigned long arg */)

(4)出现第四个错误:

/tmp/35780/0/driver/xclng/drm/xocl/userpf/xocl_bo.c:117:4: error: too many arguments to function ‘release_pages’
    release_pages(xobj->pages, npages,0);
    ^
In file included from /tmp/35780/0/driver/xclng/drm/xocl/userpf/xocl_bo.c:23:0:
./include/linux/pagemap.h:121:6: note: declared here
 void release_pages(struct page **pages, int nr);
      ^
/tmp/35780/0/driver/xclng/drm/xocl/userpf/xocl_bo.c: In function ‘xocl_init_unmgd’:
/tmp/35780/0/driver/xclng/drm/xocl/userpf/xocl_bo.c:1101:2: error: too many arguments to function ‘release_pages’
  release_pages(unmgd->pages, unmgd->npages,0);
  ^
In file included from /tmp/35780/0/driver/xclng/drm/xocl/userpf/xocl_bo.c:23:0:
./include/linux/pagemap.h:121:6: note: declared here
 void release_pages(struct page **pages, int nr);
      ^
/tmp/35780/0/driver/xclng/drm/xocl/userpf/xocl_bo.c: In function ‘xocl_finish_unmgd’:
/tmp/35780/0/driver/xclng/drm/xocl/userpf/xocl_bo.c:1114:2: error: too many arguments to function ‘release_pages’
  release_pages(unmgd->pages, unmgd->npages,0);

解决方法:

见下文最终解决方案!

(5)出现了第五个错误:

/tmp/5374/0/driver/xclng/drm/xocl/userpf/xocl_drm.c:280:2: error: unknown field ‘set_busid’ specified in initializer
  .set_busid                      = drm_pci_set_busid,
  ^
/tmp/5374/0/driver/xclng/drm/xocl/userpf/xocl_drm.c:280:36: error: ‘drm_pci_set_busid’ undeclared here (not in a function)
  .set_busid                      = drm_pci_set_busid,

最终解决方案(错误(3)(4)(5)都可以通过最终解决方案来解决):

参考:https://forums.xilinx.com/t5/SDAccel/Patch-to-run-SDAccel-2018-2-on-Ubuntu-18-xx/td-p/889948

附加说明!!!
原作者改动如下:

(1)diff -r driver/xclng/drm/xocl/lib/libqdma/qdma_mbox.c driver_old/xclng/drm/xocl/lib/libqdma/qdma_mbox.c
215c215
< static void qdma_mbox_proc(struct timer_list *arg /* unsigned long arg */)
---
> static void qdma_mbox_proc(unsigned long arg)
324c324
< static void qdma_mbox_proc(struct timer_list *arg /* unsigned long arg */)
---
> static void qdma_mbox_proc(unsigned long arg)
498,500c498,499
<       timer_setup(timer, timer->function, 0);
<       /* init_timer(timer); */
<       /* timer->data = (unsigned long)xdev; */
---
>       init_timer(timer);
>       timer->data = (unsigned long)xdev;

(2)diff -r driver/xclng/drm/xocl/userpf/xocl_bo.c driver_old/xclng/drm/xocl/userpf/xocl_bo.c
117c117
<                       release_pages(xobj->pages, npages/*, 0*/);
---
>                       release_pages(xobj->pages, npages, 0);
1101c1101
<       release_pages(unmgd->pages, unmgd->npages/*, 0*/);
---
>       release_pages(unmgd->pages, unmgd->npages, 0);
1114c1114
<       release_pages(unmgd->pages, unmgd->npages/*, 0*/);
---
>       release_pages(unmgd->pages, unmgd->npages, 0);

(3)diff -r driver/xclng/drm/xocl/userpf/xocl_drm.c driver_old/xclng/drm/xocl/userpf/xocl_drm.c
279,281c279,281
< /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) */
< /*    .set_busid                      = drm_pci_set_busid, */
< /* #endif */
---
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
>       .set_busid                      = drm_pci_set_busid,
> #endif

修改/opt/dsa/xilinx_paltform_5_1/xbinst/runtime/platforms/xilinx_vcu1525_dynamic_5_1/driver/文件夹下的压缩文件:
xocl.zip
具体步骤详细说明:
1,更改qdma_mbox.c文件
将xocl.zip解压,即在终端打开后,输入命令:
sudo unzip xocl.zip
解压后是一个driver文件夹
进入路径:/opt/dsa/xilinx_vcu1525_dynamic_5_1/xbinst/runtime/platforms/xilinx_vcu1525_dynamic_5_1/driver/driver/xclng/drm/xocl/lib/
找到qdma_mbox.c文件
空白处右键 open in terminal
在终端输入命令:
sudo chmod a+w qdma_mbox.c
来更改权限
然后输入命令:
sudo gedit qdma_mbox.c
编辑文件,找到499行的,
init_timer(timer);
timer->data = (unsigned long)xdev;
将这两行用
timer_setup(timer, timer->function, 0);
替换掉。保存
将原来的压缩包xocl.zip删除,
命令:sudo rm -rf xocl.zip
然后,将新更改的driver压缩为xocl.zip
命令:sudo zip -r xocl.zip ./driver

2,更改xocl_drm.c文件
同样方法,将driver/xclng/drm/xocl/userpf/xocl_drm.c文件中的279行到281行这三行代码屏蔽掉,
如下:
/*#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
    .set_busid                      = drm_pci_set_busid,
#endif */
保存后,重新压缩成xocl.zip文件。

3,更改xocl_bo.c文件
文件目录:driver/driver/xclng/drm/xocl/userpf/xocl_bo.c
更改位置:117行、1101行、1114行
更改内容:
release_pages(unmgd->pages, unmgd->npages/*, 0*/);
将后面的",0"注释掉或者删除。保存

更改完毕后,重新运行命令:

sudo ./install.sh -f yes

七,Program the Base Platform


即烧写xilinx_vcu1525_dynamic_5_1.mcs文件。
步骤按照教程来即可,
需要注意的是,执行
$sudo <xbinst-area>/runtime/bin/xbsak flash scan 时
要改为
$cd <xbinst-area>/runtime/bin/
$sudo ./xbsak flash scan

最后一个命令:
$xbsak flash -m <mcs file>
改为:
$cd <xbinst-area>/runtime/bin/
$sudo ./xbsak flash -m /opt/dsa/xilinx_vcu1525_dynamic_5_1/xbinst/firmware/xilinx_vcu1525_dynamic_5_1.mcs
#############==================后加==========================================================
八,安装运行时软件环境(xilinx-vcu1525-dynamic-16.04.deb和xrt_201802.2.1.83_16.04.deb)
安装两个软件脚本 install.sh:

#!/bin/bash

sudo dpkg -i ./xilinx-vcu1525-dynamic-16.04.deb
sudo dpkg -i ./xrt_201802.2.1.83_16.04.deb

# set environment
source /opt/xilinx/xrt/setup.sh

# invoke xclmgmt xocl
sudo modprobe xclmgmt
sudo modprobe xocl

安装出错,出现缺少依赖包的错误提示:

(ml-suite) orange@Orange:/media/orange/D/VCU1525$ bash install.sh
(Reading database ... 216160 files and directories currently installed.)
Preparing to unpack .../xilinx-vcu1525-dynamic-16.04.deb ...
Unpacking xilinx-vcu1525-dynamic (5.1-2342198) over (5.1-2342198) ...
dpkg: dependency problems prevent configuration of xilinx-vcu1525-dynamic:
 xilinx-vcu1525-dynamic depends on xrt (>= 2.1.0); however:
  Package xrt is not configured yet.

dpkg: error processing package xilinx-vcu1525-dynamic (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 xilinx-vcu1525-dynamic
(Reading database ... 216160 files and directories currently installed.)
Preparing to unpack ./xrt_201802.2.1.83_16.04.deb ...
Unpacking xrt (2.1.83) over (2.1.83) ...
dpkg: dependency problems prevent configuration of xrt:
 xrt depends on ocl-icd-opencl-dev (>= 2.2.0); however:
  Package ocl-icd-opencl-dev is not installed.
 xrt depends on libboost-dev (>= 1.58); however:
  Package libboost-dev is not installed.
 xrt depends on libboost-filesystem-dev (>= 1.58); however:
  Package libboost-filesystem-dev is not installed.
 xrt depends on uuid-dev (>= 2.27.1); however:
  Package uuid-dev is not installed.
 xrt depends on dkms (>= 2.2.0); however:
  Package dkms is not installed.
 xrt depends on libprotoc-dev (>= 2.6.1); however:
  Package libprotoc-dev is not installed.
 xrt depends on protobuf-compiler (>= 2.6.1); however:
  Package protobuf-compiler is not installed.
 xrt depends on libncurses5-dev (>= 6.0); however:
  Package libncurses5-dev is not installed.
 xrt depends on libxml2-dev (>= 2.9.1); however:
  Package libxml2-dev is not installed.
 xrt depends on libyaml-dev (>= 0.1.6); however:
  Package libyaml-dev is not installed.

dpkg: error processing package xrt (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 xrt
XILINX_XRT      : /opt/xilinx/xrt
PATH            : /opt/xilinx/xrt/bin:/media/orange/D/anaconda2/envs/ml-suite/bin:/media/orange/D/anaconda2/bin:/home/orange/bin:/home/orange/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
LD_LIBRARY_PATH : /opt/xilinx/xrt/lib:


解决方法:
命令行输入:
#sudo apt-get -f install
等待更新完成,再次安装即可!

 

 


 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值