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 14:35:53 +02:00
commit c06fb25d1f
9263 changed files with 1750214 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
#!/bin/sh
# This must run before 10-wifi-detect
[ "${ACTION}" = "add" ] || return
. /lib/functions.sh
check_radio()
{
local cfg="$1" to="$2"
config_get path "$cfg" path
[ "$path" = "$to" ] && PATH_EXISTS=true
}
do_migrate_radio()
{
local cfg="$1" from="$2" to="$3"
config_get path "$cfg" path
[ "$path" = "$from" ] || return
uci set "wireless.${cfg}.path=${to}"
WIRELESS_CHANGED=true
logger -t wifi-migrate "Updated path of wireless.${cfg} from '${from}' to '${to}'"
}
migrate_radio()
{
local from="$1" to="$2"
config_load wireless
# Check if there is already a section with the target path: In this case, the system
# was already upgraded to a version without this migration script before; better bail out,
# as we can't be sure we don't break more than we fix.
PATH_EXISTS=false
config_foreach check_radio wifi-device "$to"
$PATH_EXISTS && return
config_foreach do_migrate_radio wifi-device "$from" "$to"
}
WIRELESS_CHANGED=false
case "$(board_name)" in
arcadyan,we420223-99|\
beeline,smartbox-flash|\
mts,wg430223)
migrate_radio '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0' '1e140000.pcie/pci0000:00/0000:00:01.0/0000:01:00.0'
migrate_radio '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0+1' '1e140000.pcie/pci0000:00/0000:00:01.0/0000:01:00.0+1'
;;
netgear,r6220|\
netgear,wac104|\
netgear,wndr3700-v5)
migrate_radio '1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0' '1e140000.pcie/pci0000:00/0000:00:02.0/0000:02:00.0'
;;
zbtlink,zbt-we1326|\
zbtlink,zbt-we3526)
migrate_radio '1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0' '1e140000.pcie/pci0000:00/0000:00:02.0/0000:02:00.0'
migrate_radio '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0' '1e140000.pcie/pci0000:00/0000:00:01.0/0000:01:00.0'
;;
esac
$WIRELESS_CHANGED && uci commit wireless
exit 0

View File

