ar71xx: base-files: cosmetic cleanups in preinit scripts
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This commit is contained in:
parent
9a867fcddf
commit
ce6c7691ec
3 changed files with 82 additions and 93 deletions
|
@ -22,43 +22,38 @@ preinit_set_mac_address() {
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
|
|
||||||
case $(board_name) in
|
case $(board_name) in
|
||||||
c-55|\
|
c-55|\
|
||||||
c-60)
|
c-60)
|
||||||
mac_lan=$(mtd_get_mac_binary art 0)
|
mac_lan=$(mtd_get_mac_binary art 0)
|
||||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
||||||
;;
|
;;
|
||||||
dir-615-c1)
|
dir-615-c1|\
|
||||||
fetch_mac_from_mtd config lan_mac wan_mac
|
tew-632brp)
|
||||||
;;
|
fetch_mac_from_mtd config lan_mac wan_mac
|
||||||
dir-615-i1)
|
;;
|
||||||
fetch_mac_from_mtd nvram sys_lan_mac sys_wan_mac
|
dir-615-i1)
|
||||||
;;
|
fetch_mac_from_mtd nvram sys_lan_mac sys_wan_mac
|
||||||
mr18)
|
;;
|
||||||
mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
|
mr18|\
|
||||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
z1)
|
||||||
;;
|
mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
|
||||||
r6100)
|
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
||||||
mac_lan=$(mtd_get_mac_binary caldata 0)
|
;;
|
||||||
[ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan"
|
r6100)
|
||||||
mac_wan=$(mtd_get_mac_binary caldata 6)
|
mac_lan=$(mtd_get_mac_binary caldata 0)
|
||||||
[ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
|
[ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan"
|
||||||
;;
|
mac_wan=$(mtd_get_mac_binary caldata 6)
|
||||||
rambutan)
|
[ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
|
||||||
mac_lan=$(mtd_get_mac_binary art 0)
|
;;
|
||||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
rambutan)
|
||||||
mac_wan=$(mtd_get_mac_binary art 6)
|
mac_lan=$(mtd_get_mac_binary art 0)
|
||||||
[ -n "$mac_wan" ] && ifconfig eth1 hw ether "$mac_wan"
|
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
||||||
;;
|
mac_wan=$(mtd_get_mac_binary art 6)
|
||||||
tew-632brp)
|
[ -n "$mac_wan" ] && ifconfig eth1 hw ether "$mac_wan"
|
||||||
fetch_mac_from_mtd config lan_mac wan_mac
|
;;
|
||||||
;;
|
wrt160nl)
|
||||||
wrt160nl)
|
fetch_mac_from_mtd nvram lan_hwaddr wan_hwaddr
|
||||||
fetch_mac_from_mtd nvram lan_hwaddr wan_hwaddr
|
;;
|
||||||
;;
|
|
||||||
z1)
|
|
||||||
mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
|
|
||||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,41 +8,41 @@ set_preinit_iface() {
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
|
|
||||||
case $(board_name) in
|
case $(board_name) in
|
||||||
alfa-ap96 |\
|
alfa-ap96|\
|
||||||
alfa-nx |\
|
alfa-nx|\
|
||||||
ap135-020 |\
|
ap135-020|\
|
||||||
ap136-020 |\
|
ap136-020|\
|
||||||
ap147-010 |\
|
ap147-010|\
|
||||||
archer-c5 |\
|
archer-c5|\
|
||||||
archer-c7 |\
|
archer-c7|\
|
||||||
bhr-4grv2 |\
|
bhr-4grv2|\
|
||||||
dir-505-a1 |\
|
dir-505-a1|\
|
||||||
gl-inet |\
|
gl-inet|\
|
||||||
jwap003 |\
|
jwap003|\
|
||||||
pb42 |\
|
pb42|\
|
||||||
pb44 |\
|
pb44|\
|
||||||
rb-433 |\
|
rb-433|\
|
||||||
rb-433u |\
|
rb-433u|\
|
||||||
rb-435g |\
|
rb-435g|\
|
||||||
rb-450 |\
|
rb-450|\
|
||||||
rb-450g |\
|
rb-450g|\
|
||||||
routerstation |\
|
routerstation|\
|
||||||
routerstation-pro |\
|
routerstation-pro|\
|
||||||
smart-300 |\
|
smart-300|\
|
||||||
tl-mr3420-v2 |\
|
tl-mr3420-v2|\
|
||||||
tl-wdr4900-v2 |\
|
tl-wdr4900-v2|\
|
||||||
tl-wr1043nd-v2 |\
|
tl-wr1043nd-v2|\
|
||||||
tl-wr710n |\
|
tl-wr710n|\
|
||||||
tl-wr720n-v3 |\
|
tl-wr720n-v3|\
|
||||||
tl-wr841n-v8 |\
|
tl-wr841n-v8|\
|
||||||
tl-wr842n-v2 |\
|
tl-wr842n-v2|\
|
||||||
tl-wr940n-v4 |\
|
tl-wr940n-v4|\
|
||||||
tl-wr941nd-v6 |\
|
tl-wr941nd-v6|\
|
||||||
wnr1000-v2 |\
|
wnr1000-v2|\
|
||||||
wnr2000-v3 |\
|
wnr2000-v3|\
|
||||||
wnr2200 |\
|
wnr2200|\
|
||||||
wnr612-v2 |\
|
wnr612-v2|\
|
||||||
wpe72 |\
|
wpe72|\
|
||||||
wpn824n)
|
wpn824n)
|
||||||
ifname=eth1
|
ifname=eth1
|
||||||
;;
|
;;
|
||||||
|
@ -53,6 +53,3 @@ set_preinit_iface() {
|
||||||
}
|
}
|
||||||
|
|
||||||
boot_hook_add preinit_main set_preinit_iface
|
boot_hook_add preinit_main set_preinit_iface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,7 @@ do_patch_ath10k_firmware() {
|
||||||
local firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin"
|
local firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin"
|
||||||
|
|
||||||
# bail out if firmware does not exist
|
# bail out if firmware does not exist
|
||||||
[ -f "$firmware_file" ] || {
|
[ -f "$firmware_file" ] || return
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
local mac_offset=276
|
local mac_offset=276
|
||||||
local mac_length=6
|
local mac_length=6
|
||||||
|
@ -17,35 +15,34 @@ do_patch_ath10k_firmware() {
|
||||||
local current_mac="$(hexdump -v -n $mac_length -s $mac_offset -e '5/1 "%02x:" 1/1 "%02x"' $firmware_file 2>/dev/null)"
|
local current_mac="$(hexdump -v -n $mac_length -s $mac_offset -e '5/1 "%02x:" 1/1 "%02x"' $firmware_file 2>/dev/null)"
|
||||||
|
|
||||||
# check if mac address was already patched
|
# check if mac address was already patched
|
||||||
[ "$default_mac" = "$current_mac" ] || {
|
[ "$default_mac" = "$current_mac" ] || return
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# some boards have bogus mac in otp (= directly in the PCIe card's EEPROM).
|
# some boards have bogus mac in otp (= directly in the PCIe card's EEPROM).
|
||||||
# we have to patch the default mac in the firmware because we cannot change
|
# we have to patch the default mac in the firmware because we cannot change
|
||||||
# the otp.
|
# the otp.
|
||||||
case $(board_name) in
|
case $(board_name) in
|
||||||
dgl-5500-a1 | tew-823dru)
|
dgl-5500-a1|\
|
||||||
local mac
|
tew-823dru)
|
||||||
mac=$(mtd_get_mac_ascii nvram wlan1_mac)
|
local mac
|
||||||
|
mac=$(mtd_get_mac_ascii nvram wlan1_mac)
|
||||||
cp $firmware_file /tmp/ath10k-firmware.bin
|
|
||||||
macaddr_2bin $mac | dd of=/tmp/ath10k-firmware.bin \
|
|
||||||
conv=notrunc bs=1 seek=$mac_offset count=$mac_length
|
|
||||||
|
|
||||||
|
cp $firmware_file /tmp/ath10k-firmware.bin
|
||||||
|
macaddr_2bin $mac | dd of=/tmp/ath10k-firmware.bin \
|
||||||
|
conv=notrunc bs=1 seek=$mac_offset count=$mac_length
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
[ -f /tmp/ath10k-firmware.bin ] || {
|
|
||||||
return
|
[ -f /tmp/ath10k-firmware.bin ] || return
|
||||||
}
|
|
||||||
cp /tmp/ath10k-firmware.bin $firmware_file
|
cp /tmp/ath10k-firmware.bin $firmware_file
|
||||||
rm /tmp/ath10k-firmware.bin
|
rm /tmp/ath10k-firmware.bin
|
||||||
}
|
}
|
||||||
|
|
||||||
check_patch_ath10k_firmware() {
|
check_patch_ath10k_firmware() {
|
||||||
case $(board_name) in
|
case $(board_name) in
|
||||||
dgl-5500-a1 | tew-823dru)
|
dgl-5500-a1|\
|
||||||
do_patch_ath10k_firmware
|
tew-823dru)
|
||||||
|
do_patch_ath10k_firmware
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue