autocore: use mhz to calc cpufreq for mvebu
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
f1165bfe7e
commit
00c38b88e0
@ -11,7 +11,8 @@ PKG_RELEASE:=$(COMMITCOUNT)
|
|||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
CONFIG_TARGET_bcm27xx \
|
CONFIG_TARGET_bcm27xx \
|
||||||
CONFIG_TARGET_bcm53xx
|
CONFIG_TARGET_bcm53xx \
|
||||||
|
CONFIG_TARGET_mvebu
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
include $(INCLUDE_DIR)/target.mk
|
include $(INCLUDE_DIR)/target.mk
|
||||||
@ -21,7 +22,8 @@ define Package/autocore-arm
|
|||||||
MAINTAINER:=CN_SZTL
|
MAINTAINER:=CN_SZTL
|
||||||
DEPENDS:=@(arm||aarch64) \
|
DEPENDS:=@(arm||aarch64) \
|
||||||
+TARGET_bcm27xx:bcm27xx-userland \
|
+TARGET_bcm27xx:bcm27xx-userland \
|
||||||
+TARGET_bcm53xx:nvram
|
+TARGET_bcm53xx:nvram \
|
||||||
|
+TARGET_mvebu:mhz
|
||||||
VARIANT:=arm
|
VARIANT:=arm
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@ -22,15 +22,17 @@ case "$DISTRIB_TARGET" in
|
|||||||
"bcm53xx"/*)
|
"bcm53xx"/*)
|
||||||
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz" ;;
|
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz" ;;
|
||||||
"mvebu"/*)
|
"mvebu"/*)
|
||||||
cpu_freq="$(awk -F ': ' '/BogoMIPS/ {print $2}' "$CPUINFO_PATH" | head -n1)MHz" ;;
|
cpu_freq="$(mhz | awk -F 'cpu_MHz=' '{printf("%.fMHz",$2)}')" ;;
|
||||||
"x86"/*)
|
"rockchip"/*)
|
||||||
cpu_freq="$(awk -F ': ' '/MHz/ {print $2}' "$CPUINFO_PATH" | head -n1)MHz"
|
cpu_freq="$(awk '{printf("%.fMHz", $0 / 1000)}' "$CPUFREQ_PATH/policy0/cpuinfo_cur_freq")"
|
||||||
|
[ ! -e "$CPUFREQ_PATH/policy4/cpuinfo_cur_freq" ] || \
|
||||||
|
big_cpu_freq="$(awk '{printf("%.fMHz ", $0 / 1000)}' "$CPUFREQ_PATH/policy4/cpuinfo_cur_freq")"
|
||||||
;;
|
;;
|
||||||
|
"x86"/*)
|
||||||
|
cpu_freq="$(awk -F ': ' '/MHz/ {print $2}' "$CPUINFO_PATH" | head -n1)MHz" ;;
|
||||||
*)
|
*)
|
||||||
[ ! -e "$CPUFREQ_PATH/policy0/cpuinfo_cur_freq" ] || \
|
[ ! -e "$CPUFREQ_PATH/policy0/cpuinfo_cur_freq" ] || \
|
||||||
cpu_freq="$(awk '{printf("%.fMHz", $0 / 1000)}' "$CPUFREQ_PATH/policy0/cpuinfo_cur_freq")"
|
cpu_freq="$(awk '{printf("%.fMHz", $0 / 1000)}' "$CPUFREQ_PATH/policy0/cpuinfo_cur_freq")"
|
||||||
[ ! -e "$CPUFREQ_PATH/policy4/cpuinfo_cur_freq" ] || \
|
|
||||||
big_cpu_freq="$(awk '{printf("%.fMHz ", $0 / 1000)}' "$CPUFREQ_PATH/policy4/cpuinfo_cur_freq")"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -38,10 +40,11 @@ case "$DISTRIB_TARGET" in
|
|||||||
"bcm27xx"/*)
|
"bcm27xx"/*)
|
||||||
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C" ;;
|
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C" ;;
|
||||||
"x86"/*)
|
"x86"/*)
|
||||||
# Intel
|
if grep -q "GenuineIntel" "/proc/cpuinfo"; then
|
||||||
cpu_temp="$(sensors "coretemp-*" 2>"/dev/null" | grep -E "(Package id |Core )" | grep -Eo "\+[0-9.]*°C" | head -n1 | tr -d "+")"
|
cpu_temp="$(sensors "coretemp-*" 2>"/dev/null" | grep -E "(Package id |Core )" | grep -Eo "\+[0-9.]*°C" | head -n1 | tr -d "+")"
|
||||||
# AMD
|
else grep -q "AuthenticAMD" "/proc/cpuinfo"; then
|
||||||
[ -n "${cpu_temp}" ] || cpu_temp="$(sensors "k*temp-*" 2>"/dev/null" | awk '/Tdie/ {print $2}' | head -n1 | tr -d "+")"
|
cpu_temp="$(sensors "k*temp-*" 2>"/dev/null" | awk '/Tdie/ {print $2}' | head -n1 | tr -d "+")"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
[ ! -e "$THERMAL_PATH/thermal_zone0/temp" ] || \
|
[ ! -e "$THERMAL_PATH/thermal_zone0/temp" ] || \
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user