Initial commit

This commit is contained in:
domenico
2025-06-24 13:14:22 +02:00
commit 4002f145fc
9002 changed files with 1731834 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,50 @@
#
# Copyright (C) 2012-2015 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
board_config_update
board=$(board_name)
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|\
globalscale,sheevaplug|\
iom,iconnect-1.1|\
iom,ix2-200|\
raidsonic,ib-nas62x0|\
seagate,blackarmor-nas220|\
seagate,dockstar|\
seagate,goflexhome|\
seagate,goflexnet|\
zyxel,nsa310s)
ucidef_set_interface_lan "eth0" "dhcp"
;;
linksys,e4200-v2|\
linksys,ea3500|\
linksys,ea4500)
ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
ucidef_set_interface_macaddr "wan" $( mtd_get_mac_ascii u_env eth1addr )
;;
zyxel,nsa310b|\
zyxel,nsa325)
ucidef_set_interface_lan "eth0" "dhcp"
ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr )
;;
*)
ucidef_set_interface_lan "eth0"
;;
esac
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,20 @@
#
# Copyright (C) 2020 OpenWrt.org
#
. /lib/functions.sh
. /lib/functions/uci-defaults.sh
board_config_update
case "$(board_name)" in
linksys,e4200-v2|\
linksys,ea3500|\
linksys,ea4500)
ucidef_set_compat_version "2.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,48 @@
#!/bin/sh /etc/rc.common
START=98
boot() {
# configuring (lm85/lm63) 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
iom,ix2-200)
path_to_hwmon='/sys/class/hwmon/hwmon0'
echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1
;;
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,25 @@
. /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
;;
esac
}
boot_hook_add preinit_main preinit_set_mac_address

View File

@@ -0,0 +1,93 @@
#
# 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/devices/virtual/ubi/ubi0/mtd_num)
case $(egrep ^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
}
linksys_get_root_magic() {
(get_image "$@" | dd skip=786432 bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2>/dev/null
}
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
nand_upgrade_tar "$1"
}
[ "$magic_long" = "27051956" ] && {
# check firmwares' rootfs types
local target_mtd=$(find_mtd_part $part_label)
local oldroot="$(linksys_get_root_magic $target_mtd)"
local newroot="$(linksys_get_root_magic "$1")"
if [ "$newroot" = "55424923" -a "$oldroot" = "55424923" ]
# we're upgrading from a firmware with UBI to one with UBI
then
# erase everything to be safe
mtd erase $part_label
get_image "$1" | mtd -n write - $part_label
else
get_image "$1" | mtd write - $part_label
fi
}
}

View File

@@ -0,0 +1,23 @@
RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
REQUIRE_IMAGE_METADATA=1
platform_check_image() {
return 0
}
platform_do_upgrade() {
local board="$(board_name)"
case "$board" in
linksys,e4200-v2|\
linksys,ea3500|\
linksys,ea4500)
platform_do_upgrade_linksys "$1"
;;
*)
nand_do_upgrade "$1"
;;
esac
}