mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-18 21:28:02 +00:00
mediatek: make use of Acer Predator Connect W6's u-boot environment
In order to prepare OpenWrt support for other Acer W6 devices and to adapt the procedure to read and set mac addresses which other devices of the same target are using (instead of needing an additional script and creating an additional structure in the file system), this commit - reads device mac addresses from u-boot environment - avoids the detour via the file system to set the mac addresses - drops redundant file /lib/preinit/05_extract_factory_data.sh The idea and the implementation were thankfully taken from PR #16410. This is the second of four commits into which the original commit was split to make reviews easier and more targeted. Signed-off-by: George Oldfort <openwrt@10099.de> Link: https://github.com/openwrt/openwrt/pull/16861 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
ce3b36b3d5
commit
e7aaba2587
@ -49,6 +49,14 @@ xiaomi,redmi-router-ax6000-ubootmod|\
|
||||
zyxel,ex5601-t0-ubootmod)
|
||||
ubootenv_add_ubi_default
|
||||
;;
|
||||
acer,predator-w6|\
|
||||
glinet,gl-mt2500|\
|
||||
glinet,gl-mt6000|\
|
||||
glinet,gl-x3000|\
|
||||
glinet,gl-xe3000)
|
||||
local envdev=$(find_mmc_part "u-boot-env")
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
|
||||
;;
|
||||
asus,rt-ax59u)
|
||||
ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000"
|
||||
;;
|
||||
@ -89,13 +97,6 @@ dlink,aquila-pro-ai-m30-a1)
|
||||
gatonetworks,gdsp)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
glinet,gl-x3000|\
|
||||
glinet,gl-xe3000|\
|
||||
glinet,gl-mt2500|\
|
||||
glinet,gl-mt6000)
|
||||
local envdev=$(find_mmc_part "u-boot-env")
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
|
||||
;;
|
||||
glinet,gl-mt3000)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
|
||||
;;
|
||||
|
@ -132,6 +132,10 @@ mediatek_setup_macs()
|
||||
local label_mac=""
|
||||
|
||||
case $board in
|
||||
acer,predator-w6)
|
||||
wan_mac=$(mmc_get_mac_ascii u-boot-env WANMAC)
|
||||
lan_mac=$(mmc_get_mac_ascii u-boot-env LANMAC)
|
||||
;;
|
||||
bananapi,bpi-r3|\
|
||||
bananapi,bpi-r3-mini|\
|
||||
bananapi,bpi-r4)
|
||||
|
@ -18,10 +18,9 @@ case "$board" in
|
||||
[ "$PHYNBR" = "1" ] && macaddr_setbit_la $addr > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
acer,predator-w6)
|
||||
key_path="/var/qcidata/data"
|
||||
[ "$PHYNBR" = "0" ] && cat $key_path/2gMAC > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "1" ] && cat $key_path/6gMAC > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "2" ] && cat $key_path/5gMAC > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "0" ] && mmc_get_mac_ascii u-boot-env 2gMAC > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "1" ] && mmc_get_mac_ascii u-boot-env 6gMAC > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "2" ] && mmc_get_mac_ascii u-boot-env 5gMAC > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
asus,rt-ax59u)
|
||||
CI_UBIPART="UBI_DEV"
|
||||
|
@ -1,25 +0,0 @@
|
||||
. /lib/functions/system.sh
|
||||
|
||||
predator_w6_factory_extract() {
|
||||
local mmc_part
|
||||
|
||||
mmc_part="$(find_mmc_part qcidata)"
|
||||
|
||||
mkdir -p /var/qcidata/data
|
||||
mkdir -p /var/qcidata/mount
|
||||
|
||||
mount -r "$mmc_part" /var/qcidata/mount
|
||||
|
||||
cp /var/qcidata/mount/factory/*MAC "/var/qcidata/data/"
|
||||
umount "/var/qcidata/mount"
|
||||
}
|
||||
|
||||
preinit_extract_factory() {
|
||||
case $(board_name) in
|
||||
acer,predator-w6)
|
||||
predator_w6_factory_extract
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main preinit_extract_factory
|
@ -3,12 +3,13 @@
|
||||
preinit_set_mac_address() {
|
||||
case $(board_name) in
|
||||
acer,predator-w6)
|
||||
key_path="/var/qcidata/data"
|
||||
ip link set dev lan1 address "$(cat $key_path/LANMAC)"
|
||||
ip link set dev lan2 address "$(cat $key_path/LANMAC)"
|
||||
ip link set dev lan3 address "$(cat $key_path/LANMAC)"
|
||||
ip link set dev game address "$(cat $key_path/LANMAC)"
|
||||
ip link set dev eth1 address "$(cat $key_path/WANMAC)"
|
||||
$(mmc_get_mac_ascii u-boot-env WANMAC)
|
||||
$(mmc_get_mac_ascii u-boot-env LANMAC)
|
||||
ip link set dev lan1 address "$lan_mac"
|
||||
ip link set dev lan2 address "$lan_mac"
|
||||
ip link set dev lan3 address "$lan_mac"
|
||||
ip link set dev game address "$lan_mac"
|
||||
ip link set dev eth1 address "$wan_mac"
|
||||
;;
|
||||
asus,tuf-ax4200|\
|
||||
asus,tuf-ax6000)
|
||||
|
Loading…
Reference in New Issue
Block a user