xiaomi-elish: Generate bluetooth mac address from machine-id Since v6.9 default mac bluetooth address of QCA6390 "00:00:00:00:5a:ad" is no longer usable. So we have to generate a new one.

This commit is contained in:
amazingfate 2024-06-09 02:55:13 +08:00 committed by Jianfeng Liu
parent 8365343dd9
commit cf4495d4ce
3 changed files with 22 additions and 0 deletions

View File

@ -37,6 +37,10 @@ function post_family_tweaks_bsp__xiaomi-elish_firmware() {
install -Dm655 $SRC/packages/bsp/usb-gadget-network/remove-usbgadget-network.sh $destination/usr/local/bin/
install -Dm644 $SRC/packages/bsp/usb-gadget-network/usbgadget-rndis.service $destination/usr/lib/systemd/system/
# Bluetooth MAC addr setup service
install -Dm655 $SRC/packages/bsp/generate-bt-mac-addr/bt-fixed-mac.sh $destination/usr/local/bin/
install -Dm644 $SRC/packages/bsp/generate-bt-mac-addr/bt-fixed-mac.service $destination/usr/lib/systemd/system/
# Kernel postinst script to update abl boot partition
install -Dm655 $SRC/packages/bsp/xiaomi-elish/zz-update-abl-kernel $destination/etc/kernel/postinst.d/
@ -71,6 +75,7 @@ function post_family_tweaks__xiaomi-elish_enable_services() {
chroot_sdcard systemctl enable usbgadget-rndis.service
chroot_sdcard systemctl enable pd-mapper.service
chroot_sdcard systemctl enable tqftpserv.service
chroot_sdcard systemctl enable bt-fixed-mac.service
return 0
}

View File

@ -0,0 +1,11 @@
[Unit]
Description=Bluetooth Fixed Mac Address
After=bluetooth.service systemd-machine-id-commit.service
Wants=bluetooth.service
[Service]
Type=oneshot
RemainAfterExit=yes
SyslogIdentifier=bt-fixed-mac
ExecStart=/usr/local/bin/bt-fixed-mac.sh
[Install]
WantedBy=bluetooth.target

View File

@ -0,0 +1,6 @@
#!/bin/bash
mac="$(echo $(cat /etc/machine-id; echo bluetooth)| sha256sum -)"
bt_mac=$(echo "42:${mac:0:2}:${mac:4:2}:${mac:8:2}:${mac:12:2}:${mac:16:2}")
echo $bt_mac
/usr/bin/bluetoothctl mgmt.public-addr $bt_mac