编译
更新于2022-01-17
系统要求
- 内核版本
uname -r
- gcc 版本
ldd --version
一般最新主流发行版本,都没编译问题.
如果使用较老的发行版本,自行去DPDK官网查阅对应的软件版本.
源码
源码仓库
下载连接
| Bash |
|---|
| wget xxxx(路径)
tar xvf dpdk-*.tar.xz
|
源码目录
| 目录 |
描述 |
| doc |
文档 |
| license |
授权文件 |
| lib |
库源码 |
| drivers |
驱动源码 |
| app |
应用和测试源码 |
| examples |
例子 |
| config, buildtools |
特定平台的配置和编译脚本 |
| usertools |
用户工具脚本 |
| devtools |
开发工具脚本 |
| kernel |
内核模块 |
ubuntu编译测试
软件版本
编译系统:ubuntu 20.04.03
软件版本:dpdk-21.11
最新得DPDK已经弃用make,转而使用meson和ninja编译.
| Bash |
|---|
1
2
3
4
5
6
7
8
9
10
11
12
13 | #开发环境安装
sudo apt install build-essential
sudo apt install pkgconf
sudo apt install libnuma-dev
sudo apt install libpcap-dev
#安装python相关
pip -V
#如果没有,则安装
sudo apt install python3-pip
#python相关软件
sudo pip install pyelftools -i https://pypi.tuna.tsinghua.edu.cn/simple
sudo pip install meson -i https://pypi.tuna.tsinghua.edu.cn/simple
sudo pip install ninja -i https://pypi.tuna.tsinghua.edu.cn/simple
|
配置
| Bash |
|---|
1
2
3
4
5
6
7
8
9
10
11
12
13 | cd dpdk-version
#配置项目,指定安装路径(可以省略)
meson setup build --prefix=/usr
#查看配置
cd build && meson configure
#或
meson configure build
#具体需要修改什么配置,自己慢慢看吧
#如果要修改配置,使用下面得命令.
meson configure -Dxxx=xxx build
#例如:
meson configure -Dbuildtype=debug build
#或者直接在build目录下操作
|
编译
| Bash |
|---|
| #在源码目录
cd dpdk-version
#需要配置完
meson compile -C ./build
##或
cd build && meson compile
#或者使用ninja直接编译
cd build&& ninja
|
安装
| Bash |
|---|
| meson install
#或
ninja install
##
#由于dpdk目前使用pgkconfig链接,但是发现安装时,没将pc文件拷贝过去,所以需要手动拷贝
sudo cp .build/meson-private/*.pc /usr/share/pkgconfig/
|
开发编译
参照源码example目录下的makefile或者meson.build编写编译文件.
redhat编译测试
这个暂时未验证.
| Bash |
|---|
| dnf groupinstall "Development Tools"
yum install numactl-devel
|