Skip to content

Instantly share code, notes, and snippets.

@wuhanstudio
Last active January 17, 2022 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wuhanstudio/a77fc07aaaef05730a4f51dbf83c41fc to your computer and use it in GitHub Desktop.
Save wuhanstudio/a77fc07aaaef05730a4f51dbf83c41fc to your computer and use it in GitHub Desktop.
g_serial as USB serial console
#/bin/bash
# Enable kernel module
echo "g_serial" >> /etc/modules
nano /etc/inittab
```
::respawn:/sbin/getty -L ttyAM0 115200 vt100
::respawn:/sbin/getty -L ttyGS0 115200 vt100
```
# Add systemd service
mkdir -p /etc/systemd/system/serial-getty@ttyGS0.service.d
nano /etc/systemd/system/serial-getty@ttyGS0.service.d/10-switch-role.conf
```
[Service]
ExecStartPre=-/bin/sh -c "echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role"
```
# Start service
systemctl --no-reload enable serial-getty@ttyGS0.service
echo "ttyGS0" >> /etc/securetty
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment