autocore: add support for mediatek filogic
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
76ae895eb4
commit
f0ac305e35
@ -23,10 +23,9 @@ define Package/autocore
|
||||
DEPENDS:=@(aarch64||arm||i386||i686||x86_64) \
|
||||
+TARGET_bcm27xx:bcm27xx-userland \
|
||||
+TARGET_bcm53xx:nvram \
|
||||
+TARGET_mvebu:mhz \
|
||||
+(TARGET_mediatek_filogic||TARGET_mvebu):mhz \
|
||||
+TARGET_x86:ethtool \
|
||||
+TARGET_x86:lm-sensors
|
||||
PROVIDES:=autocore-arm autocore-x86
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
@ -34,26 +33,26 @@ endef
|
||||
|
||||
define Package/autocore/install
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/generic/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
|
||||
|
||||
ifneq ($(filter i386 i686 x86_64, $(ARCH)),)
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) ./files/autocore $(1)/etc/init.d/
|
||||
endif
|
||||
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/generic/cpuinfo $(1)/sbin/
|
||||
ifneq ($(filter ipq% %mt7622, $(TARGETID)),)
|
||||
$(INSTALL_BIN) ./files/arm/tempinfo $(1)/sbin/
|
||||
$(INSTALL_BIN) ./files/cpuinfo $(1)/sbin/
|
||||
ifneq ($(filter ipq% mediatek%, $(TARGETID)),)
|
||||
$(INSTALL_BIN) ./files/tempinfo $(1)/sbin/
|
||||
endif
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(CP) ./files/generic/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
|
||||
ifeq ($(filter ipq806x%, $(TARGETID)),)
|
||||
$(INSTALL_BIN) ./files/generic/ethinfo $(1)/sbin/
|
||||
$(INSTALL_BIN) ./files/ethinfo $(1)/sbin/
|
||||
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/status/include
|
||||
$(INSTALL_DATA) ./files/generic/29_ethinfo.js $(1)/www/luci-static/resources/view/status/include/
|
||||
$(INSTALL_DATA) ./files/29_ethinfo.js $(1)/www/luci-static/resources/view/status/include/
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
IEEE_PATH="/sys/class/ieee80211"
|
||||
THERMAL_PATH="/sys/class/thermal"
|
||||
|
||||
if grep -Eq "ipq40xx|ipq806x" "/etc/openwrt_release"; then
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input | awk '$1=$1')"
|
||||
else
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input | awk '$1=$1')"
|
||||
fi
|
||||
|
||||
if grep -q "ipq40xx" "/etc/openwrt_release"; then
|
||||
if [ -e "$IEEE_PATH/phy0/hwmon0/temp1_input" ]; then
|
||||
mt76_temp=" $(awk -F ': ' '{print $2}' "$IEEE_PATH/phy0/hwmon0/temp1_input")°C"
|
||||
fi
|
||||
|
||||
echo -n "WiFi:${mt76_temp} ${wifi_temp}"
|
||||
else
|
||||
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' "$THERMAL_PATH/thermal_zone0/temp")"
|
||||
echo -n "CPU: ${cpu_temp}, WiFi: ${wifi_temp}"
|
||||
fi
|
||||
@ -21,6 +21,7 @@ case "$DISTRIB_TARGET" in
|
||||
cpu_freq="$(( $(vcgencmd measure_clock arm | awk -F '=' '{print $2}') / 1000000 ))Mhz" ;;
|
||||
"bcm53xx"/*)
|
||||
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz" ;;
|
||||
"mediatek/filogic"|\
|
||||
"mvebu"/*)
|
||||
cpu_freq="$(mhz | awk -F 'cpu_MHz=' '{printf("%.fMHz",$2)}')" ;;
|
||||
"rockchip"/*)
|
||||
@ -55,7 +56,7 @@ esac
|
||||
if [ -z "$big_cpu_freq$cpu_freq" ] && [ -n "$cpu_temp" ]; then
|
||||
echo -n "$cpu_arch x $cpu_cores ($cpu_temp)"
|
||||
elif [ -z "$cpu_temp" ] && [ -n "$big_cpu_freq$cpu_freq" ] || \
|
||||
grep -Eq "ipq|mt7622" "/etc/openwrt_release"; then
|
||||
grep -Eq "ipq|mediatek" "/etc/openwrt_release"; then
|
||||
echo -n "$cpu_arch x $cpu_cores ($big_cpu_freq$cpu_freq)"
|
||||
elif [ -n "$cpu_temp" ] && [ -n "$big_cpu_freq$cpu_freq" ]; then
|
||||
echo -n "$cpu_arch x $cpu_cores ($big_cpu_freq$cpu_freq, ${cpu_temp})"
|
||||
29
package/emortal/autocore/files/tempinfo
Executable file
29
package/emortal/autocore/files/tempinfo
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
IEEE_PATH="/sys/class/ieee80211"
|
||||
THERMAL_PATH="/sys/class/thermal"
|
||||
|
||||
if grep -Eq "ipq40xx|ipq806x" "/etc/openwrt_release"; then
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
else
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
fi
|
||||
|
||||
if grep -q "ipq40xx" "/etc/openwrt_release"; then
|
||||
if [ -e "$IEEE_PATH/phy0/hwmon0/temp1_input" ]; then
|
||||
mt76_temp=" $(awk -F ': ' '{print $2}' "$IEEE_PATH/phy0/hwmon0/temp1_input" 2>"/dev/null")°C"
|
||||
fi
|
||||
[ -z "$mt76_temp" ] || wifi_temp="$wifi_temp $mt76_temp"
|
||||
else
|
||||
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' "$THERMAL_PATH/thermal_zone0/temp" 2>"/dev/null")"
|
||||
fi
|
||||
|
||||
if [ -n "$cpu_temp" ] && [ -z "$wifi_temp" ]; then
|
||||
echo -n "CPU: $cpu_temp"
|
||||
elif [ -z "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
|
||||
echo -n "WiFi: $wifi_temp"
|
||||
elif [ -n "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
|
||||
echo -n "CPU: $cpu_temp, WiFi: $wifi_temp"
|
||||
else
|
||||
echo -n "No temperature info"
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user