Skip to content

USB gadget 101 tutorial, add more references and details #311

@orangecms

Description

@orangecms

We have a brief section in the README, but it needs more details.

add reference: https://www.kernel.org/doc/html/latest/driver-api/usb/gadget.html

networking

[x] Include configuring an IP address, be it via DHCP or statically.
The latter is currently not yet offered by cpud itself. See #312.
Note that cpud would also spawn a shell, and that could in turn run an rc script, but that becomes complex for the end user and build process.

So far, cpud calls into external programs.
[ ] Note that the rootfs will need a DHCP client (dhclient) or an ip (or similar) command.

[ ] Also mention the possibility to use NFS now and the direct 9p over USB driver (usb9pfs) that Pengutronix added, though it would need corresponding userspace setup code.
https://pengutronix.de/de/blog/2025-01-22-pengutronix-at-fosdem-2025.html

[x] USB gadgets should have static MAC addresses for consistency. Then a laptop on the other side can rely on its own static counterpart config.

[x] Note that USB ethernet vs CDC ethernet+serial require different cmdline args:
g_ether.dev_addr+g_ether.host_addr vs g_cdc.dev_addr + g_cdc.host_addr

drivers

[x] Remove RNDIS from the suggested drivers.

Not fully confirmed, may be a bug in the older vendor kernel I had in this instance: I found it to clash with the regular ethernet emulation driver, resulting in network not working. A usb0 device would show up, and with IP addresses assigned on both sides, no ping would respond.

RNDIS has a long story of issues and attempts to be dropped entirely.
https://www.phoronix.com/news/Linux-RNDIS-Removal-EOY2024

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions