Linux 5.1移植到orange pi (三)--网卡驱动

drivers/net/ethernet/allwinner/sun8i-emac.c:160:19: warning: duplicate ‘const’ declaration specifier [-Wduplicate-decl-specifier]
 static const char const estats_str[][ETH_GSTRING_LEN] = {
                   ^~~~~
drivers/net/ethernet/allwinner/sun8i-emac.c: In function ‘sun8i_emac_mdio_probe’:
drivers/net/ethernet/allwinner/sun8i-emac.c:1208:20: error: assignment to expression with array type
  phydev->supported &= PHY_GBIT_FEATURES;
                    ^~
drivers/net/ethernet/allwinner/sun8i-emac.c:1209:22: error: assignment to expression with array type
  phydev->advertising = phydev->supported;
                      ^
drivers/net/ethernet/allwinner/sun8i-emac.c: In function ‘sun8i_emac_alloc_rings’:
drivers/net/ethernet/allwinner/sun8i-emac.c:1242:16: error: implicit declaration of function ‘dma_zalloc_coherent’; did you mean ‘dma_alloc_coherent’? [-Werror=implicit-function-declaration]
  priv->dd_rx = dma_zalloc_coherent(priv->dev,
                ^~~~~~~~~~~~~~~~~~~
                dma_alloc_coherent
drivers/net/ethernet/allwinner/sun8i-emac.c:1242:14: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  priv->dd_rx = dma_zalloc_coherent(priv->dev,
              ^
drivers/net/ethernet/allwinner/sun8i-emac.c:1262:14: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  priv->dd_tx = dma_zalloc_coherent(priv->dev,
              ^
drivers/net/ethernet/allwinner/sun8i-emac.c: In function ‘sun8i_emac_ethtool_get_settings’:
drivers/net/ethernet/allwinner/sun8i-emac.c:1809:9: error: implicit declaration of function ‘phy_ethtool_gset’; did you mean ‘phy_ethtool_sset’? [-Werror=implicit-function-declaration]
  return phy_ethtool_gset(phy, cmd);
         ^~~~~~~~~~~~~~~~
         phy_ethtool_sset
drivers/net/ethernet/allwinner/sun8i-emac.c: At top level:
drivers/net/ethernet/allwinner/sun8i-emac.c:1961:3: error: ‘const struct ethtool_ops’ has no member named ‘get_settings’; did you mean ‘get_strings’?
  .get_settings = sun8i_emac_ethtool_get_settings,
   ^~~~~~~~~~~~
   get_strings
drivers/net/ethernet/allwinner/sun8i-emac.c:1961:18: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .get_settings = sun8i_emac_ethtool_get_settings,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/allwinner/sun8i-emac.c:1961:18: note: (near initialization for ‘sun8i_emac_ethtool_ops.complete’)
drivers/net/ethernet/allwinner/sun8i-emac.c:1962:3: error: ‘const struct ethtool_ops’ has no member named ‘set_settings’; did you mean ‘get_strings’?
  .set_settings = sun8i_emac_ethtool_set_settings,
   ^~~~~~~~~~~~
   get_strings
drivers/net/ethernet/allwinner/sun8i-emac.c:1962:18: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .set_settings = sun8i_emac_ethtool_set_settings,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/allwinner/sun8i-emac.c:1962:18: note: (near initialization for ‘sun8i_emac_ethtool_ops.get_priv_flags’)
cc1: some warnings being treated as errors
scripts/Makefile.build:275: recipe for target 'drivers/net/ethernet/allwinner/sun8i-emac.o' failed
make[4]: *** [drivers/net/ethernet/allwinner/sun8i-emac.o] Error 1
scripts/Makefile.build:486: recipe for target 'drivers/net/ethernet/allwinner' failed
make[3]: *** [drivers/net/ethernet/allwinner] Error 2
scripts/Makefile.build:486: recipe for target 'drivers/net/ethernet' failed
make[2]: *** [drivers/net/ethernet] Error 2
scripts/Makefile.build:486: recipe for target 'drivers/net' failed
make[1]: *** [drivers/net] Error 2
make[1]: *** Waiting for unfinished jobs....

准备porting Ethernet驱动,貌似和Linux 5.1有点不兼容的错误,还在排查,今天背疼先存下进度

根据sun4i-emac.c修改了几个地方可以Buid Pass了,Image 之前的发现重装系统丢了,烧了3.4却发现不能install_to_emmc

无奈下载官方Build,修改了Ubuntu的source list发现还是清华的比较靠谱稳定,阿里云的有点不太好

清华大学Ubuntu18.04 source list

搞了半天orange班子的Ethernet驱动不是sun8i-emac.c,是dwmac-sun8i.c

修改defconfig,增加

CONFIG_NET_VENDOR_STMICRO=y
CONFIG_STMMAC_ETH=y
CONFIG_STMMAC_PLATFORM=y
CONFIG_DWMAC_DWC_QOS_ETH=y
CONFIG_DWMAC_GENERIC=y
CONFIG_DWMAC_SUNXI=y
CONFIG_DWMAC_SUN8I=y
Searching 2083 files for "allwinner,sun8i-h3-emac"

Z:\allwinner\linux-5.1\drivers\net\ethernet\allwinner\sun8i-emac.c:
 2273  	{ .compatible = "allwinner,sun8i-a83t-emac",
 2274  	  .data = &emac_variant_a83t },
 2275: 	{ .compatible = "allwinner,sun8i-h3-emac",
 2276  	  .data = &emac_variant_h3 },
 2277  	{ .compatible = "allwinner,sun50i-a64-emac",

Z:\allwinner\linux-5.1\drivers\net\ethernet\stmicro\stmmac\dwmac-sun8i.c:
 1201  
 1202  static const struct of_device_id sun8i_dwmac_match[] = {
 1203: 	{ .compatible = "allwinner,sun8i-h3-emac",
 1204  		.data = &emac_variant_h3 },
 1205  	{ .compatible = "allwinner,sun8i-v3s-emac",

2 matches across 2 files

搜了下allwinner,sun8i-h3-emac,发现有两处位置带了这个,刚开始以为就一处,可以ping通了

root@OrangePi:~# ping www.baidu.com
PING www.baidu.com (180.101.49.11) 56(84) bytes of data.
64 bytes from 180.101.49.11: icmp_seq=1 ttl=52 time=7.10 ms
64 bytes from 180.101.49.11: icmp_seq=2 ttl=52 time=7.00 ms
64 bytes from 180.101.49.11: icmp_seq=3 ttl=52 time=6.99 ms
64 bytes from 180.101.49.11: icmp_seq=4 ttl=52 time=6.96 ms
64 bytes from 180.101.49.11: icmp_seq=5 ttl=52 time=6.94 ms
64 bytes from 180.101.49.11: icmp_seq=6 ttl=52 time=6.80 ms
64 bytes from 180.101.49.11: icmp_seq=7 ttl=52 time=6.89 ms

--- www.baidu.com ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6007ms
rtt min/avg/max/mdev = 6.805/6.959/7.105/0.097 ms
root@OrangePi:~#
# Github
kernel_GITHUB="https://github.com/orangepi-xunlong/mainline_kernel.git"
uboot_GITHUB="https://github.com/orangepi-xunlong/mainline_uboot.git"
scripts_GITHUB="https://github.com/orangepi-xunlong/mainline_scripts.git"
external_GITHUB="https://github.com/orangepi-xunlong/mainline_external.git"
toolchain_GITHUB="https://github.com/orangepi-xunlong/mainline_toolchain.git"

github下载用官方的脚本下载完全没办法下完老是断线,试着修改hosts也没有效果,最后直接下载zip包,按照官方给的脚本建立安装目录和ln -s建立软链接(参考H3SDK_Mainline_BuildEnvironment.sh)

最好的一种办法是将文件的git源码克隆到gitee

修改https://gitee.com/itom1900/OrangePi_Build/blob/master/lib/H3SDK_BuildEnvironment.sh

脚本的最后一行为

ORANGEPI_GIT="https://gitee.com/itom1900"

我这个源可能失效,gitee会保存三个月,自己克隆一个就行了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值