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,53 @@
. /lib/functions.sh
. /lib/functions/system.sh
set_ether_mac() {
local part
local DEVID
local MAC1
local MAC2
case "$(board_name)" in
dlink,dns-313)
# The DNS-313 has a special field in its RedBoot
# binary that we need to check
part="$(find_mtd_part RedBoot)"
if [ -n "$part" ]; then
DEVID="$(dd if=$part bs=1 skip=119508 count=7 2>/dev/null)"
if [ "$DEVID" = "dns-313" ]; then
MAC1="$(mtd_get_mac_binary RedBoot 0x1d2f4)"
ip link set eth0 address "$MAC1" 2>/dev/null
return 0
fi
fi
;;
dlink,dir-685)
# The DIR-685 has a special field in its RedBoot
# binary that we need to check
part=$(find_mtd_part RedBoot)
if [ -n "$part" ] ; then
DEVID="$(dd if=$part bs=1 skip=81516 count=7 2>/dev/null)"
if [ "$DEVID" = "ILI9322" ] ; then
MAC1=$(mtd_get_mac_binary RedBoot 0x17340)
MAC2=$(mtd_get_mac_binary RedBoot 0x17346)
ip link set eth0 address "$MAC1" 2>/dev/null
ip link set eth1 address "$MAC2" 2>/dev/null
return 0
fi
fi
;;
esac
# Most devices have a standard "VCTL" partition
part="$(find_mtd_part VCTL)"
if [ -n "$part" ]; then
MAC1="$(strings $part |grep MAC|cut -d: -f2|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
MAC2="$(strings $part |grep MAC|cut -d: -f8|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
ip link set eth0 address "$MAC1" 2>/dev/null
ip link set eth1 address "$MAC2" 2>/dev/null
return 0
fi
}
boot_hook_add preinit_main set_ether_mac