armhwinfo: Some shutdown improvements.

Discussion at https://github.com/igorpecovnik/lib/issues/522
This commit is contained in:
Thomas Kaiser 2016-10-28 11:09:06 +02:00 committed by GitHub
parent 420757fd8a
commit 7d54789a9e

View File

@ -276,25 +276,23 @@ case $1 in
*stop*)
# set verbosity=1 only if set to 7 and /boot/.force-verbose doesn't exist.
if [ ! -f /boot/.force-verbose ]; then
[[ -f /boot/armbianEnv.txt ]] && sed -i "s/^verbosity=.*/verbosity=1/" /boot/armbianEnv.txt && sync
[[ -f /boot/armbianEnv.txt ]] && sed -i "s/^verbosity=.*/verbosity=1/" /boot/armbianEnv.txt
rm /boot/.verbose
fi
case ${LINUXFAMILY} in
sun?i)
# redefine green led to blink until shutdown
(echo heartbeat >/sys/class/leds/*green*/trigger) 2>/dev/null
# redefine green led to blink until shutdown, try to switch OTG port to host
(echo heartbeat >/sys/class/leds/*green*/trigger) 2>/dev/null
echo 0 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role 2>/dev/null
;;
esac
# some kernel modules are known to crash the kernel on shutdown. One of the
# symptoms is that board/PMIC don't shut down correctly and still power some
# peripherals or onboard leds. If you experience such problems, check the
# modules you loaded and try a forced rmmod prior to issueing a shutdown. In
# case this helps the lines below are a good place to solve the problem from
# now on (as an example unloading the mass storage gadget module causing this
# problem at least on sun7i):
#
# rmmod -f g_mass_storage
# for module in $(cut -f1 -d' ' </proc/modules) ; do rmmod -f ${module} ; done
# some kernel modules are known to crash the kernel on shutdown (an example
# is the mass storage gadget module at least on sun7i). We try to unload as
# much modules as possible to minimize such situations:
/sbin/modprobe -r $(cut -f1 -d' ' </proc/modules)
# shutdown logging
echo -e "\n### shutdown:\n\n$(dmesg | tail -n 100)" >>/var/log/armhwinfo.log
sync
;;
esac