openwrt一直是我关注的项目,而DPDK是我工作必须的技能,所以把dpdk与openwrt想结合是我的一个想法。
于是乎我这样干了。。
为了减少版本带来的问题,openwrt我选择的是比较新的版本15.05,这个版本是支持glibc的
至于如何编译openwrt以及生成带SDK,这个比较容易。就不详细讲解了。。
必须准备的条件
1.openwrt需要选glibc而不是uglibc
2.openwrt需要增加内核选项 CONFIG_HUGETLB_PAGE CONFIG_HUGETLBFS CONFIG_UIO
3.openwrt 选择x86_64
默认的openwrt的kernel是不支持UIO与hugepagefs的,所以要通过配置打开openwrt的kernel的这几个选项
参考文章:
如何配置openwrt kernel
主要命令
make kernel_menuconfig
手动去选择就OK了
配置那些kernel选项
第:2.3.1章节
主要内容:
For other kernel builds, options which should be enabled for DPDK include:
- UIO support ( 斜杠/搜索UIO)
- HUGETLBFS (斜杠/搜索HUGETLBFS )
- PROC_PAGE_MONITOR support (斜杠/搜索PROC_PAGE_MONITOR )
- HPET and HPET_MMAP configuration options should also be enabled if HPET support is required. See the section on High Precision Event Timer (HPET) Functionality for more details. (斜杠/搜索TIMER找到对应的选项)
以上工作做好以后重新,在bin下面找到
1.解压该压缩文件到/home/bestboyxie
2.重命名为openwrt
然后依次做一下声明
export CROSS=/home/bestboyxie/openwrt/staging_dir/toolchain-x86_64_gcc-4.8-linaro_glibc-2.21/bin/x86_64-openwrt-linux-gnu-
export STAGING_DIR=/home/bestboyxie/openwrt/staging_dir
export RTE_KERNELDIR=/home/bestboyxie/openwrt/build_dir/target-x86_64_glibc-2.21/linux-x86_64/linux-3.18.45
cd /home/bestboyxie/dpdk-stable-16.11.1
make T=x86_64-native-linuxapp-gcc config
其中
/home/bestboyxie/dpdk-stable-16.11.1是我的dpdk的目录
home/bestboyxie/openwrt/是我的sdk目录
最后执行
make