Enable 'failsafe' ttyUSB0 login shell
Posted: Sun May 17, 2020 12:23 pm
I have a VoCore2 Ultimate which is in a nice standard plastic case. I was experimenting installing LIRC to it and built a custom firmware for it (quite a learning process, but an enjoyable one). Of course as part of this I managed to semi-brick it a couple of times, having it not respond to Wifi nor the ethernet port. So I had to get it out of the case and connect an usb to serial converter to it to get a login prompt.
To avoid doing this, I added support for a login shell on /dev/ttyUSB0 in my custom firmware:
So now when I'm in trouble I can insert a usb to serial converter in the USB port of the VoCore2, connect the TX and RX pins to the RX and TX pins of another usb to serial converter in my PC, connect with a terminal program (115200,n,8,1) and I'm greeted with a login prompt.
While this does not give you uboot access, it does allow you to inspect the system and manually correct it even do a firmware upgrade. You can execute 'uudecode' on the VoCore2 and then upload a uuencoded firmware.bin to the serial connection. It will take a while but then you can flash it manually.
Maybe this is something to enable in the default firmware for the Vocore and Vocore2?
To avoid doing this, I added support for a login shell on /dev/ttyUSB0 in my custom firmware:
- Enable the kernel modules kmod-usb-serial and kmod-usb-serial-pl2303 (you can add other kmod-usb-serial-xxx's as well)
- Enable 'getty' in the busybox 'Login/Password Management Utilities' and 'uudecode' in the 'Core Utilities'
- Added the line 'ttyUSB0::respawn:/sbin/getty -L ttyUSB0 115200 vt100' to the '/etc/inittab' file, by adding a copy of it as 'files/etc/inittab' in the openwrt build directory:
- Code: Select all
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
::askconsole:/usr/libexec/login.sh
ttyUSB0::respawn:/sbin/getty -L ttyUSB0 115200 vt100
So now when I'm in trouble I can insert a usb to serial converter in the USB port of the VoCore2, connect the TX and RX pins to the RX and TX pins of another usb to serial converter in my PC, connect with a terminal program (115200,n,8,1) and I'm greeted with a login prompt.
While this does not give you uboot access, it does allow you to inspect the system and manually correct it even do a firmware upgrade. You can execute 'uudecode' on the VoCore2 and then upload a uuencoded firmware.bin to the serial connection. It will take a while but then you can flash it manually.
Maybe this is something to enable in the default firmware for the Vocore and Vocore2?