Skip to content

Add Kernel Module Configuration for USB Gadget #10

@mihai-chiorean

Description

@mihai-chiorean

Description

USB gadget requires specific kernel modules that may not be enabled by default. Need to ensure they're built and loaded.

Required Kernel Modules

CONFIG_USB_CONFIGFS=m
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_F_NCM=m
CONFIG_USB_F_ECM=m
CONFIG_USB_F_RNDIS=m
CONFIG_USB_GADGET=y
CONFIG_USB_DWC2=m
CONFIG_USB_DWC2_DUAL_ROLE=y

Implementation Approaches

1. Kernel Config Fragment

Create meta-edgeos/recipes-kernel/linux/linux-raspberrypi/usb-gadget.cfg:

CONFIG_USB_CONFIGFS=m
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_F_NCM=m
CONFIG_USB_F_ECM=m
CONFIG_USB_F_RNDIS=m
CONFIG_USB_F_EEM=m
CONFIG_USB_F_SUBSET=m
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_USB_DWC2=m
CONFIG_USB_DWC2_DUAL_ROLE=y

2. Kernel Recipe bbappend

# linux-raspberrypi_%.bbappend
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://usb-gadget.cfg"

3. Update Package Group

# packagegroup-edgeos-kernel.bb
RDEPENDS:${PN} = " \
    kernel-module-libcomposite \
    kernel-module-usb-f-ncm \
    kernel-module-usb-f-ecm \
    kernel-module-usb-f-rndis \
    kernel-module-dwc2 \
    "

4. Module Loading Configuration

# /etc/modules-load.d/usb-gadget.conf
dwc2
libcomposite

Acceptance Criteria

  • All required modules built as part of kernel
  • Modules auto-load at boot
  • libcomposite loads before gadget setup
  • Works without manual modprobe
  • Module dependencies handled correctly
  • Configuration works for both RPi 4 and RPi 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions