Skip to main content

SDK Related - RNDIS

Navigation bar

Default image: the current image cannot enable RNDIS; you must change the configuration and rebuild the kernel and rootfs.

Device Status​

Already SSH'd into root@10.0.0.102 (the 10.102 you wrote is this machine):

ItemResult
BoardRV1126BP EVB1 V12, aarch64, Buildroot
Imagerockchip_rv1126b_ipc (64-bit IPC)
USBgadget service is running, ADB only (USB_FUNCS="adb", PID 0x0006)
UDC21500000.usb, state not attached (OTG port not connected to the computer)
KernelNo CONFIG_USB_CONFIGFS_RNDIS, and no module directory

Tried creating gadget functions on site: rndis / ecm / ncm all fail (No such file or directory). The running kernel has no USB network adapter function; changing the script is useless.

Conclusion​

RNDIS requires enabling in two places at the same time:

  1. Kernel: build in CONFIG_USB_CONFIGFS_RNDIS
  2. rootfs: the USB gadget service adds rndis to the function list and assigns an IP to usb0

The SDK defaults have neither enabled: RK_USB_ADBD=y, RK_USB_RNDIS not enabled; the 64-bit rockchip_linux_defconfig also has no RNDIS. kernel-6.1/arch/arm/configs/rv1126b-rndis.config is a 32-bit fragment and does not apply to this aarch64 board.


Specific Changes​

Corresponding defconfig: device/rockchip/rv1126b/rockchip_rv1126bp_ipc_64_evb1_v10_defconfig
(The DTS is rv1126bp-evb1-v12, consistent with the device compatible.)

1. SDK: enable the RNDIS gadget​

File: device/rockchip/rv1126b/rockchip_rv1126bp_ipc_64_evb1_v10_defconfig

Add:

RK_USB_RNDIS=y

Or configure interactively:

make rockchip_rv1126bp_ipc_64_evb1_v10_defconfig
make config-usb-gadget

Enable Remote Network Driver Interface Specification (RNDIS) in the USB gadget menu.
overlay-usb-gadget.sh writes rndis into USB_FUNCS in /etc/profile.d/usb-gadget.sh (it becomes adb rndis).

2. Kernel: enable the RNDIS function (required)​

64-bit automatically overlays kernel-6.1/arch/arm64/configs/rv1126b.config. Add at the end of this file:

CONFIG_USB_CONFIGFS_RNDIS=y

Kconfig will also select USB_F_RNDIS and USB_U_ETHER.
Do not use arch/arm/configs/rv1126b-rndis.config; that is 32-bit and also turns USB into modules.

Or:

make kernel-config

Path: Device Drivers → USB support → USB Gadget Support → USB Gadget functions configurable through configfs → RNDIS

3. Assign an IP to the USB network adapter​

There is already an example in the gadget script; it needs to be made into a hook. Create:

device/rockchip/rv1126b/rndis.sh

#!/bin/sh
rndis_post_start_hook()
{
while ! ifconfig usb0 >/dev/null 2>&1; do
sleep .1
done
ifconfig usb0 192.168.42.1 netmask 255.255.255.0
}

Add to the same defconfig:

RK_USB_HOOKS="rndis.sh"

It is installed to /etc/usb-gadget.d/ at build time. 192.168.42.1 avoids conflict with the existing eth0 10.0.0.102/22.

4. Build and flash​

make kernel
make recovery # if rootfs/overlay are also changed
make

At minimum update boot.img (kernel) and rootfs. If you flash only rootfs without the kernel, the device still cannot create rndis.0.

5. Wiring and host​

  • Connect the board's USB OTG (DWC3 21500000.usb) to the computer; do not use a normal Host port.
  • The device side should show usb0 with address 192.168.42.1.
  • On the computer side, assign 192.168.42.2/24 to the USB network adapter, then ping 192.168.42.1.

Windows can usually recognize RNDIS directly. Your development machine is macOS, whose system does not include an RNDIS driver; if the USB is plugged into a Mac, you should enable ECM instead (RK_USB_ECM=y + CONFIG_USB_CONFIGFS_ECM=y), not RNDIS.


Confirm on the Device After Flashing​

cat /etc/profile.d/usb-gadget.sh          # should contain rndis
mkdir /sys/kernel/config/usb_gadget/rockchip/functions/rndis.0 # should succeed
cat /sys/class/udc/21500000.usb/state # should be configured after connecting to the computer
ifconfig usb0
usb-gadget restart

The current image has no kernel RNDIS; temporarily changing USB_FUNCS on the device will not take effect. If needed, I can directly modify these three files in the SDK.

AI Translation Notice

This page was translated into English by AI and is provided for reference only. The original document is written in Chinese. If there is any discrepancy, the Chinese version prevails.

本页英文内容由 AI 自动翻译生成,仅供参考;原文为中文,如有差异请以中文原文为准。

查看中文原文 / View the Chinese original →