Last active
January 17, 2022 21:01
-
-
Save wuhanstudio/a77fc07aaaef05730a4f51dbf83c41fc to your computer and use it in GitHub Desktop.
g_serial as USB serial console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/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/[email protected] | |
nano /etc/systemd/system/[email protected]/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 [email protected] | |
echo "ttyGS0" >> /etc/securetty | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment