[][OpenWRT][mt7988][Add LAN2 MAC to mtk_factory_rw.sh]
[Description]
Add LAN2 MAC to mtk_factory_rw.sh
1. Add lan2_mac_offset.
2. Fix xxx_mac_offset typo.
Write lan2_mac to offset 0xFFFEE(1024k - 0x12) in Factory partition.
Write lan_mac to offset 0xFFFF4(1024k - 0x0c) in Factory partition.
Write wan_mac to offset 0xFFFFA(1024k - 0x06) in Factory partition.
=================================================================================
root@OpenWrt:/# cat /proc/mtd
dev: size erasesize name
mtd0: 08000000 00020000 "spi0.0"
mtd1: 00100000 00020000 "BL2"
mtd2: 00080000 00020000 "u-boot-env"
mtd3: 00200000 00020000 "Factory"
mtd4: 00200000 00020000 "FIP"
mtd5: 04000000 00020000 "ubi"
root@OpenWrt:/# hexdump -C /dev/mtd3
00000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
* * 000fffe0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 0c |................|
* * 000ffff0 43 49 a2 da 00 0c 43 49 a2 d8 02 0c 43 49 a2 d8 |CI....CI....CI..|
* * 00100000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
* =================================================================================
[Release-log]
N/A
Change-Id: I7bfee6b54cd04bd94cda579dac77a959a840c60e
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6321153
diff --git a/feed/mtk_factory_rw/files/mtk_factory_rw.sh b/feed/mtk_factory_rw/files/mtk_factory_rw.sh
index e5bd47e..3124088 100755
--- a/feed/mtk_factory_rw/files/mtk_factory_rw.sh
+++ b/feed/mtk_factory_rw/files/mtk_factory_rw.sh
@@ -47,9 +47,10 @@
wan_mac_offset=0x1F806
;;
*7988*)
- #2560k - 12 byte
- lan_mac_offset=0x27FFF4
- wan_mac_offset=0x27FFFA
+ #1024k - 18 byte
+ lan2_mac_offset=0xFFFEE
+ lan_mac_offset=0xFFFF4
+ wan_mac_offset=0xFFFFA
;;
*)
lan_mac_offset=0x2A
@@ -104,6 +105,9 @@
if [ "$1" == "lan" ]; then
#read lan mac
Get_offset_data 6 ${lan_mac_offset}
+ elif [ "$1" == "lan2" ]; then
+ #read lan2 mac
+ Get_offset_data 6 ${lan2_mac_offset}
elif [ "$1" == "wan" ]; then
#read wan mac
Get_offset_data 6 ${wan_mac_offset}
@@ -126,6 +130,10 @@
#write lan mac
Set_offset_data 6 ${lan_mac_offset} $@
+ elif [ "$1" == "lan2" ]; then
+ #write lan2 mac
+ Set_offset_data 6 ${lan2_mac_offset} $@
+
elif [ "$1" == "wan" ]; then
#write wan mac
Set_offset_data 6 ${wan_mac_offset} $@
@@ -140,7 +148,7 @@
# 2. Set/Get the offset data: mtk_factory -r/-w length offset /data
# 3. Overwrite from offset1 to offset2 by length byte : mtk_factory -o length from to
if [ "$1" == "-r" ]; then
- if [ "$2" == "lan" -o "$2" == "wan" ]; then
+ if [ "$2" == "lan" -o "$2" == "lan2" -o "$2" == "wan" ]; then
GetMac $2
elif [ "$2" -eq "$2" ]; then
Get_offset_data $2 $3
@@ -150,7 +158,7 @@
exit 1
fi
elif [ "$1" == "-w" ]; then
- if [ "$2" == "lan" -o "$2" == "wan" ]; then
+ if [ "$2" == "lan" -o "$2" == "lan2" -o "$2" == "wan" ]; then
SetMac $2 $@
else
Set_offset_data $2 $3 $@