@g4b42 has worked this out for me - you will need to modify a few files and rebuild the kernel - but its straight forward to do using fenix. How I did it yesterday:
-
download fenix and pick the options that you want, then let it run until it has downloaded linux, the ctrl-c to halt the build (when it starts building linux is when i stopped it)
-
in the linux directory apply the following changes
=> https://github.com/g4bwy/khadas-linux/commit/d9a6fe9e97bb1d2c55ed918f9fd7632d0d7dbb08
=> https://github.com/g4bwy/khadas-linux/commit/564439f83cfe63fef675991cdb94512eee14df04
=> https://github.com/g4bwy/khadas-linux/commit/d8b8378ed54d7572fa77c2f4e168a7d94b914bf2 -
start the fenix build again and press enter when asked if you want to proceed with the modified files
-
burn the resulting image to your VIM3
-
create a script called usb.sh in /root/ with the following contents and make it executable. Note that each MAC address has to be unique - so if creating multiple devices to put on the same hub then you need to change these per device.
#!/bin/sh
[ ! -d “/config” ] && mkdir /config
mount -t configfs none /config
mkdir /config/usb_gadget/g1
echo 0x18d1 > /config/usb_gadget/g1/idVendor
echo 0x4ee1 > /config/usb_gadget/g1/idProduct
mkdir /config/usb_gadget/g1/strings/0x409
echo 12345678 > /config/usb_gadget/g1/strings/0x409/serialnumber
echo Dummy > /config/usb_gadget/g1/strings/0x409/manufacturer
echo Demo > /config/usb_gadget/g1/strings/0x409/product
mkdir /config/usb_gadget/g1/configs/c.1
mkdir /config/usb_gadget/g1/configs/c.1/strings/0x409
echo “Conf 1” > /config/usb_gadget/g1/configs/c.1/strings/0x409/configuration
echo 120 > /config/usb_gadget/g1/configs/c.1/MaxPower
mkdir /config/usb_gadget/g1/functions/eem.f0
echo “66:77:88:99:aa:00” > /config/usb_gadget/g1/functions/eem.f0/host_addr
echo “00:11:22:33:44:00” > /config/usb_gadget/g1/functions/eem.f0/dev_addr
ln -s /config/usb_gadget/g1/functions/eem.f0 /config/usb_gadget/g1/configs/c.1/$
echo ff400000.dwc2_a > /config/usb_gadget/g1/UDC -
edit /etc/network/interfaces and add the following for usb0 - assumes an available DHCP server for where the device is being plugged into, can also set for a static IP address if required
auto usb0
iface usb0 inet dhcp
pre-up /root/usb.sh -
reboot and use your device with USB ethernet - a useful check to make sure its working is to use ip a or ifconfig to make sure that a) usb0 shows up as a device and b) it has an IP address assigned to it
-
ask Khadas nicely to put this config changes into the standard kernel build to save some steps