lspci命令交叉环境编译(ARM设备)
交叉编译工具下载:
https://releases.linaro.org/components/toolchain/binaries
https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/
bash
lspci命令交叉环境编译(ARM设备):
1,下载pci调试工具
https://github.com/pciutils/pciutils
或
https://www.kernel.org/pub/software/utils/pciutils/
先看README和Makefile文件
执行make就可以编译,要编译ARM设备环境,按照Makefile如下提示配置。
# Host OS and release (override if you are cross-compiling)
HOST=
RELEASE=
CROSS_COMPILE=
2,配置交叉编译环境
由于有android源代码,就直接使用prebuilts/gcc/linux-x86/aarch64/gcc-linaro.../bin下的交叉编译命令。
export PATH=/home/xxx/android_sources/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin:$PATH
3,编译
make CROSS_COMPILE=aarch64-linux-gnu- HOST=aarch64-linux LDFLAGS='-static'
例子:
1,编译lspci
进入pciutils源码目录执行如下命令,就会编译出lspci:
export PATH=/home/xxx/android_sources/prebuilts/gcc/linux-x86/aarch64/gcc-linaro.../bin:$PATH
make CROSS_COMPILE=aarch64-linux-gnu- HOST=aarch64-linux LDFLAGS='-static'
2,编译lspci
进入pciutils源码目录执行如下命令:
touch build.sh
chmod 777 build.sh
// 在build.sh文件中添加如下内容:
cat >> build.sh << EOF
export PATH=/home/xxx/android_sources/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin:$PATH
make CROSS_COMPILE=aarch64-linux-gnu- HOST=aarch64-linux LDFLAGS='-static'
EOF
// 执行build.sh就可以编译出lspci命令了
./build.sh