运行环境
VMware16+Ubuntu21.04 VMware密钥
Keys:
ZF3R0-FHED2-M80TY-8QYGC-NPKYF
YF390-0HF8P-M81RQ-2DXQE-M2UT6
ZF71R-DMX85-08DQY-8YMNC-PPHV8
Ubuntu下载地址:https://repo.huaweicloud.com/ubuntu-releases/ 安装后记得换源
源码拉取
官网给出的命令如下
git clone https://github.com/spdk/spdk
cd spdk
git submodule update --init
但这样下载速度过慢,可以将https改成git,或者在com后加入.cnpmjs.org后缀。
git clone git://github.com/spdk/spdk
git clone https://github.com.cnpmjs.org/spdk/spdk
git clone命令完成后,修改spdk文件夹中的.gitmodules文件
[submodule "dpdk"]
path = dpdk
url = https://github.com.cnpmjs.org/spdk/dpdk.git
[submodule "intel-ipsec-mb"]
path = intel-ipsec-mb
url = https://github.com.cnpmjs.org/spdk/intel-ipsec-mb.git
[submodule "isa-l"]
path = isa-l
url = https://github.com.cnpmjs.org/spdk/isa-l.git
[submodule "ocf"]
path = ocf
url = https://github.com.cnpmjs.org/Open-CAS/ocf.git
[submodule "libvfio-user"]
path = libvfio-user
url = https://github.com.cnpmjs.org/nutanix/libvfio-user.git
最后再执行
cd spdk
git submodule update --init
参考博客
编译
sudo ./scripts/pkgdep.sh
sudo ./configure
make
./test/unit/unittest.sh
增加虚拟盘,运行样例
在运行SPDK应用程序之前,必须分配一些大页面,并且必须从本机内核驱动程序中取消绑定任何NVMe和I / OAT设备。SPDK包含一个脚本,可以在Linux和FreeBSD上自动执行此过程。该脚本应该以root身份运行。它只需要在系统上运行一次。 在VMware上增加一个未格式化NVMe硬盘     而后修改硬盘属性(如果有两个NVMe硬盘的话),确保自己新加的硬盘是单独的硬盘而不是分区  添加完之后用lsblk命令查看是否添加成功(nvme1n1) 不需要任何分区,挂载,格式化操作,裸盘即可  而后运行
sudo scripts/setup.sh
sudo build/example/hello_world
结果如下  
spdk github地址: https://github.com/spdk/spdk spdk官方文档中文版: https://files.cnblogs.com/files/whl320124/SPDK_cn.zip 英文官网地址: https://spdk.io/doc/
如有任何问题,请于评论区告知,谢谢
|