Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
domenico
2025-06-24 12:51:15 +02:00
commit 27c9d80f51
10493 changed files with 1885777 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/sh /etc/rc.common
START=99
boot() {
case $(board_name) in
edgecore,eap102|\
yuncore,ax880)
fw_setenv upgrade_available 0
# Unset changed flag after sysupgrade complete
fw_setenv changed
;;
linksys,mx4200v1|\
linksys,mx4200v2|\
linksys,mx5300|\
linksys,mx8500)
mtd resetbc s_env || true
;;
esac
#stability increase reserved mem to avoid oom when services are used that consume large amounts of mem e.g. samba with attached usb disk etc.
sysctl -w vm.min_free_kbytes=65536
#use vimrc with enabled copy and paste: set mouse-=a
cp /usr/share/vim/vimrc /root/.vimrc
}

View File

@@ -0,0 +1,26 @@
#!/bin/sh /etc/rc.common
START=95
USE_PROCD=1
PROG=/sbin/fanctld
start_service() {
local config_section="config"
config_load 'fanctld'
config_get_bool enabled "$config_section" Enabled
[ "$enabled" -gt 0 ] || {
return 1
}
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance
}
stop_service() {
/bin/fanctl stop
echo "Fanctld Service stopped. Fan is disabled!"
}

View File

@@ -0,0 +1,122 @@
#!/bin/sh /etc/rc.common
######################################################################
# vim: set ft=bash
# shellcheck disable=2155,3019,3043,3057,3060
######################################################################
START=93
PROG=smp_affinity
log_msg() {
local irq_name="$1" affinity="$2" irq="$3"
msg="$(printf "Pinning IRQ($irq) %-24s to CPU ${affinity}\n" "$irq_name")"
logger -t "$PROG" "$msg"
}
######################################################################
### Takes a comma, space separated, or range list of CPU numbers and
## returns a bitmask of CPUs.
## cpus_to_bitmask "0,1,2,3" -> f
## cpus_to_bitmask "0 1 2 3" -> f
## cpus_to_bitmask "0-3" -> f
## cpus_to_bitmask "3" -> 8
#######################################################################
cpus_to_bitmask() {
local bitmask=0
# shellcheck disable=2048
for range in ${*//,/ }; do
start="${range%-*}"
end="${range#*-}"
if [ -z "$end" ]; then
bitmask="$((bitmask | 1 << start))"
else
bitmask="$((bitmask | (2 ** (end - start + 1) - 1) << start))"
fi
done
printf '%x' $bitmask
}
######################################################################
### Takes a bitmask of CPUs and returns a space separated list of
## CPU numbers.
## bitmask_to_cpus f -> 0 1 2 3
######################################################################
bitmask_to_cpus() {
[ "${1:0:2}" != "0x" ] && set -- "0x$1"
local bitmask="$(printf '%d' "$1")"
local cpus=""
for i in $(seq 0 63); do
if [ $((bitmask & 1)) -ne 0 ]; then
cpus="$cpus $i"
fi
bitmask=$((bitmask >> 1))
done
echo "${cpus# }"
}
######################################################################
### Sets the affinity of the IRQs with the given name to the given CPU.
## 1st argument: IRQ name ("reo2host-destination-ring1") (req)
## 2nd argument: CPU number (req)
######################################################################
set_affinity() {
local irq_name="$1" affinity="$2" bitmask irq
awk -v irq_name="$1" '$0 ~ irq_name { print substr($1, 1, length($1)-1); exit }' /proc/interrupts \
| while read -r irq; do
$enable_log && {
log_msg "$irq_name" "$affinity" "$irq"
}
bitmask=$(cpus_to_bitmask "$affinity") && echo "$bitmask" > "/proc/irq/$irq/smp_affinity"
done
}
enable_affinity_ipq807x() {
# assign 4 rx interrupts to each core
set_affinity 'reo2host-destination-ring1' 0
set_affinity 'reo2host-destination-ring2' 1
set_affinity 'reo2host-destination-ring3' 2
set_affinity 'reo2host-destination-ring4' 3
# assign 3 tcl completions to last 3 CPUs
set_affinity 'wbm2host-tx-completions-ring1' 1
set_affinity 'wbm2host-tx-completions-ring2' 2
set_affinity 'wbm2host-tx-completions-ring3' 3
# assign 3 ppdu mac interrupts to last 3 cores
set_affinity 'ppdu-end-interrupts-mac1' 1
set_affinity 'ppdu-end-interrupts-mac2' 2
set_affinity 'ppdu-end-interrupts-mac3' 3
# assign 4 lan/wan to core 4
set_affinity 'edma_txcmpl' 3
set_affinity 'edma_rxfill' 3
set_affinity 'edma_rxdesc' 3
set_affinity 'edma_misc' 3
}
boot() {
local enable
config_load smp_affinity
config_get_bool enable "general" enable 1
config_get_bool enable_log "general" enable_log 1
[ "$enable" -eq 1 ] && enable=true || enable=false
[ "$enable_log" -eq 1 ] && enable_log=true || enable_log=false
$enable && enable_affinity_ipq807x
}