autocore-arm: add target sunxi support

Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
AmadeusGhost 2021-02-04 11:08:02 +08:00 committed by CN_SZTL
parent ebcdb6e415
commit 0ab2aa1967
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
3 changed files with 19 additions and 10 deletions

View File

@ -12,14 +12,14 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=autocore
PKG_VERSION:=1
PKG_RELEASE:=29
PKG_RELEASE:=$(AUTORELEASE)
include $(INCLUDE_DIR)/package.mk
define Package/autocore-arm
TITLE:=ARM auto core script.
MAINTAINER:=CN_SZTL
DEPENDS:=@(TARGET_bcm27xx||TARGET_bcm53xx||TARGET_mvebu||TARGET_ipq40xx||TARGET_ipq806x||TARGET_rockchip) \
DEPENDS:=@(TARGET_bcm27xx||TARGET_bcm53xx||TARGET_ipq40xx||TARGET_ipq806x||TARGET_mvebu||TARGET_sunxi||TARGET_rockchip) \
+TARGET_bcm27xx:bcm27xx-userland \
+TARGET_bcm53xx:nvram \
+TARGET_ipq40xx:lm-sensors

View File

@ -10,18 +10,27 @@ 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 "
elif [ -e "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq" ]; then
cpu_freq="$(expr $(cat "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq") / 1000)MHz"
elif [ -e "/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq" ]; then
big_cpu_freq="$(expr $(cat "/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq") / 1000)MHz "
fi
if grep -q "bcm27xx" "/etc/openwrt_release"; then
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"
elif grep -q "ipq40xx" "/etc/openwrt_release"; then
cpu_temp="$(sensors | grep -Eo '\+[0-9]+.+C' | sed ':a;N;$!ba;s/\n/ /g;s/+//g')"
else
cpu_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
[ -e "/sys/class/thermal/thermal_zone0/temp" ] && \
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})"
if [ -z "${cpu_freq}" ] && [ -z "${cpu_temp}" ]; then
echo -n "${cpu_arch} x ${cpu_cores}"
elif [ -z "${cpu_temp}" ]; then
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq})"
elif [ -z "${cpu_freq}" ]; then
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_temp})"
else
echo -n "${cpu_arch} x ${cpu_cores} (${big_cpu_freq}${cpu_freq}, ${cpu_temp})"
fi

View File

@ -27,7 +27,7 @@ KERNELNAME:=zImage dtbs
include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += uboot-envtools
DEFAULT_PACKAGES += autocore-arm uboot-envtools
DEFAULT_PACKAGES += partx-utils mkf2fs e2fsprogs
$(eval $(call BuildTarget))