35 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Verify network device exists, and reboot if it does not
# This is a workaround for the case where the PCIe phy does not initialize,
# which happens a few percent of the time. The user-facing effect is that
# startup takes about 20 seconds longer if the phy does not initialize.
#
# It would be better to do this from the initrd.
#
# It would be better still to fix the PCIe driver to reset and try again (or
# something). Simple fixes (e.g. increasing the training time) did not work.
# The imx6 PCIe driver in the 3.14.38 BSP is considerably different from the
# one in the 3.10.17 BSP, so perhaps it will be fixed when we update.
kmsg() {
echo "$@" > /dev/kmsg
}
# wlan0 exists on both solo and controller
# (although normally it is not used on controller)
kmsg -n "Checking wlan0... "
if [ ! -e /sys/class/net/wlan0 ]; then
kmsg "NOT FOUND"
# all logs except boot have been rotated at this point;
# stop and rotate it keep them all in sync
/etc/init.d/bootlogd stop
shutdown -r now
# don't let any more startup scripts start
sleep 60
else
kmsg "OK"
fi