Linux – Configuring TTY Over USB on Headless System

linuxlinux-kernel

I have an IMX8MM (tx8m-1610) based linux system. I use a usb connection to flash new software on it and then i switch to either the serial debug port or ssh to continue working on the system.

I would like to set the system up in such a way that after flashing a new rootfs or kernel on it, i can simply remove the "boot from usb" jumper, reboot and then have it show up as a usb device through which i can get into the console.

i have

CONFIG_USB_SERIAL=y

CONFIG_USB_SERIAL_CONSOLE=y

CONFIG_USB_SERIAL_GENERIC=y

enabled in the kernel config
and in my dtb the usb device is defined as a peripheral device.

usbg1: usbg1 {
    compatible = "fsl,imx27-usb-gadget";
    chipidea,usb = <&usbotg1>;
    dr_mode = "peripheral";
    status = "okay";
};

&usbotg1 {
    dr_mode = "peripheral";
    status = "okay";
};

&usbotg2 {
    dr_mode = "peripheral";
    status = "okay";
};

i enable and start getty@ttyUSB0

but it still doesn't show up as a usb device.

I can't find much other information sources online.

linux kernel 5.15.32
debian 11 bullseye

edit:

okay i got a little further, i managed to get it working, unfortunately my method required me to run depmod, which means i have to have access to the terminal before i can make it work.

While the goal is to switch from flashing new software to tty over usb without getting into the terminal by some other means inbetween.

Best Answer

Okay I found the solution

CONFIG_USB_G_SERIAL=y was set to m instead of y in the kernel configuration

after this i could systemctl enable getty@ttyGS0 in my rootfs

and after flashing it was detected by my host as a serial device and i could use it with Screen.

Related Question