LibreELEC.tv icon indicating copy to clipboard operation
LibreELEC.tv copied to clipboard

adjust RPi4 kernel config for dwc2 and gadgets

Open lrusak opened this issue 2 years ago • 7 comments

This adds the ability to use the RPi4 USB-C port as a gadget peripheral. I've tested the g_serial, g_ether, and g_mass_storage modules.

This also adds a commit to correct some missing kernel config options by using ./tools/adjust_kernel_config.

To use these modules you just need to load them.

g_ether creates a network device.

g_serial creates a serial device. To use this you need to add the following to /flash/cmdline.txt:

console=ttyGS0,115200 systemd.debug-shell=1

Then you need to adjust the systemd debug-shell service. systemctl edit debug-shell.service:

[Service]
TTYPath=/dev/ttyGS0
systemctl daemon-reload
systemctl restart debug-shell

Then you can access the serial device on your workstation. On mine it's via

screen /dev/ttyACM0 115200

g_mass_storage is used like so:

modprobe g_mass_storage file=/dev/sda

lrusak avatar May 06 '22 02:05 lrusak

@lrusak RPi4: linux: correct kernel config using ./tools/adjust_kernel_config Is it just wrong for RPi4 ? If not, better to fix it for every platform in a dedicated pr.

After merge pls add a howto to the wiki or the information how its done is basically lost.

CvH avatar May 06 '22 10:05 CvH

@lrusak

RPi4: linux: correct kernel config using ./tools/adjust_kernel_config

Is it just wrong for RPi4 ? If not, better to fix it for every platform in a dedicated pr.

The same thing is in #6459 and would likely need to fix the kernel config for a few platforms.

After merge pls add a howto to the wiki or the information how its done is basically lost.

Meh, it was merged over a year ago in #5044 and much of the team was involved. My contribution time is limited so if someone else wants to do it they can go right ahead.

lrusak avatar May 06 '22 15:05 lrusak

Merge?

lrusak avatar May 07 '22 23:05 lrusak

A bump comments after 2 days, really? Please give us some time to review,

From a quick glance you forgot to add RPi2 (RPi Zero 2 has USB OTG too) and optionally RPi (not in our official builds, but in master too and RPi Zero has USB OTG as well)

Also please drop the commit with the transient config data from adjust_kernel_config, that just add clutter

HiassofT avatar May 08 '22 00:05 HiassofT

A bump comments after 2 days, really? Please give us some time to review,

From a quick glance you forgot to add RPi2 (RPi Zero 2 has USB OTG too) and optionally RPi (not in our official builds, but in master too and RPi Zero has USB OTG as well)

I don't have the device to test with.

Also please drop the commit with the transient config data from adjust_kernel_config, that just add clutter

But I want it as it's the most correct output when using ./tools/adjust_kernel_config

lrusak avatar May 09 '22 20:05 lrusak

Just add the kernel options for RPi and RPi2 and build-test RPi2 - that's enough. I can't runtime-test RPi4 either so if it doesn't work then meh, so be it :)

HiassofT avatar May 09 '22 21:05 HiassofT

As for the transient settings: you may want them, but I don't, I prefer an uncluttered history. And as you already have them as a separate commit I kindly ask you to drop that commit.

HiassofT avatar May 09 '22 21:05 HiassofT