九、荔枝派Nano USB的Serial + RNDIS的实现

33 篇文章 1 订阅
12 篇文章 11 订阅

   一、配置Linux内核

make ARCH=arm menuconfig

如图所示

二、编译内核及安装驱动

  可以使用以下脚本文件

#! /bin/bash 
##编译内核
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8
##安装脚本驱动脚本
rm -rf ./output
ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make modules_install INSTALL_MOD_PATH=`pwd`/output/

 编译及安装结果如下

三、打包并更新镜像到设备

四、设备更新后重启

通过命令加载USB复合驱动

modprobe g_multi stall=0 removable=1 iSerialNumber=20190920 iProduct=RNDIS iManufacturer=jack

附上我的启动及加载驱动的log信息


U-Boot SPL 2018.01-05679-g013ca45-dirty (Sep 14 2019 - 09:15:39)
DRAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI


U-Boot 2018.01-05679-g013ca45-dirty (Sep 14 2019 - 09:15:39 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

Setting up a 800x480 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x100000, size 0x4000
SF: 16384 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 80e5f000, end 80e63f3e ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (root@dfd87b076607) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #12 Thu Sep 19 23:08:30 CST 2019
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: fast init done
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22672K/32768K available (6144K kernel code, 240K rwdata, 1420K rodata, 1024K init, 246K bss, 10096K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 241 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 247 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000048] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000119] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000747] Console: colour dummy device 80x30
[    0.000844] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070239] pid_max: default: 32768 minimum: 301
[    0.070570] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070617] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072149] CPU: Testing write buffer coherency: ok
[    0.073924] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076624] devtmpfs: initialized
[    0.083465] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.083541] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083824] pinctrl core: initialized pinctrl subsystem
[    0.086122] NET: Registered protocol family 16
[    0.087493] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.089426] cpuidle: using governor menu
[    0.116690] SCSI subsystem initialized
[    0.117012] usbcore: registered new interface driver usbfs
[    0.117184] usbcore: registered new interface driver hub
[    0.117410] usbcore: registered new device driver usb
[    0.117878] pps_core: LinuxPPS API ver. 1 registered
[    0.117905] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.117968] PTP clock support registered
[    0.118459] Advanced Linux Sound Architecture Driver Initialized.
[    0.120107] clocksource: Switched to clocksource timer
[    0.149220] NET: Registered protocol family 2
[    0.150931] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.151016] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.151079] TCP: Hash tables configured (established 1024 bind 1024)
[    0.151445] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.151519] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.152053] NET: Registered protocol family 1
[    0.153389] RPC: Registered named UNIX socket transport module.
[    0.153429] RPC: Registered udp transport module.
[    0.153444] RPC: Registered tcp transport module.
[    0.153460] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.155761] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.157829] Initialise system trusted keyrings
[    0.158429] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.176811] NFS: Registering the id_resolver key type
[    0.176897] Key type id_resolver registered
[    0.176922] Key type id_legacy registered
[    0.177042] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.192679] Key type asymmetric registered
[    0.192723] Asymmetric key parser 'x509' registered
[    0.192943] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.192978] io scheduler noop registered
[    0.192997] io scheduler deadline registered
[    0.193861] io scheduler cfq registered (default)
[    0.193896] io scheduler mq-deadline registered
[    0.193914] io scheduler kyber registered
[    0.195090] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.205305] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.392640] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.399773] console [ttyS0] disabled
[    0.420054] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[    0.895072] console [ttyS0] enabled
[    0.905831] panel-simple panel: panel supply power not found, using dummy regulator
[    0.915326] SCSI Media Changer driver v0.25
[    0.923539] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.928319] 4 ofpart partitions found on MTD device spi0.0
[    0.933927] Creating 4 MTD partitions on "spi0.0":
[    0.938741] 0x000000000000-0x000000100000 : "u-boot"
[    0.946660] 0x000000100000-0x000000110000 : "dtb"
[    0.954239] 0x000000110000-0x000000510000 : "kernel"
[    0.962066] 0x000000510000-0x000001000000 : "rootfs"
[    0.970501] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.977039] ehci-platform: EHCI generic platform driver
[    0.982665] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.988898] ohci-platform: OHCI generic platform driver
[    0.994652] usbcore: registered new interface driver usb-storage
[    1.001978] i2c /dev entries driver
[    1.060242] sunxi-mmc 1c0f000.mmc: base:0xed052122 irq:19
[    1.067858] usbcore: registered new interface driver usbhid
[    1.073570] usbhid: USB HID core driver
[    1.096427] NET: Registered protocol family 17
[    1.101295] Key type dns_resolver registered
[    1.108058] Loading compiled-in X.509 certificates
[    1.124701] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739e58)
[    1.133654] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc073913c)
[    1.141458] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.148064] [drm] No driver support for vblank timestamp query.
[    1.202247] Console: switching to colour frame buffer device 60x34
[    1.225486] sun4i-drm display-engine: fb0:  frame buffer device
[    1.232686] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.241842] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.253703] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.259538] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    1.269662] hub 1-0:1.0: USB hub found
[    1.273717] hub 1-0:1.0: 1 port detected
[    1.279998] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.297598] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.304441] vcc3v3: disabling
[    1.307423] ALSA device list:
[    1.310465]   #0: Loopback 1
[    1.314263] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.322975] cfg80211: failed to load regulatory.db
[    1.433275] random: crng init done
[    3.617672] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    3.637962] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[    3.646641] devtmpfs: mounted
[    3.654373] Freeing unused kernel memory: 1024K
Starting syslogd: OK
Starting klogd: OK
Populating /dev using udev: [    9.664308] udevd[77]: starting version 3.2.7
[    9.961174] udevd[77]: specified group 'kvm' unknown
[   10.166114] udevd[78]: starting eudev-3.2.7
done
Initializing random number generator... done.
Starting network: OK
# modprobe g_multi stall=0 removable=1 iSerialNumber=20190920 iProduct=RNDIS iMa
nufacturer=jack
[   29.214478] using random self ethernet address
[   29.218956] using random host ethernet address
[   29.230656] Mass Storage Function, version: 2009/09/11
[   29.235821] LUN: removable file: (no medium)
[   29.240467] LUN: removable file: (no medium)
[   29.244751] Number of LUNs=1
[   29.248955] usb0: HOST MAC 9a:06:bc:25:7b:8f
[   29.253496] usb0: MAC 9a:f9:82:06:6a:50
[   29.280346] g_multi gadget: Multifunction Composite Gadget
[   29.285864] g_multi gadget: g_multi ready
# [   29.683962] g_multi gadget: high-speed config #1: Multifunction with RNDIS
[   29.690966] gs_console_connect: port num [0] is not support console
[   29.836235] g_multi gadget: high-speed config #1: Multifunction with RNDIS
[   29.843230] gs_console_connect: port num [0] is not support console
[   29.959415] g_multi gadget: high-speed config #1: Multifunction with RNDIS
[   29.966412] gs_console_connect: port num [0] is not support console
[   30.083509] g_multi gadget: high-speed config #1: Multifunction with RNDIS
[   30.090507] gs_console_connect: port num [0] is not support console
[   30.208334] g_multi gadget: high-speed config #1: Multifunction with RNDIS
[   30.215351] gs_console_connect: port num [0] is not support console
[   30.331472] g_multi gadget: high-speed config #1: Multifunction with RNDIS
[   30.338502] gs_console_connect: port num [0] is not support console
[   30.455532] g_multi gadget: high-speed config #1: Multifunction with RNDIS
[   30.462525] gs_console_connect: port num [0] is not support console

Win10端结果如下

五、Win10下安装RNDIS驱动

    参考链接 https://www.lotlab.org/2018/07/29/record-of-using-licheepi-part-2-using-linux-gadget/

   直接上操作步骤图

 

 

 安装结果

 

六、USB复合驱动Serial + RNDIS的测试

Serial 的测试方法 《七、荔枝派Nano USB转虚拟串口实现》

RNIDS的使用方法,请参考我在海思平台写的参考文章 分别是

《二、海思平台USB转网口在Win10上的使用》

《三、海思平台通过USB转网口 桥接连接外网》

 

  以上介绍就完毕。

 

 

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值