type
Post
status
Published
slug
2024/10/17/CentOS-9-DPDK-source-code-compilation-manual
summary
tags
Linux
Centos
DPDK
category
DPDK
icon
password
new update day
Property
Oct 31, 2024 08:00 AM
created days
Last edited time
Oct 31, 2024 08:00 AM

step.0 系统环境准备

  • 开启 CentOS 9 CRB repo
dnf config-manager --enable crb dnf install tar -y
  • 更新系统
dnf update

安装编译依赖

dnf install meson ninja-build -y dnf install libpcap-devel cmake libbpf -y dnf install python3-sphinx -y dnf install python3-pyelftools -y dnf install kernel-devel pciutils -y dnf install libbsd-devel -y dnf install numactl-devel -y

step.1 获取 DPDK 源码并编译

以 22.11.6 为例,通过下面的链接可以下载 DPDK 对应版本的源码。

1. 解压 DPDK 源码

tar xJf dpdk-*.tar.xz cd dpdk-<version>
The DPDK is composed of several directories, including:
  • doc: DPDK Documentation
  • license: DPDK license information
  • lib: Source code of DPDK libraries
  • drivers: Source code of DPDK poll-mode drivers
  • app: Source code of DPDK applications (automatic tests)
  • examples: Source code of DPDK application examples
  • config, buildtools: Framework-related scripts and configuration
  • usertools: Utility scripts for end-users of DPDK applications
  • devtools: Scripts for use by DPDK developers
  • kernel: Kernel modules needed for some operating systems

2 编译并安装 DPDK

配置 DPDK 编译参数

meson setup build -Dexamples=l2fwd,l3fwd --prefix=path/to/you/want

开始编译

cd build jinja jinja install

step2.获取 dpdk-kmods 并编译

如果需要使用到 igb_uio.ko 那么需要单独克隆对应的代码,进行手动编译,因为在 22.11 之后,对应的代码独立出来了。

获取 dpdk-kmods 源码

git clone http://dpdk.org/git/dpdk-kmods cd dpdk-kmods/linux/igb_uio

开始编译

make make -C /lib/modules/5.10.0-153.56.0.134.oe2203sp2.x86_64/build/ M=/root/dpdk-kmods/linux/igb_uio make[1]: Entering directory '/usr/src/kernels/5.10.0-153.56.0.134.oe2203sp2.x86_64' CC [M] /root/dpdk-kmods/linux/igb_uio/igb_uio.o MODPOST /root/dpdk-kmods/linux/igb_uio/Module.symvers CC [M] /root/dpdk-kmods/linux/igb_uio/igb_uio.mod.o LD [M] /root/dpdk-kmods/linux/igb_uio/igb_uio.ko make[1]: Leaving directory '/usr/src/kernels/5.10.0-153.56.0.134.oe2203sp2.x86_64'

加载驱动

modprobe uio insmod igb_uio.ko

查看驱动加载情况

lsmod | grep igb_uio igb_uio 20480 0 uio 28672 1 igb_uio

参考文献

 
欢迎加入喵星计算机技术研究院,原创技术文章第一时间推送。
notion image
 
在 CentOS 9 上编译 DPDK 与 pktgen 24.07在 CentOS 9 上启用 CRB 源