2016-03-03 00:45:46 +01:00
|
|
|
#!/bin/bash
|
2014-10-08 07:39:24 +02:00
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: armhwinfo
|
|
|
|
# Required-Start:
|
2014-10-12 09:20:35 +02:00
|
|
|
# Required-Stop: glibc
|
2014-10-12 07:27:38 +02:00
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
2016-06-08 22:04:12 +02:00
|
|
|
# Short-Description: Armbian gathering hardware information
|
2014-10-08 07:39:24 +02:00
|
|
|
### END INIT INFO
|
|
|
|
|
2016-02-29 20:25:50 +01:00
|
|
|
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
|
2016-06-23 14:14:39 +03:00
|
|
|
# Starting with 5.15 read in $BOARD (odroidc2), $BOARD_NAME ("Odroid C2") and $VERSION (5.15)
|
|
|
|
. /etc/armbian-release
|
|
|
|
|
2016-05-31 16:07:07 +02:00
|
|
|
collect_information() {
|
2016-03-17 20:16:26 +01:00
|
|
|
ifconfig | grep -q eth0 || (ifconfig eth0 up ; sleep 2)
|
2016-03-03 00:45:46 +01:00
|
|
|
TMPFILE=$(mktemp /tmp/${0##*/}.XXXXXX)
|
|
|
|
trap "rm \"${TMPFILE}\" ; exit 0" 0 1 2 3 15
|
|
|
|
dmesg >"${TMPFILE}"
|
|
|
|
ARCH=$(lscpu | awk '/Architecture/ {print $2}')
|
|
|
|
HARDWARE=$(awk '/Hardware/ {print $3}' </proc/cpuinfo)
|
2016-04-02 19:30:55 +02:00
|
|
|
[ "X${HARDWARE}" = "XAllwinner" ] && HARDWARE=$(awk '/Hardware/ {print $4}' </proc/cpuinfo)
|
2016-06-23 14:14:39 +03:00
|
|
|
KERNELID=$(uname -r)
|
2016-06-08 22:04:12 +02:00
|
|
|
|
2016-05-31 16:07:07 +02:00
|
|
|
} # collect_information
|
2016-01-20 09:09:46 +01:00
|
|
|
|
2016-03-03 00:45:46 +01:00
|
|
|
set_io_scheduler() {
|
|
|
|
for i in $( lsblk -idn -o NAME ); do
|
|
|
|
read ROTATE </sys/block/$i/queue/rotational
|
|
|
|
|
|
|
|
# mechanical drives
|
|
|
|
if [ "$ROTATE" = 1 ]; then echo cfq >/sys/block/$i/queue/scheduler;
|
|
|
|
echo -e "[\e[0;32m ok \x1B[0m] Setting cfg I/O scheduler for $i"
|
|
|
|
|
|
|
|
# solid state drives
|
|
|
|
elif [ "$ROTATE" = 0 ]; then echo noop >/sys/block/$i/queue/scheduler;
|
|
|
|
echo -e "[\e[0;32m ok \x1B[0m] Setting noop I/O scheduler for $i"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
} # set_io_scheduler
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2016-06-08 22:04:12 +02:00
|
|
|
prepare_board() {
|
2016-06-23 14:14:39 +03:00
|
|
|
# IRQ distribution based on $HARDWARE and/or $BOARD, probably some sort of user feedback (leds)
|
2016-06-07 22:29:22 +02:00
|
|
|
case ${HARDWARE} in
|
2016-06-12 19:38:41 +02:00
|
|
|
Freescale) # i.MX6 boards, send Ethernet to cpu1, MMC to cpu2/cpu3 (when available)
|
|
|
|
echo 2 >/proc/irq/$(awk -F":" "/ethernet/ {print \$1}" </proc/interrupts | sed 's/\ //g' | head -1)/smp_affinity 2>/dev/null
|
|
|
|
echo 4 >/proc/irq/$(awk -F":" "/mmc1/ {print \$1}" </proc/interrupts | sed 's/\ //g' | head -1)/smp_affinity 2>/dev/null
|
|
|
|
echo 8 >/proc/irq/$(awk -F":" "/mmc0/ {print \$1}" </proc/interrupts | sed 's/\ //g' | head -1)/smp_affinity 2>/dev/null
|
2016-06-07 22:29:22 +02:00
|
|
|
;;
|
2016-06-12 19:38:41 +02:00
|
|
|
gs705a) # Roseapple Pi/LeMaker Guitar: send USB IRQs to cpu1/cpu2, DMA0 to cpu2 and Ethernet + SD card to cpu3
|
2016-06-08 12:37:24 +02:00
|
|
|
echo 2 >/proc/irq/$(awk -F":" "/usb1/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
echo 4 >/proc/irq/$(awk -F":" "/usb2/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity 2>/dev/null
|
|
|
|
echo 4 >/proc/irq/$(awk -F":" "/usb3/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity 2>/dev/null
|
|
|
|
echo 4 >/proc/irq/$(awk -F":" "/owl_dma0/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
echo 8 >/proc/irq/$(awk -F":" "/ethernet_mac/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
echo 8 >/proc/irq/$(awk -F":" "/sdcard/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
2016-06-07 22:29:22 +02:00
|
|
|
;;
|
2016-06-12 19:38:41 +02:00
|
|
|
Marvell) # Clearfog: Send network IRQs to cpu1 on both kernels
|
2016-06-08 22:04:12 +02:00
|
|
|
for i in $(awk -F':' '/mwlwifi|mvneta|eth0/{print $1}' /proc/interrupts); do
|
|
|
|
echo 2 >/proc/irq/$i/smp_affinity
|
|
|
|
done
|
2016-06-07 22:29:22 +02:00
|
|
|
;;
|
2016-06-12 19:15:44 +03:00
|
|
|
ODROID-C2) # send eth0 to cpu1, mmc/usb2 to cpu2 and usb1 to cpu3
|
|
|
|
# Basics: http://forum.odroid.com/viewtopic.php?f=115&t=8121#p65777
|
|
|
|
echo 1 >/proc/irq/$(awk -F":" "/eth0/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity_list
|
|
|
|
for i in $(awk -F':' '/sd_emmc|usb2/{print $1}' /proc/interrupts); do
|
|
|
|
echo 2 >/proc/irq/$i/smp_affinity_list
|
|
|
|
done
|
|
|
|
echo 3 >/proc/irq/$(awk -F":" "/usb1/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity_list
|
2016-06-07 22:29:22 +02:00
|
|
|
;;
|
2016-06-12 19:38:41 +02:00
|
|
|
ODROID-XU3) # ODROID XU4
|
2016-06-11 15:50:57 +02:00
|
|
|
echo 2 >/proc/irq/$(awk -F":" "/usb2/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
echo 4 >/proc/irq/$(awk -F":" "/usb3/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
echo 8 >/proc/irq/$(awk -F":" "/usb5/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
echo 16 >/proc/irq/$(awk -F":" "/dw-mci/ {print \$1}" </proc/interrupts | sed 's/\ //g' | tail -1)/smp_affinity
|
|
|
|
echo 32 >/proc/irq/$(awk -F":" "/dw-mci/ {print \$1}" </proc/interrupts | sed 's/\ //g' | head -1)/smp_affinity
|
|
|
|
for i in $(awk -F':' '/11800000.mali/{print $1}' /proc/interrupts); do
|
|
|
|
echo 64 >/proc/irq/$i/smp_affinity
|
|
|
|
done
|
2016-06-07 22:29:22 +02:00
|
|
|
;;
|
2016-06-12 19:38:41 +02:00
|
|
|
sun4i|sun5i) # only one core, nothing to improve
|
2016-06-07 22:29:22 +02:00
|
|
|
:
|
|
|
|
;;
|
2016-06-12 19:38:41 +02:00
|
|
|
sun6i) # Banana Pi M2: process eth0 on cpu1, SDIO on cpu2, USB on cpu3
|
|
|
|
echo 2 >/proc/irq/$(awk -F":" '/eth0/ {print $1}' </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
for i in $(awk -F':' '/sunxi-mmc/{print $1}' /proc/interrupts); do
|
|
|
|
echo 4 >/proc/irq/$i/smp_affinity
|
|
|
|
done
|
|
|
|
for i in $(awk -F':' '/hcd:usb/{print $1}' /proc/interrupts); do
|
|
|
|
echo 8 >/proc/irq/$i/smp_affinity
|
|
|
|
done
|
2016-06-07 22:29:22 +02:00
|
|
|
;;
|
2016-06-12 19:38:41 +02:00
|
|
|
sun7i) # try to redistribute eth0 irq to dedicated core
|
2016-06-07 22:29:22 +02:00
|
|
|
echo 2 >/proc/irq/$(awk -F":" '/eth0/ {print $1}' </proc/interrupts | sed 's/\ //g')/smp_affinity 2>/dev/null
|
|
|
|
;;
|
2016-06-12 19:38:41 +02:00
|
|
|
sun8i) # H3 boards, try to do the best based on specific board since interfaces vary a lot
|
2016-06-07 22:29:22 +02:00
|
|
|
# 10 or 120 sec user feedback that the board is ready after 1st login with 3.4 kernel
|
|
|
|
SwapState="$(grep swap /etc/fstab)"
|
|
|
|
if [ "X${SwapState}" != "X" ]; then
|
|
|
|
(echo heartbeat >/sys/class/leds/*green*/trigger) 2>/dev/null
|
|
|
|
[ -f "/root/.not_logged_in_yet" ] && BlinkTime=120 || BlinkTime=10
|
|
|
|
(sleep ${BlinkTime} && (echo default-on >/sys/class/leds/*green*/trigger) 2>/dev/null) &
|
|
|
|
fi
|
|
|
|
|
|
|
|
# check kernel version for IRQ/module names
|
|
|
|
case ${KERNELID} in
|
|
|
|
3*)
|
|
|
|
# BSP kernel
|
|
|
|
GbE="gmac0"; WiFi="wlan0"; USB1="usb2"; USB2="usb3"; USB3="usb4"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# Mainline kernel
|
|
|
|
GbE="1c30000.ethernet"; WiFi="wlan0"; USB1="usb1"; USB2="usb2"; USB3="usb3"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
# Assign 1st and 2nd USB port to cpu1 and cpu2 on every sun8i board
|
|
|
|
echo 2 >/proc/irq/$(awk -F":" "/${USB1}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
echo 4 >/proc/irq/$(awk -F":" "/${USB2}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
2016-06-23 14:14:39 +03:00
|
|
|
case ${BOARD_NAME} in
|
2016-06-07 22:29:22 +02:00
|
|
|
"Orange Pi+"|"Orange Pi+ 2"|"Orange Pi+ 2E"|"Banana Pi M2+")
|
|
|
|
# Send GBit Ethernet IRQs to cpu3
|
|
|
|
echo 8 >/proc/irq/$(awk -F":" "/${GbE}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
;;
|
2016-08-21 18:03:34 +02:00
|
|
|
"NanoPi M1"|"Orange Pi PC Plus"|"Orange Pi PC +"|"Orange Pi PC"|"NanoPi Neo")
|
2016-06-07 22:29:22 +02:00
|
|
|
# Send 3rd USB port's IRQs to cpu3
|
|
|
|
echo 8 >/proc/irq/$(awk -F":" "/${USB3}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
;;
|
2016-10-18 16:53:19 +02:00
|
|
|
"Orange Pi Lite"|"NanoPi Air"|"Lime A33")
|
|
|
|
# Send SDIO/mmc IRQs to cpu3
|
|
|
|
for i in $(awk -F':' '/sunxi-mmc/{print $1}' /proc/interrupts); do
|
|
|
|
echo 8 >/proc/irq/$i/smp_affinity
|
|
|
|
done
|
2016-06-07 22:29:22 +02:00
|
|
|
;;
|
2016-06-20 16:58:06 +02:00
|
|
|
"Beelink X2")
|
2016-09-07 13:04:34 +02:00
|
|
|
# Wifi module reload workaround / fix
|
|
|
|
[[ -n $(lsmod | grep 8189es) ]] && rmmod 8189es && modprobe 8189es
|
2016-06-20 16:58:06 +02:00
|
|
|
# Send SDIO to cpu1, USB to cpu2, Ethernet to cpu3
|
|
|
|
for i in $(awk -F':' '/sunxi-mmc/{print $1}' /proc/interrupts); do
|
|
|
|
echo 2 >/proc/irq/$i/smp_affinity
|
|
|
|
done
|
|
|
|
for i in $(awk -F':' '/hcd:usb/{print $1}' /proc/interrupts); do
|
|
|
|
echo 4 >/proc/irq/$i/smp_affinity
|
|
|
|
done
|
|
|
|
echo 8 >/proc/irq/$(awk -F":" "/${GbE}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
;;
|
2016-06-07 22:29:22 +02:00
|
|
|
esac
|
|
|
|
;;
|
2016-06-08 12:37:24 +02:00
|
|
|
sun50iw1p1) # A64/H64 based boards like Pine64
|
|
|
|
# Send IRQs for the lower real USB port (usb2) to cpu2 and for the upper (OTG/usb1) to cpu1
|
|
|
|
echo 2 >/proc/irq/$(awk -F":" "/usb1/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
|
|
|
echo 4 >/proc/irq/$(awk -F":" "/usb2/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
2016-08-28 13:07:28 +02:00
|
|
|
echo 8 >/proc/irq/$(awk -F":" "/sunxi-mmc/ {print \$1}" </proc/interrupts | sed 's/\ //g' | head -n1)/smp_affinity
|
2016-06-07 22:29:22 +02:00
|
|
|
;;
|
|
|
|
esac
|
2016-06-08 22:04:12 +02:00
|
|
|
} # prepare_board
|
2016-02-25 15:23:02 +01:00
|
|
|
|
2016-03-03 00:45:46 +01:00
|
|
|
log_hardware_info() {
|
2016-03-03 00:58:49 +01:00
|
|
|
Log=/var/log/armhwinfo.log
|
2016-03-06 10:06:12 +01:00
|
|
|
[ -f "/etc/logrotate.d/${0##*/}" ] || \
|
2016-03-06 09:53:34 +01:00
|
|
|
echo -e "${Log} {\n rotate 12\n weekly\n compress\n missingok\n notifempty\n}" \
|
|
|
|
> "/etc/logrotate.d/${0##*/}" ; chmod 644 "/etc/logrotate.d/${0##*/}"
|
2016-03-03 00:45:46 +01:00
|
|
|
if [ -f ${Log} ]; then
|
2016-06-23 14:14:39 +03:00
|
|
|
echo -e "\n\n\n$(date) $HARDWARE $ARCH $KERNELID $MACHINE $BOARD_NAME $VERSION" >>${Log}
|
2016-03-03 00:45:46 +01:00
|
|
|
else
|
2016-06-23 14:14:39 +03:00
|
|
|
echo "$(date) $HARDWARE $ARCH $KERNELID $MACHINE $BOARD_NAME $VERSION" >>${Log}
|
2016-03-03 00:45:46 +01:00
|
|
|
chmod 755 ${Log}
|
|
|
|
fi
|
|
|
|
echo -e "\n### dmesg:\n" >>${Log}
|
|
|
|
cat "${TMPFILE}" >>${Log}
|
|
|
|
echo -e "\n### lsusb:" >>${Log}
|
2016-03-06 10:25:41 +01:00
|
|
|
[ -f /boot/.verbose ] && USBVERBOSE="-v" || echo "" >>${Log}
|
|
|
|
lsusb ${USBVERBOSE} 2>/dev/null >>${Log}
|
2016-03-03 00:45:46 +01:00
|
|
|
echo -e "\n### lscpu:\n" >>${Log}
|
|
|
|
lscpu >>${Log}
|
|
|
|
echo -e "\n### cpuinfo:\n" >>${Log}
|
|
|
|
cat /proc/cpuinfo >>${Log}
|
|
|
|
echo -e "\n### meminfo:\n" >>${Log}
|
|
|
|
cat /proc/meminfo >>${Log}
|
|
|
|
echo -e "\n### ifconfig:\n" >>${Log}
|
|
|
|
ifconfig >>${Log}
|
2016-09-19 10:16:21 +02:00
|
|
|
echo -e "### partitions:\n" >>${Log}
|
|
|
|
cat /proc/partitions >>${Log}
|
2016-09-21 19:01:27 +02:00
|
|
|
echo -e "\n### df:\n" >>${Log}
|
2016-03-03 00:45:46 +01:00
|
|
|
df -h >>${Log}
|
2016-06-07 16:31:41 +02:00
|
|
|
[[ -e /boot/script.bin ]] && echo -e "\n### /boot/script.bin --> $(readlink /boot/script.bin)" >>${Log}
|
2016-03-28 12:40:55 +00:00
|
|
|
get_flash_information >>${Log} &
|
2016-06-07 16:31:41 +02:00
|
|
|
(sleep 20 && echo -e "\n### interrupts:\n$(cat /proc/interrupts)" >>${Log}) &
|
2016-03-03 00:45:46 +01:00
|
|
|
} # log_hardware_info
|
2016-02-25 13:17:13 +01:00
|
|
|
|
2016-03-28 12:40:55 +00:00
|
|
|
get_flash_information() {
|
|
|
|
# http://www.bunniestudios.com/blog/?page_id=1022
|
|
|
|
find /sys -name oemid | while read Device ; do
|
|
|
|
DeviceNode="${Device%/*}"
|
|
|
|
DeviceName="${DeviceNode##*/}"
|
|
|
|
echo -e "\n### ${DeviceName} info:\n"
|
|
|
|
find "${DeviceNode}" -maxdepth 1 -type f | while read ; do
|
|
|
|
NodeName="${REPLY##*/}"
|
|
|
|
echo -e "$(printf "%20s" ${NodeName}): $(cat "${DeviceNode}/${NodeName}" | tr '\n' " ")"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
} # get_flash_information
|
|
|
|
|
2016-03-03 00:45:46 +01:00
|
|
|
show_motd_warning() {
|
|
|
|
cat > /etc/update-motd.d/90-warning <<EOT
|
|
|
|
#!/bin/bash
|
|
|
|
echo -e "\e[0;91mAttention:\x1B[0m $1\n"
|
|
|
|
rm "\$0"
|
|
|
|
EOT
|
|
|
|
chmod +x /etc/update-motd.d/90-warning
|
|
|
|
} # show_motd_warning
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2016-03-28 16:13:37 +00:00
|
|
|
check_sd_card_speed() {
|
2016-06-08 22:04:12 +02:00
|
|
|
# function that checks on 3rd boot whether firstrun script made a quick benchmark
|
|
|
|
# and displays a motd warning when _random_ I/O is below some tresholds.
|
2016-03-31 07:30:10 +02:00
|
|
|
if [ -f /var/log/armhwinfo.log ]; then
|
|
|
|
RebootCount=$(grep -c '^### df:' /var/log/armhwinfo.log)
|
|
|
|
if [ ${RebootCount} -eq 2 ]; then
|
|
|
|
# check whether iozone data has been collected
|
|
|
|
IozoneResults="$(awk -F" " '/^### quick iozone test/ {print $10"\t"$11}' </var/log/armhwinfo.log)"
|
|
|
|
if [ "X${IozoneResults}" != "X" ]; then
|
|
|
|
set ${IozoneResults}
|
|
|
|
Readspeed=$1
|
|
|
|
Writespeed=$2
|
|
|
|
if [ ${Readspeed} -lt 800 -o ${Writespeed} -lt 400 ]; then
|
|
|
|
show_motd_warning "Your SD card seems to be very slow. Please check performance using armbianmonitor -c"
|
|
|
|
fi
|
2016-03-28 16:13:37 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
} # check_sd_card_speed
|
|
|
|
|
2016-03-03 00:45:46 +01:00
|
|
|
case $1 in
|
|
|
|
*start*)
|
2016-03-03 11:46:24 +01:00
|
|
|
# set optimal disk scheduler settings
|
|
|
|
set_io_scheduler &
|
2016-03-28 16:13:37 +00:00
|
|
|
|
2016-06-08 22:04:12 +02:00
|
|
|
# check sd card speed once on 3rd boot too warn for too slow media
|
2016-03-28 16:13:37 +00:00
|
|
|
check_sd_card_speed &
|
2016-03-03 11:46:24 +01:00
|
|
|
|
2016-06-08 22:04:12 +02:00
|
|
|
# get hardware information and rely on contents of /etc/armbian-release
|
2016-05-31 16:07:07 +02:00
|
|
|
collect_information
|
2016-03-03 00:45:46 +01:00
|
|
|
|
2016-06-08 22:04:12 +02:00
|
|
|
# hardware preparation
|
|
|
|
prepare_board &
|
2016-03-03 00:45:46 +01:00
|
|
|
|
|
|
|
# display message, log hardware id to file, write log
|
2016-06-07 16:31:41 +02:00
|
|
|
echo -e "[\e[0;32m ok \x1B[0m] Starting ARM hardware info: $ID (${VERSION})"
|
2016-06-23 14:14:39 +03:00
|
|
|
echo $BOARD_NAME >/var/run/machine.id # we should leave this, maybe users depend on it
|
2016-03-06 09:53:34 +01:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
# most probably readonly fs. We'll try to warn the user.
|
|
|
|
show_motd_warning "It seems the rootfs is readonly at the moment. Please check your SD card for errors"
|
|
|
|
fi
|
2016-06-08 22:04:12 +02:00
|
|
|
|
2016-03-28 12:40:55 +00:00
|
|
|
# check whether auto detection override exists and if true use this for machine.id
|
|
|
|
[ -f /root/.machine.id ] && cat /root/.machine.id >/var/run/machine.id
|
2016-03-03 00:45:46 +01:00
|
|
|
log_hardware_info
|
2016-02-29 20:25:50 +01:00
|
|
|
|
2016-03-03 00:45:46 +01:00
|
|
|
# crash detection, enable verbose logging and disable it at clean shutdown
|
2016-10-18 16:53:19 +02:00
|
|
|
sed -i "s/^verbosity=1/verbosity=7/" /boot/armbianEnv.txt && sync &
|
2016-03-03 00:45:46 +01:00
|
|
|
;;
|
|
|
|
query)
|
|
|
|
# armbianmonitor mode -- only interested in hardware info
|
2016-06-07 16:31:41 +02:00
|
|
|
collect_information >/dev/null
|
2016-06-08 22:04:12 +02:00
|
|
|
prepare_board >/dev/null
|
2016-06-23 14:14:39 +03:00
|
|
|
export HARDWARE ARCH KERNELID MACHINE BOARD_NAME VERSION
|
2016-03-03 00:45:46 +01:00
|
|
|
;;
|
|
|
|
*stop*)
|
2016-10-18 15:40:15 +02:00
|
|
|
# set verbosity=1 only if set to 7 and /boot/.force-verbose doesn't exist.
|
|
|
|
if [ ! -f /boot/.force-verbose ]; then
|
|
|
|
sed -i "s/^verbosity=7/verbosity=1/" /boot/armbianEnv.txt && sync
|
2016-03-03 00:45:46 +01:00
|
|
|
fi
|
2016-06-18 16:28:02 +02:00
|
|
|
case ${LINUXFAMILY} in
|
|
|
|
sun?i)
|
2016-03-17 20:16:26 +01:00
|
|
|
# redefine green led to blink until shutdown
|
2016-05-25 04:17:14 -07:00
|
|
|
(echo heartbeat >/sys/class/leds/*green*/trigger) 2>/dev/null
|
2016-06-18 16:28:02 +02:00
|
|
|
;;
|
|
|
|
esac
|
2016-07-29 15:38:55 +02:00
|
|
|
# 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
|
2016-10-18 15:40:15 +02:00
|
|
|
# case this helps the lines below are a good place to solve the problem from
|
2016-07-29 15:38:55 +02:00
|
|
|
# now on (as an example unloading the mass storage gadget module causing this
|
|
|
|
# problem at least on sun7i):
|
|
|
|
#
|
|
|
|
# rmmod -f g_mass_storage
|
2016-10-18 15:40:15 +02:00
|
|
|
# for module in $(cut -f1 -d' ' </proc/modules) ; do rmmod -f ${module} ; done
|
2016-03-03 00:45:46 +01:00
|
|
|
;;
|
|
|
|
esac
|
2016-10-18 15:40:15 +02:00
|
|
|
|