|
本帖最后由 hgfdsa-265936 于 2017-6-6 14:46 编辑
编译Openwrt想把手里的pcie无线网卡用起来,那必定要用到compat-wireless模块,闪亮登场。
但是总是遇到编译错误,本来寄希望于通过- ./scripts/feeds update -a
复制代码 会对compat-wireless的代码进行更新,发现github上并没有更新这个模块的代码。
为此专门下载了ubuntu16.04(注意不是16.04.02)镜像,因为要锁定上位机的系统内核为4.4.8,毕竟开发环境就是4.4.8的嘛
http://wiki.espressobin.net/tiki-index.php?page=Build+From+Source+-+Kernel
http://wiki.espressobin.net/tiki-index.php?page=Build+From+Source+-+OpenWrt
16.04内核版本号低于4.4.8(16.04.02内核版本号是4.8.0),升级到4.4.8其实这样做还主要是为了获得linux-headers的文件夹,后面编译会用到。(参考http://blog.sina.com.cn/s/blog_45b480d10102xn3x.html)
下图的4.4.8-040408-generic文件夹是升级内核后自动生成的,即linux-headers。
通过曲折的折腾发现编译compat-wireless的时候错误依旧,替换了多个compat-wireless版本后(tar下载后解压缩进编译目录)发现不是因为版本号不匹配出现的问题,(http://mirror2.openwrt.org/sources/里面n多版本compat-wireless的版本)还是跟编译器gcc“水土不服”有关,还是得硬把compat-wireless的代码改的适应aarch64-openwrt-linux-musl-gcc编译器才行(这个github上的openwrt-dd在make的时候调用aarch64-openwrt-linux-musl-gcc)
编译错误显示如下:- backport-include/linux/phy.h:16:25: error: 'const struct phy_device' has no member named 'dev'
- return dev_name(&phydev->dev);
- backport-include/linux/phy.h:22:12: error: 'struct mii_bus' has no member named 'phy_map'
- return bus->phy_map[addr];
- backport-include/linux/phy.h:33:11: error: assignment to expression with array type
- bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
- backport-include/linux/phy.h:65:15: error: 'struct phy_device' has no member named 'addr'
- return phydev->addr;
- compat/backport-4.5.c:110:19: error: 'struct phy_device' has no member named 'dev'
- dev_info(&phydev->dev, ATTACHED_FMT "\n",
- include/linux/device.h:1174:46: note: in definition of macro 'dev_info'
- #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
- compat/backport-4.5.c:116:19: error: 'struct phy_device' has no member named 'dev'
- dev_info(&phydev->dev, ATTACHED_FMT,
- include/linux/device.h:1174:46: note: in definition of macro 'dev_info'
- #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
- scripts/Makefile.build:258: recipe for target '/opt/openwrt/openwrt-dd/build_dir/target-aarch64_cortex-a53+neon-vfpv4_musl-1.1.16/linux-mvebu64/compat-wireless-2016-05-12/compat/backport-4.5.o' failed
复制代码 错误主要分两类:找不到成员名为“dev”的东东,和语法错误。
解决方案:
1、将所有提示"has no member named '***'"找到源代码将***改成"mdio.***"即可。例如- return dev_name(&phydev->dev);
复制代码- return dev_name(&phydev->mdio.dev);
复制代码 2、下面这个是在将bus前面加上*改成指针。- *bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
复制代码 真不知道这个“CC="aarch64-openwrt-linux-musl-gcc" ”咋回事。若在compat-wireless目录下直接用x86的gcc编译没有任何错误。
好了,这样compat-wirelss编译过了。
若还有更妙的办法请随时pm我。欢迎批评指正。
|
|