1. kernel config
<M> USB Gadget precomposed configurations
<M> Ethernet Gadget (with CDC Ethernet support)
<M> Network Control Model (NCM) support
2. build modules
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules
LD [M] drivers/usb/gadget/function/u_ether.ko
LD [M] drivers/usb/gadget/function/usb_f_ncm.ko
LD [M] drivers/usb/gadget/legacy/g_ncm.ko
LD [M] drivers/usb/gadget/libcomposite.ko
3. test on ubuntu
ubuntu ver: ubuntu 14(kernel 3.13)
test mc40 usb2.0 device in haps
3.1 config & build module, then copy these ko to ~/repo-usb/rootfs/rootfs-m/opt/ko/usb/gadget
3.2 boot kernel and insmod ko(enable NCM)
cd /opt/ko/usb/gadget/
insmod ./function/u_ether.ko
insmod libcomposite.ko
insmod ./function/usb_f_ncm.ko
insmod ./legacy/g_ncm.ko
after insmod ./legacy/g_ncm.ko:
[ 628.442369] using random self ethernet address
[ 628.501629] using random host ethernet address
[ 628.606386] usb0: HOST MAC 06:58:53:5b:52:79
[ 628.634146] usb0: MAC 32:03:c1:66:a6:d0
[ 628.658956] g_ncm gadget: NCM Gadget
[ 628.668534] g_ncm gadget: g_ncm ready
[ 636.719628] g_ncm gadget: high-speed config #1: CDC Ethernet (NCM)
3.3 check if usb ethernet is ok or not
1) on device side
2) on pc host side
3.4 configure
1) device
ifconfig usb0 up
ifconfig usb0 192.168.1.2
2) pc host
ifconfig usb0 192.168.1.3
3.5 ping test
1) pc host
ping 192.168.1.2
2) device
ping 192.168.1.3