linux --- 一切皆文件
分类: LINUX
2016-03-01 00:29:59
dpdk中/home/admin/dpdk_proj/dpdk-1.8.0/tools/setup.sh脚本解析:
点击(此处)折叠或打开
${BASH_SOURCE[0]} :获取文件路径,包括文件名。/home/admin/a.sh$(dirname ${BASH_SOURCE[0]}):获取给定路径的目录部分,/home/admin$(dirname ${BASH_SOURCE[0]})/..:获取路径的上一级目录,/home
dpdk主目录如下/home/admin/dpdk_proj/dpdk-1.8.0,setup.sh脚本在/home/admin/dpdk_proj/dpdk-1.8.0/tools/setup.sh。在dpdk主目录下执行./tools/setup.sh,
$(dirname ${BASH_SOURCE[0]})/..命令获取的是tools/..目录,即/home/admin/dpdk_proj/dpdk-1.8.0。cd 到tools/..目录。
点击(此处)折叠或打开
当前已经到达tools/..目录,通过pwd获取目录绝对路径,/home/admin/dpdk_proj/dpdk-1.8.0。export RTE_SDK,使得RTE_SDK成为一个环境变量,在此脚本的所有子进程中都可使用。
点击(此处)折叠或打开
点击(此处)折叠或打开
cfg的值:
config/defconfig_i686-native-linuxapp-gccconfig/defconfig_i686-native-linuxapp-iccconfig/defconfig_ppc_64-power8-linuxapp-gccconfig/defconfig_x86_64-ivshmem-linuxapp-gccconfig/defconfig_x86_64-ivshmem-linuxapp-iccconfig/defconfig_x86_64-native-bsdapp-clangconfig/defconfig_x86_64-native-bsdapp-gccconfig/defconfig_x86_64-native-linuxapp-clangconfig/defconfig_x86_64-native-linuxapp-gccconfig/defconfig_x86_64-native-linuxapp-icc
cfg值:
i686-native-linuxapp-gcci686-native-linuxapp-iccppc_64-power8-linuxapp-gccx86_64-ivshmem-linuxapp-gccx86_64-ivshmem-linuxapp-iccx86_64-native-bsdapp-clangx86_64-native-bsdapp-gccx86_64-native-linuxapp-clangx86_64-native-linuxapp-gccx86_64-native-linuxapp-icc
点击(此处)折叠或打开
STEPS[@]获取STEPS数组的所有成员${#STEPS[@]}的${# array}获取成员的个数${seq num},枚举数字,当num等于3时,${seq 3}扩展成1,2,3
编译环境选项如下:
----------------------------------------------------------Step 1: Select the DPDK environment to build----------------------------------------------------------[1] i686-native-linuxapp-gcc[2] i686-native-linuxapp-icc[3] ppc_64-power8-linuxapp-gcc[4] x86_64-ivshmem-linuxapp-gcc[5] x86_64-ivshmem-linuxapp-icc[6] x86_64-native-bsdapp-clang[7] x86_64-native-bsdapp-gcc[8] x86_64-native-linuxapp-clang[9] x86_64-native-linuxapp-gcc[10] x86_64-native-linuxapp-icc
点击(此处)折叠或打开
假设我们选择编译环境为[1] i686-native-linuxapp-gcc:
在/home/admin/dpdk_proj/dpdk-1.8.0目录下执行make install T=i686-native-linuxapp-gcc,会执行dpdk根目录的GNUmakefile