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,23 @@
#
# Copyright (C) 2012-2015 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
board_config_update
board=$(board_name)
case "$board" in
iom,ix2-200)
ucidef_set_led_timer "health" "health" "status:white:rebuild_led" "200" "800"
;;
linksys,e4200-v2|\
linksys,ea4500)
ucidef_set_led_default "pulse" "pulse" "viper:white:pulse" "1"
;;
esac
board_config_flush
exit 0

View File

@@ -0,0 +1,93 @@
#
# Copyright (C) 2012-2015 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
kirkwood_setup_interfaces()
{
local board="$1"
case "$board" in
checkpoint,l-50)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 dmz" "eth0"
;;
cisco,on100)
ucidef_set_interface_lan "eth0 eth1"
;;
cloudengines,pogoe02|\
cloudengines,pogoplugv4|\
ctera,c200-v1|\
dlink,dns320l|\
globalscale,sheevaplug|\
iom,iconnect-1.1|\
iom,ix2-200|\
iptime,nas1|\
netgear,readynas-duo-v2|\
netgear,stora|\
raidsonic,ib-nas62x0|\
seagate,blackarmor-nas220|\
seagate,dockstar|\
seagate,goflexhome|\
seagate,goflexnet|\
zyxel,nsa310b|\
zyxel,nsa310s|\
zyxel,nsa325)
ucidef_set_interface_lan "eth0" "dhcp"
;;
endian,4i-edge-200)
ucidef_set_interface_lan "port1 port2 port3 port4 eth1"
;;
iom,ix4-200d)
ucidef_set_interface_lan "eth0 eth1" "dhcp"
;;
linksys,e4200-v2|\
linksys,ea3500|\
linksys,ea4500)
ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
;;
*)
ucidef_set_interface_lan "eth0"
;;
esac
}
kirkwood_setup_macs()
{
local board="$1"
local lan_mac=""
local wan_mac=""
local label_mac=""
case "$board" in
dlink,dns320l)
lan_mac=$(mtd_get_mac_text "mini firmware")
;;
iptime,nas1)
lan_mac=$(mtd_get_mac_binary u-boot 0x3ffa8)
label_mac=$lan_mac
;;
linksys,e4200-v2|\
linksys,ea3500|\
linksys,ea4500)
wan_mac=$(mtd_get_mac_ascii u_env eth1addr)
;;
zyxel,nsa310b|\
zyxel,nsa325)
lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
}
board_config_update
board=$(board_name)
kirkwood_setup_interfaces $board
kirkwood_setup_macs $board
board_config_flush
exit 0

View File

@@ -0,0 +1,17 @@
. /lib/functions/uci-defaults.sh
board_config_update
board=$(board_name)
case "$board" in
checkpoint,l-50)
ucidef_add_gpio_switch "mpcie-rst" "mPCIE Card reset" "502" "1"
ucidef_add_gpio_switch "exp-card-rst" "Express Card reset" "497" "1"
;;
esac
board_config_flush
exit 0

View File

@@ -0,0 +1,24 @@
#
# Copyright (C) 2020 OpenWrt.org
#
. /lib/functions.sh
. /lib/functions/uci-defaults.sh
board_config_update
case "$(board_name)" in
iom,ix2-200|\
iom,ix4-200d)
ucidef_set_compat_version "2.0"
;;
linksys,e4200-v2|\
linksys,ea3500|\
linksys,ea4500)
ucidef_set_compat_version "3.0"
;;
esac
board_config_flush
exit 0

View File

@@ -0,0 +1,13 @@
#!/bin/sh /etc/rc.common
START=99
boot() {
case $(board_name) in
linksys,e4200-v2|\
linksys,ea3500|\
linksys,ea4500)
mtd resetbc s_env || true
;;
esac
}

View File

