numam-spdk/doc/getting_started.md
Maciej Wawryk 9ebbf3acac scripts/pkgdep.sh: Add flag for developer tools installation
Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I8876fd7c60198c597d931c5f498644c415c2a868
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/596
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-02-18 14:42:16 +00:00

2.8 KiB

Getting Started

Getting the Source Code

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

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

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.

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.