Rearrange armhwinfo to not break detection of other boards, fixed OPi detection and IRQ distribution

This commit is contained in:
Thomas Kaiser 2016-02-25 15:23:02 +01:00
parent 95c1d51ca9
commit 775b82cf41

View File

@ -53,38 +53,6 @@ if [ "$ARCH" = "armv7l" ]; then
if [ $HARDWARE = "gs705a" ]; then
ID="Guitar"
fi
[ -f /proc/device-tree/model ] && HARDWARE=$(awk '/Hardware/ {print $4}' </proc/cpuinfo)
if [ $HARDWARE = "sun8i" ]; then
ID="Orange H3"
# redistribute USB irqs to dedicated cores
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 2>/dev/null # OPi One
if [ "$TERMINUS" != "" ]; then
# Ethernet irqs on cpu3
echo 8 >/proc/irq/$(awk -F":" '/gmac0/ {print $1}' </proc/interrupts | sed 's/\ //g')/smp_affinity
ID="Orange Pi+"
if [ $MEMTOTAL -gt 1500 ]; then
ID="Orange Pi+ 2"
fi
case ${ORANGEPIPHY} in
00441400*)
if [ "$WIFI8189ES" != "" ]; then
ID="Orange Pi 2"
else
ID="Orange Pi 2 mini"
fi
;;
esac
elif [ "$WIFI8189ES" != "" ]; then
ID="Orange Pi Lite"
echo 8 >/proc/irq/$(awk -F":" '/wlan0/ {print $1}' </proc/interrupts | sed 's/\ //g')/smp_affinity
elif [ $MEMTOTAL -gt 600 ]; then
ID="Orange Pi PC"
echo 8 >/proc/irq/$(awk -F":" '/usb4/ {print $1}' </proc/interrupts | sed 's/\ //g')/smp_affinity
else
ID="Orange Pi One"
fi
fi
if [ $HARDWARE = "sun4i" ] || [ $HARDWARE = "Allwinner" ]; then
ID="Cubieboard"
fi
@ -128,10 +96,50 @@ if [ "$ARCH" = "armv7l" ]; then
fi
[ -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="gmac0"; 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"
# 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 2>/dev/null # OPi One
if [ "$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
ID="Orange Pi+ 2"
fi
case ${ORANGEPIPHY} in
00441400*)
if [ "$WIFI8189ES" != "" ]; then
ID="Orange Pi 2"
else
ID="Orange Pi 2 mini"
fi
;;
esac
elif [ "$WIFI8189ES" != "" ]; then
ID="Orange Pi Lite"
echo 8 >/proc/irq/$(awk -F":" "/${WiFi}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
elif [ $MEMTOTAL -gt 600 ]; then
ID="Orange Pi PC"
echo 8 >/proc/irq/$(awk -F":" "/${USB3}/ {print \$1}" </proc/interrupts | sed 's/\ //g')/smp_affinity
else
ID="Orange Pi One"
fi
fi
fi
[ -f /proc/device-tree/model ] && read MACHINE </proc/device-tree/model
# ID="$(echo "${MACHINE}" | sed 's/Xunlong\ //')"
if [[ $MACHINE == *LIME2 ]]; then ID="Lime 2"; fi
if [[ $MACHINE == *LIME ]]; then ID="Lime"; fi
if [[ $MACHINE == *Micro ]]; then ID="Micro"; fi
@ -145,8 +153,7 @@ if [[ $MACHINE == *Pro* ]]; then ID="Banana Pro"; fi
if [[ $MACHINE == *M2* ]]; then ID="Banana M2"; fi
echo -e "[\e[0;32m ok \x1B[0m] Starting ARM hardware info: $ID"
echo $ID >> /var/run/machine.id
# echo "Orange Pi One" >/var/run/machine.id
echo $ID > /var/run/machine.id
export HARDWARE DISTROID DISTROCODE ARCH KERNELID MACHINE ID
;;
stop|reload|restart|force-reload|status)
@ -156,3 +163,4 @@ echo -e "[\e[0;32m ok \x1B[0m] Stopping ARM hardware info ..."
exit 1
;;
esac