@@ -0,0 +1,59 @@
#!/bin/sh /etc/rc.common
START=98
boot() {
# configuring onboard temp/fan controller to run the fan on its own
# for more information, please read https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
case $(board_name) in
ctera,c200-v1)
path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-004c/hwmon/hwmon0'
# It should be related to hdd temerature instead lm63 temp
echo 1 > "$path_to_hwmon/pwm1_enable"
echo 128 > "$path_to_hwmon/pwm1"
;;
iom,ix2-200)
path_to_hwmon='/sys/class/hwmon/hwmon0'
echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1
;;
netgear,readynas-duo-v2)
path_to_hwmon='/sys/class/hwmon/hwmon0'
echo 1200 > "$path_to_hwmon/fan1_target" # set target rpm
;;
seagate,blackarmor-nas220)
path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
# adt7476 fan control chip. 3 temp sensors. Set to 1/4 speed at 35C and max speed at 48C.
echo 7 > "$path_to_hwmon/pwm1_auto_channels_temp"
echo 64 > "$path_to_hwmon/pwm1_auto_point1_pwm"
echo 255 > "$path_to_hwmon/pwm1_auto_point2_pwm"
echo 35000 > "$path_to_hwmon/temp1_auto_point1_temp"
echo 48000 > "$path_to_hwmon/temp1_auto_point2_temp"
echo 35000 > "$path_to_hwmon/temp2_auto_point1_temp"
echo 48000 > "$path_to_hwmon/temp2_auto_point2_temp"
echo 35000 > "$path_to_hwmon/temp3_auto_point1_temp"
echo 48000 > "$path_to_hwmon/temp3_auto_point2_temp"
echo 2 > "$path_to_hwmon/pwm1_enable"
;;
zyxel,nsa310b)
path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
# use the max. value of (temp1) OR (temp2) OR (temp3) as an input
# for the PWM of the cooling fan
echo 123 > "$path_to_hwmon/pwm1_auto_channels"
# Temperature sensor #1 placed on mainboard
echo 30000 > "$path_to_hwmon/temp1_auto_temp_min"
echo 49600 > "$path_to_hwmon/temp1_auto_temp_max"
# Temperature sensor #2 placed on mainboard
# range: 0 to 127000 in steps of 1000 [millicelsius]
echo 30000 > "$path_to_hwmon/temp2_auto_temp_min"
# range: 0 to 127000 in steps of ???? [millicelsius]
echo 49600 > "$path_to_hwmon/temp2_auto_temp_max"
# Temperature sensor #3 placed close to a chipset
# range: 0 to 60000 in steps of 1000 [millicelsius]
echo 23000 > "$path_to_hwmon/temp3_auto_temp_min"
# pre-defined steps: 103000, 122000, 143300, 170000 in [millicelsius]
echo 103000 > "$path_to_hwmon/temp3_auto_temp_max"
;;
esac
}

View File

@@ -0,0 +1,22 @@
#
# Copyright (C) 2021 OpenWrt.org
#
. /lib/functions.sh
board=$(board_name)
case "$board" in
netgear,stora)
# Set fan script execution in crontab
grep -s -q fan_ctrl.sh /etc/crontabs/root && exit 0
echo "# stora fan script runs every 5 minutes" >> /etc/crontabs/root
echo "*/5 * * * * /sbin/fan_ctrl.sh" >> /etc/crontabs/root
# Execute one time after initial flash (instead of waiting 5 min for cron)
/sbin/fan_ctrl.sh
;;
esac
exit 0

View File

@@ -0,0 +1,37 @@
. /lib/functions.sh
. /lib/functions/system.sh
preinit_set_mac_address() {
local mac
case $(board_name) in
checkpoint,l-50)
mac=$(mtd_get_mac_ascii bootldr-env lan1_mac_addr)
ip link set dev lan1 address $mac 2>/dev/null
ip link set dev lan2 address $(macaddr_add $mac 1) 2>/dev/null
ip link set dev lan3 address $(macaddr_add $mac 2) 2>/dev/null
ip link set dev lan4 address $(macaddr_add $mac 3) 2>/dev/null
ip link set dev lan5 address $(macaddr_add $mac 4) 2>/dev/null
ip link set dev lan6 address $(macaddr_add $mac 5) 2>/dev/null
ip link set dev lan7 address $(macaddr_add $mac 6) 2>/dev/null
ip link set dev lan8 address $(macaddr_add $mac 7) 2>/dev/null
ip link set dev dmz address $(macaddr_add $mac 8) 2>/dev/null
ip link set dev dsl address $(macaddr_add $mac 9) 2>/dev/null
;;
endian,4i-edge-200)
mac=$(cat /sys/class/net/eth0/address)
ip link set dev port1 address $mac 2>/dev/null
ip link set dev port2 address $(macaddr_add $mac 1) 2>/dev/null
ip link set dev port3 address $(macaddr_add $mac 2) 2>/dev/null
ip link set dev port4 address $(macaddr_add $mac 3) 2>/dev/null
;;
iptime,nas1)
mac=$(mtd_get_mac_binary u-boot 0x3ffa8)
ip link set dev eth0 address $mac 2>/dev/null
;;
esac
}
boot_hook_add preinit_main preinit_set_mac_address

