![usbnet 无法与 19.10 Raspberry Pi 4(2G DRAM)配合使用](https://linux22.com/image/1067654/usbnet%20%E6%97%A0%E6%B3%95%E4%B8%8E%2019.10%20Raspberry%20Pi%204%EF%BC%882G%20DRAM%EF%BC%89%E9%85%8D%E5%90%88%E4%BD%BF%E7%94%A8.png)
我尝试在具有 2G 内存的 Raspberry Pi 4 上运行 IP over USB。在相同的硬件设置下,usbnet 与 Raspbian 配合良好
usrcfg.txt(没有 dr_mode=peripheral 似乎没有什么区别)
dtoverlay=dwc2,dr_mode=peripheral
nobtcmd.txt:
net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait modules-load=dwc2,g_ether fixrtc
root@ubuntu:/boot/firmware# ip a show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group defa
ult qlen 1000
link/ether dc:a6:32:02:a2:77 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.132/24 brd 192.168.1.255 scope global dynamic eth0
valid_lft 85802sec preferred_lft 85802sec
inet6 fe80::dea6:32ff:fe02:a277/64 scope link
valid_lft forever preferred_lft forever
root@ubuntu:/boot/firmware# ip a show usb0
Device "usb0" does not exist.
root@ubuntu:/boot/firmware# lsmod | grep g_ether
g_ether 16384 0
usb_f_rndis 45056 1 g_ether
u_ether 32768 2 usb_f_rndis,g_ether
libcomposite 77824 2 usb_f_rndis,g_ether
root@ubuntu:/boot/firmware#
我认为这是问题的线索:
[ 9.117963] udc-core: couldn't find an available UDC - added [g_ether] to list
答案1
问题是内核配置没有包含它。设置 CONFIG_USB_DWC2_DUAL_ROLE 和 CONFIG_USB_OTG 后需要重建内核。