您尚未登录。

楼主 # 2022-07-01 14:31:59

linux-xc
会员
注册时间: 2022-06-28
已发帖子: 29
积分: 51

linux-zero-5.2.y 启动后没有usb0

烧录网友提供的.dd镜像可以找到usb0设备,联网,但是自己重新编译的内核更换原来的内核后,就无法找到usb0了。

原镜像:lichee_zero-mindb_alpha.dd

下面是内核启动信息:

root@LicheePi:~# dmesg | grep Failed
[    1.714166] systemd[1]: Failed to insert module 'autofs4'
[    1.723517] systemd[1]: Failed to insert module 'ipv6'
root@LicheePi:~# dmesg | grep fail
[    2.199104] systemd[1]: Cannot add dependency job for unit dbus.socket, ignoring: Unit dbus.socket failed to load: No such file or directory.
[    2.219032] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.
root@LicheePi:~# dmesg | grep usb
[    0.036043] usbcore: registered new interface driver usbfs
[    0.036117] usbcore: registered new interface driver hub
[    0.036236] usbcore: registered new device driver usb
[    0.092828] sun4i-usb-phy 1c19400.phy: Couldn't request ID GPIO
[    0.744784] ehci-platform 1c1a000.usb: EHCI Host Controller
[    0.750494] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[    0.758493] ehci-platform 1c1a000.usb: irq 25, io mem 0x01c1a000
[    0.788124] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[    0.815898] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[    0.822649] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 2
[    0.830627] ohci-platform 1c1a400.usb: irq 26, io mem 0x01c1a400
[    0.914410] usbcore: registered new interface driver usb-storage
[    1.009743] usbcore: registered new interface driver usbhid
[    1.015344] usbhid: USB HID core driver
[    1.103476] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.122653] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.132421] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 3
[    1.648878] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    2.241261] usb 1-1.4: new high-speed USB device number 3 using ehci-platform

dmesg打印表明无法加载autofs4、ipv6模块,应该是找不到usb0导致的


以下的ifconfig打印信息:

root@LicheePi:~# ifconfig -a
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

然后根据网上办法配置内核,仍无法找到 usb0

来源:https://wiki.sipeed.com/soft/Lichee/zh/Zero-Doc/application/otg2PC.html

Location:
-> Device Drivers
    -> USB support (USB_SUPPORT [=y])
        -> USB Gadget Support (USB_GADGET [=y])
            <*>   USB Gadget precomposed configurations (Ethernet Gadget (with CDC Ethernet support))

离线

楼主 #1 2022-07-01 14:57:52

linux-xc
会员
注册时间: 2022-06-28
已发帖子: 29
积分: 51

Re: linux-zero-5.2.y 启动后没有usb0

在内核编译阶段,通过编译模块/安装模块操作,成功在zero上打印出usb0
来源:https://wiki.sipeed.com/soft/Lichee/zh/Zero-Doc/System_Development/kernel_build.html

root@LicheePi:~# ifconfig -a
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

usb0      Link encap:Ethernet  HWaddr 36:e4:4c:4f:16:e0
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

尝试 ifconfig usb0 192.168.2.140
成功设置ip,但无法ping通任何地址

尝试 dhclient usb0
终端阻塞,无法进行操作,只能退出

下面是dmseg

root@LicheePi:~# dmesg | grep usb
[    0.035933] usbcore: registered new interface driver usbfs
[    0.036024] usbcore: registered new interface driver hub
[    0.036144] usbcore: registered new device driver usb
[    0.094043] sun4i-usb-phy 1c19400.phy: Couldn't request ID GPIO
[    0.748340] ehci-platform 1c1a000.usb: EHCI Host Controller
[    0.753989] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[    0.762007] ehci-platform 1c1a000.usb: irq 25, io mem 0x01c1a000
[    0.798038] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[    0.825835] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[    0.832579] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 2
[    0.840560] ohci-platform 1c1a400.usb: irq 26, io mem 0x01c1a400
[    0.924383] usbcore: registered new interface driver usb-storage
[    1.029700] usbcore: registered new interface driver usbhid
[    1.035302] usbhid: USB HID core driver
[    1.123599] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.142955] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.152849] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 3
[    1.200877] usb0: HOST MAC 86:5c:88:05:1e:fc
[    1.209109] usb0: MAC ce:80:1a:f9:af:7c
[    1.648097] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    2.296028] usb 1-1.4: new high-speed USB device number 3 using ehci-platform