View File

@@ -0,0 +1,81 @@
#
# Copyright (C) 2014 OpenWrt.org
#
linksys_get_target_firmware() {
local cur_boot_part mtd_ubi0
cur_boot_part=$(/usr/sbin/fw_printenv -n boot_part)
if [ -z "${cur_boot_part}" ] ; then
mtd_ubi0=$(cat /sys/class/ubi/ubi0/mtd_num)
case $(grep -E ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in
kernel|rootfs)
cur_boot_part=1
;;
alt_kernel|alt_rootfs)
cur_boot_part=2
;;
esac
>&2 printf "Current boot_part='%s' selected from ubi0/mtd_num='%s'" \
"${cur_boot_part}" "${mtd_ubi0}"
fi
case $cur_boot_part in
1)
fw_setenv -s - <<-EOF
boot_part 2
bootcmd "run altnandboot"
EOF
printf "kernel2"
return
;;
2)
fw_setenv -s - <<-EOF
boot_part 1
bootcmd "run nandboot"
EOF
printf "kernel1"
return
;;
*)
return
;;
esac
}
platform_do_upgrade_linksys() {
local magic_long="$(get_magic_long "$1")"
mkdir -p /var/lock
local part_label="$(linksys_get_target_firmware)"
touch /var/lock/fw_printenv.lock
if [ ! -n "$part_label" ]
then
echo "cannot find target partition"
exit 1
fi
local target_mtd=$(find_mtd_part $part_label)
[ "$magic_long" = "73797375" ] && {
CI_KERNPART="$part_label"
if [ "$part_label" = "kernel1" ]
then
CI_UBIPART="rootfs1"
else
CI_UBIPART="rootfs2"
fi
if nand_upgrade_tar "$1" ; then
nand_do_upgrade_success
else
nand_do_upgrade_failed
fi
}
[ "$magic_long" = "27051956" ] && {
get_image "$1" | mtd write - $part_label
}
}

View File

@@ -0,0 +1,49 @@
RAMFS_COPY_BIN='fw_printenv fw_setenv strings'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
platform_check_image() {
local board="$(board_name)"
case "$board" in
netgear,readynas-duo-v2)
# let's store how rootfs is mounted
cp /proc/mounts /tmp/mounts
return 0
;;
*)
return 0
;;
esac
}
platform_do_upgrade() {
local board="$(board_name)"
case "$board" in
ctera,c200-v1)
part=$(find_mtd_part "active_bank")
if [ -n "$part" ]; then
CI_KERNPART="$(strings $part | grep bank)"
nand_do_upgrade "$1"
else
echo "active_bank partition missed!"
return 1
fi
;;
iptime,nas1)
default_do_upgrade "$1"
;;
linksys,e4200-v2|\
linksys,ea3500|\
linksys,ea4500)
platform_do_upgrade_linksys "$1"
;;
*)
nand_do_upgrade "$1"
;;
esac
}

View File

@@ -0,0 +1,28 @@
#!/bin/sh
. /lib/functions.sh
case $(board_name) in
ctera,c200-v1)
part=$(find_mtd_part "active_bank")
if [ -n "$part" ]; then
active_bank="$(strings $part | grep bank)"
if [ $active_bank = "bank1" ]; then
echo "bank2" > /tmp/change_bank
else
echo "bank1" > /tmp/change_bank
fi
mtd write /tmp/change_bank active_bank
reboot
else
echo "active_bank partition missed!"
return 1
fi
;;
*)
echo "Unsupported hardware."
;;
esac

View File

@@ -0,0 +1,23 @@
#!/bin/sh
CPU_TEMP=$(cut -c1-2 /sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-0048/hwmon/hwmon?/temp1_input)
CPU_LOW=45
CPU_MID=50
CPU_HIGH=55
if [ ! -e /sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-001b/hwmon/hwmon?/pwm1 ]; then
exit 0
else
FAN_CTRL=$(ls /sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-001b/hwmon/hwmon?/pwm1)
fi
if [ "$CPU_TEMP" -ge "$CPU_HIGH" ]; then
echo "255" > $FAN_CTRL
elif [ "$CPU_TEMP" -ge "$CPU_MID" ]; then
echo "100" > $FAN_CTRL
elif [ "$CPU_TEMP" -ge "$CPU_LOW" ]; then
echo "50" > $FAN_CTRL
else
echo "0" > $FAN_CTRL
fi