码迷,mamicode.com
首页 > 其他好文 > 详细

【SPDK官方文档】Introduction/Getting Started

时间:2020-02-22 14:02:27      阅读:68      评论:0      收藏:0      [点我收藏+]

标签:and   help   res   messages   its   script   param   匹配   bsp   

Getting Started

Getting the Source Code

git clone https://github.com/spdk/spdk
cd spdk
git submodule update --init
-------------------------------------------------------

获取源码

git clone https://github.com/spdk/spdk
cd spdk
git submodule update --init

 

Installing Prerequisites

The scripts/pkgdep.sh script will automatically install the bare minimum dependencies required to build SPDK. Use --help to see information on installing dependencies for optional components.

sudo scripts/pkgdep.sh

Option –all will install all dependencies needed by SPDK features.

sudo scripts/pkgdep.sh --all
--------------------------------------------------------

安装依赖

脚本scripts/pkgdep.sh自动安装SPDK的最小依赖.使用--help查看安装依赖的可选组件信息。

sudo scripts/pkgdep.sh

选项–all将会安装SPDK特性的所有依赖

 

Building

Linux:

./configure
make

FreeBSD: Note: Make sure you have the matching kernel source in /usr/src/

./configure
gmake

There are a number of options available for the configure script, which can be viewed by running

./configure --help

Note that not all features are enabled by default. For example, RDMA support (and hence NVMe over Fabrics) is not enabled by default. You can enable it by doing the following:

./configure --with-rdma
make
-------------------------------------------------------
构建

Linux:

./configure
make

FreeBSD: 确保你有匹配的内核源码在/usr/src/。

./configure
gmake

运行过程中将会看到一些可用的配置脚本选项。

./configure --help

注意不是所有特性在默认情况下可用。如RDMA(NVMe over Fabrics)默认形况不可用,可以通过以下方式使其可用:

./configure --with-rdma
make

 

Running the Unit Tests

It‘s always a good idea to confirm your build worked by running the unit tests.

./test/unit/unittest.sh

You will see several error messages when running the unit tests, but they are part of the test suite. The final message at the end of the script indicates success or failure.

-------------------------------------------------------

运行单元用例

通过运行单元用例确认你的构建结果的工作情况是个不错的想法。

./test/unit/unittest.sh

当运行单元用例时你将会看到一些错误信息,但是这些都是测试套的一部分。在脚本最后的信息说明执行成功或失败。

 

Running the Example Applications

Before running an SPDK application, some hugepages must be allocated and any NVMe and I/OAT devices must be unbound from the native kernel drivers. SPDK includes a script to automate this process on both Linux and FreeBSD. This script should be run as root. It only needs to be run once on the system.

sudo scripts/setup.sh

To rebind devices back to the kernel, you can run

sudo scripts/setup.sh reset

By default, the script allocates 2048MB of hugepages. To change this number, specify HUGEMEM (in MB) as follows:

sudo HUGEMEM=4096 scripts/setup.sh

On Linux machines HUGEMEM will be rounded up to system-default huge page size boundary.

All available params can be viewed by running

scripts/setup.sh help

Example code is located in the examples directory. The examples are compiled automatically as part of the build process. Simply call any of the examples with no arguments to see the help output. If your system has its IOMMU enabled you can run the examples as your regular user. If it doesn‘t, you‘ll need to run as a privileged user (root).

A good example to start with is examples/nvme/identify/identify, which prints out information about all of the NVMe devices on your system.

Larger, more fully functional applications are available in the app directory. This includes the iSCSI and NVMe-oF target.

-------------------------------------------------------

运行示例程序

在运行SPDK应用之前一些大页必须要设置,一些NVMe或I/OAT设备必须从内核驱动解绑。SPDK有脚本会自动完成这个操作在Linux和FreeBSD。这个脚本必须使用root运行,值用在系统中运行一次。

sudo scripts/setup.sh

从新绑定回设备,可以这样运行

sudo scripts/setup.sh reset

默认情况,脚本配置2048MB的大页。要修改这个值,设置HUGEMEM (单位MB)如下:

sudo HUGEMEM=4096 scripts/setup.sh

在Linux机器上HUGEMEM将被设置位系统默认大页上边界。

通过以下操作可看到所有可用参数

scripts/setup.sh help

示例代码在示例目录下,示例在构建程序时被自动编译。不使用参数的调用任意实例程序将会看到帮助信息。如果你的系统IOMMU可用你可以通过常规用户运行样例,如果没有,你需要使用root运行。

使用样例examples/nvme/identify/identify将会打印你的系统中所有的NVMe设备信息。

更大更全功能的应用在app目录下,包括iSCSI target和NVMe-oF target。

【SPDK官方文档】Introduction/Getting Started

标签:and   help   res   messages   its   script   param   匹配   bsp   

原文地址:https://www.cnblogs.com/xasz/p/12344943.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!