最近编辑记录 linux-xc (2022-07-01 15:07:21)

离线

楼主 #2 2022-07-01 15:45:53

linux-xc
会员
注册时间: 2022-06-28
已发帖子: 29
积分: 51

Re: linux-zero-5.2.y 启动后没有usb0

查到一种办法:设置网关
来源:https://blog.csdn.net/yanhe156/article/details/79664166

route add default gw 192.168.2.1

成功设置网关,但依然无法ping通

新现象,OTG所连USB转网口闪灯

最近编辑记录 linux-xc (2022-07-01 15:46:55)

离线

楼主 #3 2022-07-01 19:57:23

linux-xc
会员
注册时间: 2022-06-28
已发帖子: 29
积分: 51

Re: linux-zero-5.2.y 启动后没有usb0

找到办法了,完全查看内核配置的各个选项后,发现内核配置没有勾选USB的网络相关驱动。
不知道官方为什么没有默认选择这部分驱动?

因此,我直接将所有相关驱动都加载进去了
应该是某个驱动实现了,但暂时并不清楚,有待前辈指点。

具体方法,在内核源码目录输入 make ARCH=arm menuconfig   

Device Drivers  --->  
    [*] Network device support  ---> 
         <*>   USB Network Adapters  --->
                子选项全部勾选,子选项的子选项默认即可

此外,还可以自行搜索以下配置打勾(根据自身需要打勾)(按键盘 / 键可以搜索)

DNS Resolver support

Generic failover module

Network block device support

USB CATC NetMate-based Ethernet device support

最近编辑记录 linux-xc (2022-07-01 19:58:15)

离线

楼主 #4 2022-07-01 20:00:22

linux-xc
会员
注册时间: 2022-06-28
已发帖子: 29
积分: 51

Re: linux-zero-5.2.y 启动后没有usb0

最后,开机自动联网,无需任何设置,打印如下:

root@LicheePi:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:e0:4c:36:8c:02
          inet addr:192.168.2.140  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2041 errors:0 dropped:0 overruns:0 frame:0
          TX packets:604 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:177681 (173.5 KiB)  TX bytes:49013 (47.8 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
root@LicheePi:~# dmesg | grep eth
[    0.751291] usbcore: registered new interface driver kaweth
[    0.798710] usbcore: registered new interface driver cdc_ether
[    0.821952] usbcore: registered new interface driver ipheth
[    1.021969] udc-core: couldn't find an available UDC - added [g_ether] to list of pending drivers
[    1.274370] using random self ethernet address
[    1.282887] using random host ethernet address
[    1.307668] using random self ethernet address
[    1.315749] using random host ethernet address
[    1.323768] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[    1.333902] g_ether gadget: g_ether ready
[    2.931592] r8152 1-1.4:1.0 eth0: v1.09.10
[    7.666881] r8152 1-1.4:1.0 eth0: carrier on
root@LicheePi:~# ping www.baidu.com
PING www.a.shifen.com (183.232.231.174) 56(84) bytes of data.
64 bytes from 183.232.231.174: icmp_seq=1 ttl=57 time=10.4 ms
64 bytes from 183.232.231.174: icmp_seq=2 ttl=57 time=11.4 ms
64 bytes from 183.232.231.174: icmp_seq=3 ttl=57 time=11.3 ms
64 bytes from 183.232.231.174: icmp_seq=4 ttl=57 time=11.8 ms
64 bytes from 183.232.231.174: icmp_seq=5 ttl=57 time=11.6 ms
64 bytes from 183.232.231.174: icmp_seq=6 ttl=57 time=11.5 ms
64 bytes from 183.232.231.174: icmp_seq=7 ttl=57 time=10.6 ms
64 bytes from 183.232.231.174: icmp_seq=8 ttl=57 time=11.3 ms
^C
--- www.a.shifen.com ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7010ms
rtt min/avg/max/mdev = 10.438/11.279/11.805/0.472 ms

最近编辑记录 linux-xc (2022-07-01 20:01:15)

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn