jetson TX2 USB virtual network

Hi,
i try to make a USB virtual network.I hope PC can communicate with jetson TX2 via USB port. For example, run shell command “ifconfig -a”,then show all network device including “usb0”

……
usb0

Link encap:Ethernet HWaddr 5E:C5:F6:D4:2B:91
inet addr:192.168.1.120 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:253 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:35277 (34.4 KiB) TX bytes:10152 (9.9 KiB)

In default, “usb0” network device don’t exist. How to set the config file in kernel source.My kernel version 4.4.38, config file tegra18_defconfig.

THANKS

I see below info on r28.2.1 by default.

nvidia@tegra-ubuntu:~$ ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:7b:4c:37:4d
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          UP 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:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:04:4b:8c:79:ad
          inet addr:10.19.106.135  Bcast:10.19.107.255  Mask:255.255.254.0
          inet6 addr: fe80::1369:8f63:2a43:7914/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:67478 errors:0 dropped:0 overruns:0 frame:0
          TX packets:444 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10799722 (10.7 MB)  TX bytes:310395 (310.3 KB)
          Interrupt:42

l4tbr0    Link encap:Ethernet  HWaddr 7a:40:d4:a0:64:50
          inet addr:192.168.55.1  Bcast:192.168.55.255  Mask:255.255.255.0
          inet6 addr: fe80::b4ec:a1ff:fed5:6671/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3811 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:751135 (751.1 KB)  TX bytes:6823 (6.8 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:204 errors:0 dropped:0 overruns:0 frame:0
          TX packets:204 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:15607 (15.6 KB)  TX bytes:15607 (15.6 KB)

usb0      Link encap:Ethernet  HWaddr 7a:40:d4:a0:64:50
          inet6 addr: fe80::7840:d4ff:fea0:6450/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1937 errors:1937 dropped:0 overruns:0 frame:1937
          TX packets:1632 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:381055 (381.0 KB)  TX bytes:360917 (360.9 KB)

usb1      Link encap:Ethernet  HWaddr e2:29:a1:75:6b:27
          inet6 addr: fe80::e029:a1ff:fe75:6b27/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1874 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1686 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:370080 (370.0 KB)  TX bytes:297888 (297.8 KB)

wlan0     Link encap:Ethernet  HWaddr 00:04:4b:8c:79:ab
          UP 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)

Do you flash r28.2.1?

Hi DaneLLL,
How are you?

Yes,i flash TX2 with r28.2.1. And i download Jetpack 3.3, and flash the TX2 with command “sudo ./flash.sh jetson-tx2 mmcblk0p1”.

In the kernel top folder “public_sources/kernel_src/kernel/kernel-4.4/”, build and install the kernel as following steps
1.firstly, set the default config file
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- tegra18_defconfig
2.secondly, built the kernel
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4
3.copy the kernel file to the fold to be flashed
cp -arf arch/arm64/boot/Image /home/Jetpack3.3/64_TX2/Linux_for_Tegra/kernel
cp -arf arch/arm64/boot/Image /home/Jetpack3.3/64_TX2/Linux_for_Tegra/rootfs/boot/
4.flash the jetson TX2 in recovery mode
sudo ./flash.sh jetson-tx2 mmcblk0p1

Is there anything wrong?

Hi xilaiwojia,
Can you try to flash default kernel? I mean do clean flash via Jetpack.

OK,i make a try.

Thank you, it’ok now, even if i replace the kernel and dtb file.Maybe i make something wrong.

By the way, the network interface “USB0” refer to the “USB 2.0 Micro A B” and “USB1” refer to “USB 2.0 type A” ?

In another word, is the network interface “USB0” physically J20 on Carrier Board, and “USB1” J19 ?

Hi xilaiwojia,
The numbers only stand for the order of registration of the usb net devices and doesn’t associated to physical ports.

I’m looking at R28.2. This has an example ethernet gadget (USB pretending to be an ethernet adapter) which shows from “ifconfig” as “usb1”. You can make adjustments to this without touching the kernel (well…you can make some adjustments, e.g., IP address). Examine:

/opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode.sh

On the dev carrier board only the micro-OTG port has the wiring to act as device. Unless you use a different carrier, then only this port, with a micro-B USB connector, can provide a device of any kind. Other ports can only be host mode on the dev carrier.

I could never get the TX2-as-USB-ethernet thing to work until now.

I finally got it to work by editing the script:

/opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode.sh

I changed “enable_ecm” to 0:

enable_ecm=0

And I got rid of the Ethernet bridge and use the device directly:

#/sbin/brctl addbr l4tbr0
#/sbin/ifconfig l4tbr0 ${net_ip} netmask ${net_mask} up

if [ ${enable_rndis} -eq 1 ]; then
    #/sbin/brctl addif l4tbr0 "$(cat functions/rndis.usb0/ifname)"
    #/sbin/ifconfig "$(cat functions/rndis.usb0/ifname)" up
    /sbin/ifconfig "$(cat functions/rndis.usb0/ifname)" ${net_ip} netmask ${net_mask} up
fi

if [ ${enable_ecm} -eq 1 ]; then
    #/sbin/brctl addif l4tbr0 "$(cat functions/ecm.usb0/ifname)"
    #/sbin/ifconfig "$(cat functions/ecm.usb0/ifname)" up
    /sbin/ifconfig "$(cat functions/rndis.usb0/ifname)" ${net_ip} netmask ${net_mask} up
fi

Now it works as expected – it shows up as a USB ethernet adapter on my workstation. I set my IP to 192.168.55.2 (netmask 255.255.255.0), and I can ssh to 192.168.55.1.

Good to know it works, thanks for the feedback!