pkgbuilds/firmware-phicomm-n1/firmware-phicomm-n1.install

24 lines
989 B
Plaintext
Raw Normal View History

2019-09-07 20:39:02 +08:00
post_install() {
2019-09-08 00:30:20 +08:00
post_upgrade $1 0
echo 'Please REBOOT your machine.'
}
post_upgrade() {
2019-09-07 20:39:02 +08:00
# get uboot wifi macaddr
tmpfile=$(mktemp -p /tmp)
echo '/dev/mmcblk1 0x27400000 0x10000' > $tmpfile
mac_wifi=$(fw_printenv -c $tmpfile mac_wifi)
rm $tmpfile
mac=${mac_wifi#*=}
# make sure we have got a correct mac address
if ! grep -qiE '([0-9a-f][0-9a-f]:){5}[0-9a-f][0-9a-f]' <<< "$mac"; then
# oops! Then we might generate a random one
mac=$(sed 's/^.*\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)$/\1:\2:\3:\4:\5:\6/' < /etc/machine-id)
grep -qiE '([0-9a-f][0-9a-f]:){5}[0-9a-f][0-9a-f]' <<< "$mac" || exit 1
fi
sed -i "s/^macaddr=.*$/macaddr=${mac}/g" /usr/lib/firmware/brcm/brcmfmac43455-sdio.phicomm,n1.txt
2019-09-08 00:30:20 +08:00
# set bluetooth macaddr
echo -en $(sed 's/^.*:\(..\):\(..\):\(..\)$/\\x\3\\x\2\\x\1/' <<< "$mac") | \
2019-09-08 00:45:46 +08:00
dd of=/usr/lib/firmware/brcm/BCM4345C0.hcd bs=1 seek=$((0x21)) count=3 conv=notrunc status=none
2019-09-07 20:39:02 +08:00
}