Xiaomi/Chuangmi ipc017 kept on its vendor U-Boot. A kernel fragment appends mtdparts= with the vendor MXP offsets under OpenIPC's names plus panic=20, and carves a separate 64 KB env out of the end of the vendor DATA partition, because the vendor environment shares its erase block with the end of U-Boot. S01fwenv points fw_env.config at that partition. wireless/usb powers the MT7601U on GPIO 14 and bind-mounts a /tmp copy of MT7601USTA.dat with the factory MAC from FACTORY. S41eth0 takes the connector-less eth0 down so ONVIF discovery goes out on wlan0. Tested on hardware.
29 lines
986 B
Bash
Executable File
29 lines
986 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set_gpio() {
|
|
[ "$2" -eq 1 ] && gpio set $1 || gpio clear $1
|
|
sleep 1
|
|
}
|
|
|
|
# GPIO 14 powers the MT7601U. The vendor FACTORY partition holds the factory
|
|
# MAC as a NUL-separated mac=XX:XX:XX:XX:XX:XX record; mt7601sta takes it from
|
|
# MacAddress= in its .dat file. That path is compiled into the driver, so the
|
|
# edited copy lives in /tmp and is bind-mounted over it: editing it in place
|
|
# would copy the .dat up into the overlay, where it would shadow the one a
|
|
# later firmware ships.
|
|
if [ "$1" = "mt7601u-ssc325-chuangmi-ipc017" ]; then
|
|
set_gpio 14 1
|
|
dat=/etc/mediatek/MT7601USTA.dat
|
|
factory=$(awk -F: '/"(factory|FACTORY)"/ {print $1}' /proc/mtd)
|
|
mac=$([ -n "$factory" ] && tr '\0' '\n' < "/dev/$factory" | sed -n 's/^mac=//p')
|
|
if [ -n "$mac" ] && ! grep -qx "MacAddress=$mac" $dat; then
|
|
sed '/^MacAddress=/d' $dat > /tmp/MT7601USTA.dat
|
|
echo "MacAddress=$mac" >> /tmp/MT7601USTA.dat
|
|
mount --bind /tmp/MT7601USTA.dat $dat
|
|
fi
|
|
modprobe mt7601sta
|
|
exit 0
|
|
fi
|
|
|
|
exit 1
|