forked from stupidloud/nanopi-openwrt
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathenable_autocore.diff
53 lines (50 loc) · 2.59 KB
/
enable_autocore.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
diff --git a/package/lean/autocore/Makefile b/package/lean/autocore/Makefile
index 03e4fb6..f774324 100644
--- a/package/lean/autocore/Makefile
+++ b/package/lean/autocore/Makefile
@@ -16,8 +16,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/autocore-arm
TITLE:=Arm auto core loadbalance script.
MAINTAINER:=CN_SZTL
- DEPENDS:=@(TARGET_bcm27xx||TARGET_bcm53xx||TARGET_ipq40xx||TARGET_ipq806x||TARGET_ipq807x||TARGET_mvebu||TARGET_rockchip) \
- +TARGET_bcm27xx:bcm27xx-userland +TARGET_bcm53xx:nvram +ethtool
+ DEPENDS:=+bc +lm-sensors +ethtool
VARIANT:=arm
endef
diff --git a/package/lean/autocore/files/arm/sbin/cpuinfo b/package/lean/autocore/files/arm/sbin/cpuinfo
index 5a525a5..6adabea 100755
--- a/package/lean/autocore/files/arm/sbin/cpuinfo
+++ b/package/lean/autocore/files/arm/sbin/cpuinfo
@@ -4,30 +4,8 @@
[ -z "${cpu_arch}" ] && cpu_arch="ARMv8 Processor"
cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)"
-if grep -q "bcm27xx" "/etc/openwrt_release"; then
- cpu_freq="$(expr $(vcgencmd measure_clock arm | awk -F '=' '{print $2}') / 1000000)Mhz"
-elif grep -q "bcm53xx" "/etc/openwrt_release"; then
- cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz"
-elif grep -q "mvebu" "/etc/openwrt_release"; then
- cpu_freq="$(cat "/proc/cpuinfo" | grep "BogoMIPS" | sed -n "1p" | awk -F ': ' '{print $2}')MHz"
-else
- cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
- big_cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq 2>"/dev/null") / 1000 2>"/dev/null")"
- [ -n "${big_cpu_freq}" ] && big_cpu_freq="${big_cpu_freq}MHz "
-fi
+cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpu[04]/cpufreq/cpuinfo_cur_freq) / 1000) MHz"
-if grep -q "ipq" "/etc/openwrt_release"; then
- if grep -q "ipq40xx" "/etc/openwrt_release"; then
- sys_temp="$(awk '{ printf("%.1f°C ", $0 / 1000) }' /sys/class/ieee80211/phy*/device/hwmon/hwmon*/temp1_input)"
- else
- sys_temp="$(awk '{ printf("%.1f°C ", $0 / 1000) }' /sys/class/thermal/thermal_zone0/temp)"
- fi
- echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq}, ${sys_temp})"
-else
- if grep -q "bcm27xx" "/etc/openwrt_release"; then
- cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C"
- else
- cpu_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
- fi
- echo -n "${cpu_arch} x ${cpu_cores} (${big_cpu_freq}${cpu_freq}, ${cpu_temp})"
-fi
+sys_temp="$(awk '{ printf("%.2f °C", $0 / 1000) }' /sys/class/thermal/thermal_zone0/temp)"
+
+echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq}, ${sys_temp})"