Merge pull request #349 from ThomasKaiser/master
Prepare removal of auto detection stuff from armhwinfo
This commit is contained in:
commit
1334e81e71
@ -1,5 +1,5 @@
|
||||
# H3 quad core 1GB RAM
|
||||
BOARD_NAME="Orange Pi +"
|
||||
BOARD_NAME="Orange Pi+"
|
||||
LINUXFAMILY=sun8i
|
||||
BOOTCONFIG=orangepi_plus_defconfig
|
||||
MODULES="8189es #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# H3 quad core 2GB RAM WiFi
|
||||
BOARD_NAME="Orange Pi + 2E"
|
||||
BOARD_NAME="Orange Pi+ 2E"
|
||||
LINUXFAMILY=sun8i
|
||||
BOOTCONFIG=orangepi_pc_defconfig
|
||||
MODULES="8189fs #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# Required-Stop: glibc
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Armbian gathering informations about hardware
|
||||
# Short-Description: Armbian gathering information about hardware
|
||||
### END INIT INFO
|
||||
|
||||
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
@ -15,7 +15,6 @@ collect_information() {
|
||||
TMPFILE=$(mktemp /tmp/${0##*/}.XXXXXX)
|
||||
trap "rm \"${TMPFILE}\" ; exit 0" 0 1 2 3 15
|
||||
dmesg >"${TMPFILE}"
|
||||
SERVER_IP=$(hostname -I)
|
||||
CORES=$(grep -c ^processor /proc/cpuinfo)
|
||||
MEMTOTAL=$(( $(awk -F" " '/^MemTotal/ {print $2}' </proc/meminfo) / 1024 ))
|
||||
ARCH=$(lscpu | awk '/Architecture/ {print $2}')
|
||||
@ -27,9 +26,7 @@ collect_information() {
|
||||
SUN8IPHY="$(awk -F"PHY ID " '/PHY ID / {print $2}' <"${TMPFILE}")"
|
||||
LEDS=$(grep "green:ph02:led1" "${TMPFILE}")
|
||||
TERMINUS=$(lsusb | grep -i "1a40:0101")
|
||||
GL830=$(lsusb | grep -i "05e3:0718")
|
||||
SWITCH=$(grep "BCM53125" "${TMPFILE}")
|
||||
INTERUPT=$(grep "eth0" /proc/interrupts)
|
||||
WIFI8189ES=$(lsmod | grep 8189es)
|
||||
WIFI8189FS=$(lsmod | grep 8189fs)
|
||||
WIFIAP6211=$(lsmod | grep ap6211)
|
||||
@ -59,6 +56,7 @@ do_initialisation() {
|
||||
} # do_initialisation
|
||||
|
||||
detect_board() {
|
||||
# Start soon obsolete auto detection stuff
|
||||
if [ "$ARCH" = "armv7l" ]; then
|
||||
if [ $HARDWARE = "ODROID-XU3" ]; then
|
||||
ID="Odroid XU4"
|
||||
@ -73,15 +71,10 @@ detect_board() {
|
||||
ID="Guitar"
|
||||
fi
|
||||
fi
|
||||
if [ $HARDWARE = "sun4i" ] || [ $HARDWARE = "Allwinner" ]; then
|
||||
if [ $HARDWARE = "sun4i" ]; then
|
||||
ID="Cubieboard"
|
||||
fi
|
||||
if [ $HARDWARE = "sun7i" ] || [ $HARDWARE = "Allwinner" ]; then
|
||||
# redistribute irq to dedicated core
|
||||
if [ "$INTERUPT" != "" ] && [ "$CORES" -gt 1 ]; then
|
||||
echo 2 >/proc/irq/$(awk -F":" '/eth0/ {print $1}' </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
fi
|
||||
|
||||
if [ $HARDWARE = "sun7i" ]; then
|
||||
if [ $MEMTOTAL -gt 1500 ]; then
|
||||
ID="Cubietruck"
|
||||
elif [ -n "$GMAC" ]; then
|
||||
@ -119,33 +112,11 @@ detect_board() {
|
||||
[ -f /proc/asound/imxvt1613audio/id ] && ID="Udoo"
|
||||
fi
|
||||
|
||||
if [ -f /proc/device-tree/model ]; then
|
||||
# mainline kernel, parsing cpuinfo is different
|
||||
HARDWARE=$(awk '/Hardware/ {print $4}' </proc/cpuinfo)
|
||||
GbE="1c30000.ethernet"; WiFi="wlan0"; USB1="usb1"; USB2="usb2"; USB3="usb3"
|
||||
else
|
||||
# kernel 3.4.x
|
||||
GbE="gmac0"; WiFi="wlan0"; USB1="usb2"; USB2="usb3"; USB3="usb4"
|
||||
fi
|
||||
if [ "$HARDWARE" = "sun8i" ]; then
|
||||
ID="Orange H3"
|
||||
# 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
|
||||
|
||||
# redistribute USB irqs to dedicated cores
|
||||
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
|
||||
ID="Orange H3"
|
||||
if [ -f /sys/class/leds/*blue*/trigger ] ; then
|
||||
ID="NanoPi M1"
|
||||
echo 8 >/proc/irq/$(awk -F":" "/${USB3}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
elif [ "$TERMINUS" != "" ]; then
|
||||
# Ethernet irqs on cpu3
|
||||
echo 8 >/proc/irq/$(awk -F":" "/${GbE}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
ID="Orange Pi+"
|
||||
if [ $MEMTOTAL -gt 1500 ]; then
|
||||
if [ ${CORES} -eq 4 ]; then
|
||||
@ -168,23 +139,18 @@ detect_board() {
|
||||
elif [ "$WIFI8189FS" != "" ]; then
|
||||
if [ $MEMTOTAL -gt 1200 ]; then
|
||||
ID="Orange Pi+ 2E"
|
||||
echo 8 >/proc/irq/$(awk -F":" "/${GbE}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
elif [ $MEMTOTAL -gt 600 ]; then
|
||||
ID="Orange Pi PC Plus"
|
||||
echo 8 >/proc/irq/$(awk -F":" "/${USB3}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
else
|
||||
ID="Orange Pi Lite"
|
||||
i echo 8 >/proc/irq/$(awk -F":" "/${WiFi}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
fi
|
||||
elif [ $MEMTOTAL -gt 600 ]; then
|
||||
case ${SUN8IPHY} in
|
||||
00441400*)
|
||||
ID="Orange Pi PC"
|
||||
echo 8 >/proc/irq/$(awk -F":" "/${USB3}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
;;
|
||||
*)
|
||||
ID="Banana Pi M2+"
|
||||
echo 8 >/proc/irq/$(awk -F":" "/${GbE}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
;;
|
||||
esac
|
||||
else
|
||||
@ -219,9 +185,88 @@ detect_board() {
|
||||
if [[ $MACHINE == *M2* ]]; then ID="Banana Pi M2"; fi
|
||||
if [[ $MACHINE == *AMLOGIC* ]]; then ID="Odroid C1"; fi
|
||||
if [[ $MACHINE == *HummingBoard2* ]]; then ID="HB 2"; fi
|
||||
# Finish soon obsolete auto detection stuff
|
||||
|
||||
# Starting with 5.15 read in $BOARD (odroidc2), $ID ("Odroid C2") and $VERSION (5.15)
|
||||
[[ -f /etc/armbian-release ]] && source /etc/armbian-release
|
||||
|
||||
# IRQ distribution based on $HARDWARE and/or $ID, probably some sort of user feedback (leds)
|
||||
case ${HARDWARE} in
|
||||
Freescale)
|
||||
# i.MX6 boards
|
||||
:
|
||||
;;
|
||||
gs705a)
|
||||
# Roseapple Pi or LeMaker Guitar
|
||||
:
|
||||
;;
|
||||
Marvell)
|
||||
# Clearfog
|
||||
:
|
||||
;;
|
||||
ODROID-C2)
|
||||
# ODROID-C2
|
||||
:
|
||||
;;
|
||||
ODROID-XU3)
|
||||
# ODROID XU4
|
||||
:
|
||||
;;
|
||||
sun4i|sun5i)
|
||||
# only one core, nothing to do
|
||||
:
|
||||
;;
|
||||
sun6i)
|
||||
# A31/A31s boards (Banana Pi M2)
|
||||
:
|
||||
;;
|
||||
sun7i)
|
||||
# try to redistribute eth0 irq to dedicated core
|
||||
echo 2 >/proc/irq/$(awk -F":" '/eth0/ {print $1}' </proc/interrupts | sed 's/\ //g')/smp_affinity 2>/dev/null
|
||||
;;
|
||||
sun8i)
|
||||
# 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
|
||||
case ${ID} in
|
||||
"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
|
||||
;;
|
||||
"NanoPi M1"|"Orange Pi PC Plus"|"Orange Pi PC +"|"Orange Pi PC")
|
||||
# Send 3rd USB port's IRQs to cpu3
|
||||
echo 8 >/proc/irq/$(awk -F":" "/${USB3}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
;;
|
||||
"Orange Pi Lite")
|
||||
# Send WiFi IRQs to cpu3
|
||||
echo 8 >/proc/irq/$(awk -F":" "/${WiFi}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sun50iw1p1)
|
||||
# A64/H64 based boards like Pine64
|
||||
:
|
||||
;;
|
||||
esac
|
||||
} # detect_board
|
||||
|
||||
log_hardware_info() {
|
||||
@ -339,11 +384,10 @@ case $1 in
|
||||
if [ -f /boot/.verbose -a ! -f /boot/.force-verbose ]; then
|
||||
rm /boot/.verbose
|
||||
fi
|
||||
collect_informations
|
||||
collect_information
|
||||
if [ $HARDWARE = "sun8i" ]; then
|
||||
# redefine green led to blink until shutdown
|
||||
(echo heartbeat >/sys/class/leds/*green*/trigger) 2>/dev/null
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user