mirror of https://github.com/hak5/openwrt.git
ar71xx: base-files: cosmetic cleanups in preinit scripts
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>openwrt-18.06
parent
9a867fcddf
commit
ce6c7691ec
|
@ -27,13 +27,15 @@ preinit_set_mac_address() {
|
|||
mac_lan=$(mtd_get_mac_binary art 0)
|
||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
||||
;;
|
||||
dir-615-c1)
|
||||
dir-615-c1|\
|
||||
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
|
||||
;;
|
||||
mr18)
|
||||
mr18|\
|
||||
z1)
|
||||
mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
|
||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
||||
;;
|
||||
|
@ -49,16 +51,9 @@ preinit_set_mac_address() {
|
|||
mac_wan=$(mtd_get_mac_binary art 6)
|
||||
[ -n "$mac_wan" ] && ifconfig eth1 hw ether "$mac_wan"
|
||||
;;
|
||||
tew-632brp)
|
||||
fetch_mac_from_mtd config lan_mac wan_mac
|
||||
;;
|
||||
wrt160nl)
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,3 @@ 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"
|
||||
|
||||
# bail out if firmware does not exist
|
||||
[ -f "$firmware_file" ] || {
|
||||
return
|
||||
}
|
||||
[ -f "$firmware_file" ] || return
|
||||
|
||||
local mac_offset=276
|
||||
local mac_length=6
|
||||
|
@ -17,34 +15,33 @@ 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)"
|
||||
|
||||
# check if mac address was already patched
|
||||
[ "$default_mac" = "$current_mac" ] || {
|
||||
return
|
||||
}
|
||||
[ "$default_mac" = "$current_mac" ] || return
|
||||
|
||||
# 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
|
||||
# the otp.
|
||||
case $(board_name) in
|
||||
dgl-5500-a1 | tew-823dru)
|
||||
dgl-5500-a1|\
|
||||
tew-823dru)
|
||||
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
|
||||
|
||||
;;
|
||||
esac
|
||||
[ -f /tmp/ath10k-firmware.bin ] || {
|
||||
return
|
||||
}
|
||||
|
||||
[ -f /tmp/ath10k-firmware.bin ] || return
|
||||
|
||||
cp /tmp/ath10k-firmware.bin $firmware_file
|
||||
rm /tmp/ath10k-firmware.bin
|
||||
}
|
||||
|
||||
check_patch_ath10k_firmware() {
|
||||
case $(board_name) in
|
||||
dgl-5500-a1 | tew-823dru)
|
||||
dgl-5500-a1|\
|
||||
tew-823dru)
|
||||
do_patch_ath10k_firmware
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue