上一次OpenWrt交叉编译feeds和LuCI是使用标准的OpenWrt工程,直接make即可,但是不是所有的工程都有OpenWrt编译版,有些只提供了Makefile相关文件,无法直接make,比如锐捷认证mentohust(后来发现有OpenWrt编译版,但是有其他问题),这个时候就需要设置环境变量来编译所需文件,参考教程一, 参考教程二, 总结如下
1 2 3 4 5 6 7 8 9 10
| # 编译工具目录 *根据具体路径替换 export PATH=*/OpenWrt-SDK*/staging_dir/toolchain*/bin/:$PATH # staging_dir目录 *根据具体路径替换 gcc4.6及以后版本需要 export PATH=*/OpenWrt-SDK*/staging_dir:$PATH # CC/CPP/GCC等目录 其中*需要根据第一个export的bin目录下的文件来确定 export CC=*-openwrt-linux-*gcc export CPP=*-openwrt-linux-*cpp export GCC=*-openwrt-linux-*gcc export CXX=*-openwrt-linux-*g++ export RANLIB=*-openwrt-linux-*-ranlib
|
使用configure生成Makefile的时候指定host
1 2
| # 与上文的export前缀相同 ./configure -host=*-openwrt-linux-*
|
然后正常make即可在src生成可执行文件,上传至路由器的/usr/bin目录下即可
附件
附上用19.07.2 ipq40xx SDK编译的mentohust
下载链接