在Ubuntu使用工具链交叉编译arm架构的DPDK
为了使用 Marvell 提供的 ARM 架构工具链编译 DPDK 的 l3fwd 程序,你需要进行以下配置:
toolchain工具包解压出来,里面的目录是marvell-tools-12006.0
1 | toolchain/marvell-tools-12006.0$ ls |
使用meson和ninja编译dpdk
1.设置环境变量:
在编译 DPDK 之前,你需要设置环境变量,告诉 DPDK 使用 Marvell 提供的 ARM 架构工具链。假设 Marvell 工具链安装在 /path/to/marvell-tools-12006.0
,你可以执行以下命令:
1 | export PATH=/path/to/marvell-tools-12006.0/bin:$PATH |
这样,系统会使用 Marvell 的工具链而不是默认的 x86 架构工具链。
2.检查已经配置好的交叉编译器
1 | which aarch64-marvell-linux-gnu-gcc |
3.下载和编译 DPDK:
下载 DPDK 源代码,并使用 Marvell 提供的工具链进行编译。确保你已经安装了必要的依赖项(如 make
、gcc
等)。
1 | 克隆 DPDK 仓库 |
4..编译 l3fwd 程序:
进入 DPDK 的 examples/l3fwd
目录,使用 Marvell 的工具链进行编译:
注意这里需要修改一下arm64_cn10k_linux_gcc1配置文件,将编译器改为
aarch64-marvell-linux-gnu-gcc
形式
1 | 编译examples下所有的用例 dpdk根目录下执行 |
这将使用 Marvell 的工具链编译 l3fwd 程序。
5.传输和运行程序:
将编译好的 l3fwd 程序传输到目标 ARM 架构平台上,并在目标平台上运行。
1 | 在tftp服务器上,也就是笔记本电脑 |
交叉编译DpDk【通用过程】
1.依赖安装:
1 | sudo apt-get install meson |
2.Check the installed Meson version with the following command:
1 | meson --version |
3.Run following command from DPDK top directory to build for OcteonTx:
1 | meson arm64-build --cross-file config/arm/arm64_thunderx_linux_gcc |
Run following command from DPDK top directory to build for CN10K:
1 | meson arm64-build --cross-file config/arm/arm64_cn10k_linux_gcc |
只修改了example下某个用例中的文件,如何重新编译
以dpdk-helloworld为例
1.在example/helloworld目录下修改main.c文件
1 | cd dpdk/examples/helloworld |
1 | tftp 198.18.0.2 |
在开发板上验证程序:

arm64_cn10k_linux_gcc1文件
注意把工具替换成marvell的版本,meson根据这个文件配置使用编译器。
1 | [binaries] |
1 | x86_64-linux-gnu |
- 本文作者: CoderSong
- 本文链接: https://jack-song-gif.github.io/2024/02/28/在Ubuntu使用工具链交叉编译arm架构的DPDK/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!