🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2020 Lean <coolsnowwolf@gmail.com>
# Copyright (C) 2021-2023 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=autocore
PKG_FLAGS:=nonshared
PKG_RELEASE:=1
PKG_CONFIG_DEPENDS:= \
CONFIG_TARGET_bcm27xx \
CONFIG_TARGET_bcm53xx \
CONFIG_TARGET_x86
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/target.mk
define Package/autocore
TITLE:=auto core loadbalance script.
DEPENDS:=@(aarch64||arm||i386||i686||x86_64) \
+TARGET_bcm27xx:bcm27xx-utils \
+TARGET_bcm53xx:nvram \
+TARGET_x86:ethtool \
+TARGET_x86:lm-sensors
endef
define Build/Compile
endef
define Package/autocore/install
$(INSTALL_DIR) $(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/autocore $(1)/etc/init.d/
endif
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) ./files/cpuinfo $(1)/sbin/
ifneq ($(filter ipq% mediatek% qualcommax%, $(TARGETID)),)
$(INSTALL_BIN) ./files/tempinfo $(1)/sbin/
endif
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
endef
$(eval $(call BuildPackage,autocore))
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
/etc/init.d/rpcd restart
exit 0
+39
View File
@@ -0,0 +1,39 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2017 lean <coolsnowwolf@gmail.com>
START=99
start() {
rfc=4096
threads="$(grep -c "processor" "/proc/cpuinfo")"
sysctl -w net.core.rps_sock_flow_entries="$(( rfc * threads ))"
for fileRps in /sys/class/net/eth*/queues/rx-*/rps_cpus
do
echo "$threads" > "$fileRps"
done
for fileRfc in /sys/class/net/eth*/queues/rx-*/rps_flow_cnt
do
echo "$rfc" > "$fileRfc"
done
for i in $(ip address | awk -F ': ' '/eth[0-9]+/ {print $2}' | grep -v '@' | xargs)
do
ethtool -K "$i" rx-checksum on
ethtool -K "$i" tx-checksum-ip-generic on || {
ethtool -K "$i" tx-checksum-ipv4 on
ethtool -K "$i" tx-checksum-ipv6 on
}
ethtool -K "$i" tx-scatter-gather on
ethtool -K "$i" gso on
ethtool -K "$i" tso on
ethtool -K "$i" ufo on
if ethtool -i "$i" | grep -q "driver: igc"; then
ethtool -G "$i" rx "$(ethtool -g "$i" | awk '/^RX:/ {print $2; exit}')"
ethtool -G "$i" tx "$(ethtool -g "$i" | awk '/^TX:/ {print $2; exit}')"
fi
done
} >"/dev/null" 2>&1
+62
View File
@@ -0,0 +1,62 @@
#!/bin/sh
. /etc/openwrt_release
CPUINFO_PATH="/proc/cpuinfo"
CPUFREQ_PATH="/sys/devices/system/cpu/cpufreq"
THERMAL_PATH="/sys/class/thermal"
cpu_arch="$(awk -F ': ' '/model name/ {print $2}' "$CPUINFO_PATH" | head -n1)"
[ -n "${cpu_arch}" ] || cpu_arch="ARMv8 Processor"
case "$DISTRIB_TARGET" in
"x86"/*)
cpu_cores="$(grep "core id" "$CPUINFO_PATH" | sort -u | wc -l)C $(grep -c "processor" "$CPUINFO_PATH")T" ;;
*)
cpu_cores="$(grep -c "processor" "$CPUINFO_PATH")" ;;
esac
case "$DISTRIB_TARGET" in
"bcm27xx"/*)
cpu_freq="$(( $(vcgencmd measure_clock arm | awk -F '=' '{print $2}') / 1000000 ))Mhz" ;;
"bcm53xx"/*)
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz" ;;
"rockchip"/*)
cpu_freq="$(awk '{printf("%.fMHz ", $0 / 1000)}' "$CPUFREQ_PATH"/policy*/cpuinfo_cur_freq | awk '$1=$1')" ;;
"x86"/*)
cpu_freq="$(awk -F ': ' '/MHz/ {print $2}' "$CPUINFO_PATH" | head -n1)MHz" ;;
*)
[ ! -e "$CPUFREQ_PATH/policy0/cpuinfo_cur_freq" ] || \
cpu_freq="$(awk '{printf("%.fMHz", $0 / 1000)}' "$CPUFREQ_PATH/policy0/cpuinfo_cur_freq")"
;;
esac
case "$DISTRIB_TARGET" in
"bcm27xx"/*)
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C" ;;
"ipq40xx"/*|"ipq806x"/*|"mediatek"/*|"qualcommax"/*) ;;
"x86"/*)
if [ -n "$(uci -q get "wechatpush.config.server_host")" ]; then
cpu_temp="$(/usr/share/wechatpush/wechatpush soc)°C"
elif 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 "+")"
elif grep -q "AuthenticAMD" "/proc/cpuinfo"; then
cpu_temp="$(sensors "k10temp-*" 2>"/dev/null" | awk '/Tctl|Tdie/ {print $2}' | head -n1 | tr -d "+")"
fi
[ -n "${cpu_temp}" ] || cpu_temp="$(sensors 2>/dev/null | grep 'Core 0' | cut -c12-)"
;;
*)
[ ! -e "$THERMAL_PATH/thermal_zone0/temp" ] || \
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' "$THERMAL_PATH/thermal_zone0/temp")"
;;
esac
if [ -z "$cpu_freq" ] && [ -n "$cpu_temp" ]; then
echo -n "$cpu_arch x $cpu_cores ($cpu_temp)"
elif [ -z "$cpu_temp" ] && [ -n "$cpu_freq" ]; then
echo -n "$cpu_arch x $cpu_cores ($cpu_freq)"
elif [ -n "$cpu_temp" ] && [ -n "$cpu_freq" ]; then
echo -n "$cpu_arch x $cpu_cores ($cpu_freq, ${cpu_temp})"
else
echo -n "$cpu_arch x $cpu_cores"
fi
@@ -0,0 +1,10 @@
{
"luci-mod-status-autocore": {
"description": "Grant access to autocore",
"read": {
"ubus": {
"luci": [ "getCPUInfo", "getTempInfo" ]
}
}
}
}
+40
View File
@@ -0,0 +1,40 @@
#!/bin/sh
. /etc/openwrt_release
IEEE_PATH="/sys/class/ieee80211"
THERMAL_PATH="/sys/class/thermal"
case "$DISTRIB_TARGET" in
ipq40xx/*|ipq806x/*)
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
;;
mediatek/mt7622)
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/wl*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
;;
*)
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
;;
esac
case "$DISTRIB_TARGET" in
ipq40xx/*)
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:+$wifi_temp }$mt76_temp"
;;
*)
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' "$THERMAL_PATH/thermal_zone0/temp" 2>"/dev/null")"
;;
esac
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