Jump to content

Enable serial access through USB OTG interface before 1st boot


Recommended Posts

The orange pi zero has a USB OTG interface, which can be used to interact with it in the absence of networks and spare USB-UART converters.

 

This is not enabled by default in the Armbian image.

 

Here I describe how to modify the system image before first boot to enable this.

 

  • First, mount the freshly written SD card on a linux computer,
  • become root, and
  • change directory to the mount point, that is, the root directory of the SD card.

The following couple of steps were taken from https://oshlab.com/enable-g_serial-usb-otg-console-orange-pi-armbian/which describes how to enable this in a live system, i.e. after first boot. The steps are modified to work on the mounted SD card image. Basically, the first slash before etc is removed.

 
  • echo "g_serial" >>etc/modules
  • echo "ttyGS0" >>etc/securetty
  • mkdir etc/systemd/system/serial-getty@ttyGS0.service.d
  • Create new file etc/systemd/system/serial-getty@ttyGS0.service.d/10-switch-role.conf with contents
[Service]
ExecStartPre=-/bin/sh -c "echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role"
 
The guide for the live system then calls systemctl enable which you cannot do here since the system to be modified is not running and you can also not chroot into it because of the ARM architecture. Instead, duplicate that command's effect by creating a symlink:
 
  • ln -s /lib/systemd/system/serial-getty@.service etc/systemd/system/getty.target.wants/serial-getty@ttyGS0.service
Note there is a slash before lib, but again no slash before etc.
 
Now unmount the sd card, insert into the orangepizero, power it from a USB port of your computer, or, to be safe, put a powered USB hub between your computer and the orangepizero.
 
Wait for the orangepizero to cycle through its first automatic reboot. You can recognize the reboot by the simultaneous flashing of the RJ45 LEDs.
 
Now you can establish the serial connection with
screen /dev/ttyACM0 115200

and login as root from there.

 

May also work for other boards with USB OTG.

Link to comment
Share on other sites

You mentioned that it should work with the nightly built images.... but I am on 5.24.170119 (OPI Zero)

and I am not sure if the serial gadget / g_serial is properly installed...

my installation is missing the "/sys/bus/platform/devices/sunxi_usb_udc/" folder. So any attempt to activate it fails.

Link to comment
Share on other sites

OPI Win Plus +  Ubuntu Desktop 16.04.3 LTS, does not have enabled serial OTG.

Trying to follow advice from this topic I got (in system log) as follows: 

...................

dev-ttyGS0.device: Job dev-ttyGS0.device/start timed out.
Mar 29 13:19:32 localhost systemd[1]: Timed out waiting for device dev-ttyGS0.device.
Mar 29 13:19:32 localhost systemd[1]: Dependency failed for Serial Getty on ttyGS0.
Mar 29 13:19:32 localhost systemd[1]: serial-getty@ttyGS0.service: Job serial-getty@ttyGS0.service/start failed with result 'dependency$
Mar 29 13:19:32 localhost systemd[1]: dev-ttyGS0.device: Job dev-ttyGS0.device/start failed with result 'timeout'.
...................

 

Please help!

 

Otherwise all seem to work very well., for now.

 

 

 

 

Link to comment
Share on other sites

Hi,

i have a live system running (Armbian on Orange Pi PC2). i found the Serial OTG on the microUSB is not work. and i didn't modified the image in the SD as described above before first boot.

so now i only need to create the symbolic link in /lib/systemd/system as shown above?

i checked there is nothing in my /etc/modules and no ttyGS0 in my etc/securetty and no serial-getty@.service in /lib/systemd/system

 

any help here?

thanks!

Joseph

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines