update 2026-10-29 18:46:39

This commit is contained in:
action committed 2026-10-29 18:46:39 +08:00
1 parent e2f86e09f4
commit 95f76f26d3
5034 files changed
+2043234

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
config amlogic 'config'
option enable '1'
option amlogic_firmware_repo 'https://github.com/ophub/amlogic-s9xxx-openwrt'
option amlogic_firmware_tag 'OpenWrt_lede_'
option amlogic_firmware_suffix '.img.gz'
option amlogic_kernel_path 'https://github.com/ophub/kernel'
option amlogic_kernel_tags ''
option amlogic_kernel_branch ''
option amlogic_plugin_branch 'main'
option amlogic_firmware_config '1'
option amlogic_write_bootloader '0'
option amlogic_shared_fstype 'ext4'
config settings 'armcpu'
option governor0 'schedutil'
option minfreq0 '500000'
option maxfreq0 '1512000'
+62
View File
@@ -0,0 +1,62 @@
#!/bin/sh /etc/rc.common
START=60
NAME=amlogic
uci_get_by_type() {
local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null)
echo ${ret:=$3}
}
uci_set_by_type() {
uci set $NAME.@$1[0].$2=$3 2>/dev/null
uci commit $NAME
}
start() {
[ -x "/usr/sbin/fixcpufreq.pl" ] && /usr/sbin/fixcpufreq.pl && sync
local cpu_policys=$(ls /sys/devices/system/cpu/cpufreq 2>/dev/null | grep -E 'policy[0-9]{1,3}' | xargs)
if [ "${cpu_policys}" = "" ]; then
cpu_policys="policy0"
fi
config_load $NAME
for policy_name in ${cpu_policys}; do
local policy_id="${policy_name//policy/}"
# Get an optional value list for the current device
local governor_list="$(cat /sys/devices/system/cpu/cpufreq/${policy_name}/scaling_available_frequencies 2>/dev/null | xargs)"
local second_place_order="$(echo ${governor_list} | awk '{print $1}')"
local second_place_reverse="$(echo ${governor_list} | awk '{print $NF}')"
# Get the default value in the Config file
local governor=$(uci_get_by_type settings governor${policy_id} schedutil)
local minfreq=$(uci_get_by_type settings minfreq${policy_id} ${second_place_order})
local maxfreq=$(uci_get_by_type settings maxfreq${policy_id} ${second_place_reverse})
# Update result to the corresponding file
echo $governor >/sys/devices/system/cpu/cpufreq/${policy_name}/scaling_governor
echo $minfreq >/sys/devices/system/cpu/cpufreq/${policy_name}/scaling_min_freq
echo $maxfreq >/sys/devices/system/cpu/cpufreq/${policy_name}/scaling_max_freq
# If the governor is ondemand, configure its specific parameters.
if [ "$governor" = "ondemand" ]; then
local ondemand_dir="/sys/devices/system/cpu/cpufreq/${policy_name}/ondemand"
# Check if the per-policy ondemand directory exists.
if [ -d "$ondemand_dir" ]; then
# Read ondemand parameters from UCI, or use default values (e.g., 80 and 20) if not set.
local up_threshold=$(uci_get_by_type settings up_threshold${policy_id} 80)
local sampling_down_factor=$(uci_get_by_type settings sampling_down_factor${policy_id} 20)
# Write the values to the system files.
echo $up_threshold > "${ondemand_dir}/up_threshold"
echo $sampling_down_factor > "${ondemand_dir}/sampling_down_factor"
fi
fi
done
}
reload() {
start
return 0
}
+65
View File
@@ -0,0 +1,65 @@
#!/bin/sh
# luci-app-amlogic-js: post-install configuration tweaks.
# Detect running platform from /etc/flippy-openwrt-release. The original Lua
# controller hid the "Install OpenWrt" menu unless platform=="amlogic" or
# SHOW_INSTALL_MENU=="yes", and hid "CPU Settings" on the qemu platform.
# Since menu.d JSON cannot run shell logic, we mirror those checks once here
# and store the result as uci flags that the menu entries depend on.
PLATFORM=$(grep -E '^PLATFORM=' /etc/flippy-openwrt-release 2>/dev/null | \
awk -F= '{print $2}' | tr -d '"' | xargs)
SHOW_INSTALL=$(grep -E '^SHOW_INSTALL_MENU=' /etc/flippy-openwrt-release 2>/dev/null | \
awk -F= '{print $2}' | tr -d '"' | xargs)
# Detect whether the root fs is already on eMMC (mmcblk*p* with device/type == "MMC").
# Mirrors root_on_internal_storage() in luci.amlogic: all other boot media
# (TF/SD, NVMe, SATA, USB) keep the install menu visible.
ROOT_PT=$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')
IS_INSTALLED=0
case "$ROOT_PT" in
mmcblk*p*)
BASE_DEV="${ROOT_PT%p*}"
[ "$(cat /sys/block/${BASE_DEV}/device/type 2>/dev/null | xargs)" = "MMC" ] && IS_INSTALLED=1
;;
esac
case "$PLATFORM" in
*amlogic*|*allwinner*) CAN_INSTALL=yes ;;
*) [ "$SHOW_INSTALL" = "yes" ] && CAN_INSTALL=yes || CAN_INSTALL=no ;;
esac
if [ "$CAN_INSTALL" = "yes" ] && [ "$IS_INSTALLED" = "0" ]; then
MENU_INSTALL=yes
else
MENU_INSTALL=no
fi
case "$PLATFORM" in
*qemu*) MENU_ARMCPU=no ;;
*) MENU_ARMCPU=yes ;;
esac
# Raise uhttpd max_requests (default 3 is too low for this plugin's concurrent
# polling and can crash some uhttpd builds), but never override a higher value.
cur_max="$(uci -q get uhttpd.main.max_requests 2>/dev/null)"
if [ -z "$cur_max" ] || [ "$cur_max" -lt 50 ] 2>/dev/null; then
uci -q batch <<-EOF >/dev/null
set uhttpd.main.max_requests='50'
commit uhttpd
EOF
# Apply now (skip during image build).
[ -z "${IPKG_INSTROOT}" ] && /etc/init.d/uhttpd reload >/dev/null 2>&1 || true
fi
uci -q batch <<-EOF >/dev/null
delete ucitrack.@amlogic[-1]
add ucitrack amlogic
set ucitrack.@amlogic[-1].init=amlogic
commit ucitrack
set amlogic.config.menu_install=${MENU_INSTALL}
set amlogic.config.menu_armcpu=${MENU_ARMCPU}
commit amlogic
EOF
rm -rf /tmp/luci-*
exit 0