@@ -0,0 +1,244 @@
[ "$ACTION" == "add" ] || exit 0
PHYNBR=${DEVPATH##*/phy}
[ -n $PHYNBR ] || exit 0
. /lib/functions.sh
. /lib/functions/system.sh
board=$(board_name)
case "$board" in
arcadyan,we420223-99)
if [ "$PHYNBR" = "0" ]; then
mac24=$(macaddr_add "$(get_mac_label)" "0xf00001")
echo -n "$mac24" > /sys${DEVPATH}/macaddress
elif [ "$PHYNBR" = "1" ]; then
mac5=$(macaddr_add "$(get_mac_label)" 1)
echo -n "$mac5" > /sys${DEVPATH}/macaddress
fi
;;
beeline,smartbox-flash)
hw_mac_addr=$(macaddr_add $(mtd_get_mac_encrypted_arcadyan "board_data") 1)
[ "$PHYNBR" = "0" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress
hw_mac_addr=$(macaddr_setbit $hw_mac_addr 26)
hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 27)
hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 28)
[ "$PHYNBR" = "1" ] && macaddr_setbit_la $hw_mac_addr > /sys${DEVPATH}/macaddress
;;
buffalo,wsr-2533dhpls)
lan_mac_addr=$(mtd_get_mac_ascii board_data "mac")
[ "$PHYNBR" = "0" ] && \
macaddr_add $lan_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && \
macaddr_add $lan_mac_addr 8 > /sys${DEVPATH}/macaddress
;;
comfast,cf-e390ax)
[ "$PHYNBR" = "0" ] && echo -n "$(mtd_get_mac_binary factory 0x0004)" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && echo -n "$(mtd_get_mac_binary factory 0x8004)" > /sys${DEVPATH}/macaddress
;;
cudy,x6-v1|\
cudy,x6-v2)
hw_mac_addr="$(mtd_get_mac_binary bdinfo 0xde00)"
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(macaddr_add $hw_mac_addr 0x100000)" > /sys${DEVPATH}/macaddress
;;
dlink,dap-1620-b1|\
dlink,dir-853-a1|\
dlink,dra-1360-a1)
lan_mac_addr="$(mtd_get_mac_binary factory 0xe000)"
[ "$PHYNBR" = "0" ] && \
macaddr_add $lan_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && \
macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
dlink,covr-x1860-a1)
label_mac=$(mtd_get_mac_ascii config2 factory_mac)
[ "$PHYNBR" = "0" ] && \
macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && \
macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress
;;
dlink,dap-x1860-a1)
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
[ "$PHYNBR" = "0" ] && \
macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && \
macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress
;;
dlink,dir-3040-a1)
lan_mac_addr="$(mtd_get_mac_binary factory 0xe000)"
[ "$PHYNBR" = "0" ] && \
macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
dlink,dir-853-a3)
[ "$PHYNBR" = "0" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary factory 0xe000)" \
> /sys${DEVPATH}/macaddress
;;
dlink,dir-853-r1|\
phicomm,k2p)
if [ "$PHYNBR" = "0" ]; then
base_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" -1)
macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress
fi
;;
glinet,gl-mt1300|\
z-router,zr-2660)
[ "$PHYNBR" = "1" ] && \
macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress
;;
h3c,tx1800-plus|\
h3c,tx1801-plus|\
h3c,tx1806)
addr=$(macaddr_setbit $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 2) 7)
[ "$PHYNBR" = "0" ] && echo -n ${addr:0:9}'1'${addr:10:7} > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && echo -n ${addr:0:9}'7'${addr:10:7} > /sys${DEVPATH}/macaddress
;;
haier,har-20s2u1|\
jcg,y2|\
sim,simax1800t)
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary factory 0x4)" > /sys${DEVPATH}/macaddress
;;
hiwifi,hc5962)
label_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ")
[ "$PHYNBR" = "0" ] && [ -n "$label_mac" ] && \
echo -n "$label_mac" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && [ -n "$label_mac" ] && \
macaddr_unsetbit "$label_mac" 6 > /sys${DEVPATH}/macaddress
;;
iptime,a3002mesh|\
iptime,a3004t)
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
[ "$PHYNBR" = "0" ] && \
macaddr_setbit_la "$(macaddr_add $hw_mac_addr 3)" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress
;;
iptime,ax2004m)
if [ "$PHYNBR" = "1" ]; then
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
macaddr_setbit_la "$(macaddr_add $hw_mac_addr 3)" > /sys${DEVPATH}/macaddress
fi
;;
jcg,q20)
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress
;;
keenetic,kn-3510)
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress
;;
linksys,e5600|\
linksys,ea6350-v4|\
linksys,ea7300-v1|\
linksys,ea7300-v2|\
linksys,ea7500-v2|\
linksys,ea8100-v1|\
linksys,ea8100-v2)
hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
belkin,rt1800|\
linksys,e7350)
hw_mac_addr=$(mtd_get_mac_ascii Config wan_hwaddr)
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
netgear,eax12)
hw_mac_addr=$(mtd_get_mac_ascii Config mac)
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
netgear,wax202)
hw_mac_addr=$(mtd_get_mac_ascii Config mac)
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress
;;
netgear,wax214v2)
hw_mac_addr=$(mtd_get_mac_ascii Config ethaddr)
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress
;;
netis,n6)
hw_mac_addr="$(mtd_get_mac_binary Factory 0x4)"
hw_mac_addr=$(macaddr_setbit $hw_mac_addr 28)
hw_mac_2g=$(macaddr_unsetbit $hw_mac_addr 26)
hw_mac_5g=$(macaddr_setbit $hw_mac_addr 27)
[ "$PHYNBR" = "0" ] && echo -n "$hw_mac_2g" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && echo -n "$hw_mac_5g" > /sys${DEVPATH}/macaddress
;;
mercusys,mr70x-v1|\
tplink,archer-ax23-v1)
hw_mac_addr="$(mtd_get_mac_binary config 0x8)"
[ "$PHYNBR" = "1" ] && macaddr_add "$hw_mac_addr" -1 > "/sys${DEVPATH}/macaddress"
;;
mts,wg430223)
hw_mac_addr=$(macaddr_add $(mtd_get_mac_encrypted_arcadyan "board_data") 1)
[ "$PHYNBR" = "0" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress
hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 26)
hw_mac_addr=$(macaddr_setbit $hw_mac_addr 27)
hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 28)
[ "$PHYNBR" = "1" ] && macaddr_setbit_la $hw_mac_addr > /sys${DEVPATH}/macaddress
;;
oraybox,x3a)
if [ "$PHYNBR" = "1" ]; then
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
macaddr_setbit_la "$(macaddr_add $hw_mac_addr 0x100000)" > /sys${DEVPATH}/macaddress
fi
;;
raisecom,msg1500-x-00)
[ "$PHYNBR" = "0" ] && \
macaddr_setbit_la "$(get_mac_label)" > /sys${DEVPATH}/macaddress
;;
ruijie,rg-ew1200g-pro-v1.1)
hw_mac_addr="$(mtd_get_mac_ascii product_info ethaddr)"
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
snr,snr-cpe-me2-sfp)
hw_mac_addr="$(mtd_get_mac_binary factory 0x8004)"
[ "$PHYNBR" = "1" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress
;;
tenbay,t-mb5eu-v01)
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr "0x100000" > /sys${DEVPATH}/macaddress
;;
totolink,x5000r)
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress
;;
tplink,eap613-v1|\
tplink,eap615-wall-v1)
hw_mac_addr="$(mtd_get_mac_binary product-info 0x8)"
macaddr_add "$hw_mac_addr" "$PHYNBR" > "/sys${DEVPATH}/macaddress"
;;
tplink,ex220-v1)
hw_mac_addr="$(mtd_get_mac_binary rom_file 0xf100)"
[ "$PHYNBR" = "1" ] && macaddr_add "$hw_mac_addr" 2 > "/sys${DEVPATH}/macaddress"
;;
yuncore,ax820|\
yuncore,g720)
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary Factory 0xe000)" > /sys${DEVPATH}/macaddress
;;
yuncore,fap640|\
yuncore,fap690)
hw_mac_addr="$(mtd_get_mac_binary Factory 0x4)"
[ "$PHYNBR" = "0" ] && macaddr_setbit_la "$hw_mac_addr" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress
;;
zyxel,nwa50ax|\
zyxel,nwa55axe)
hw_mac_addr="$(mtd_get_mac_binary mrd 0x1fff8)"
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
zyxel,wsm20)
hw_mac_addr="$(mtd_get_mac_binary Factory 0x1fdfa)"
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
esac