alarm/firmware-brcm43xx: Generate semi-random MAC address and make service conf optional

Prevents MAC conflicts when settings up multiple systems at the same time.
This commit is contained in:
Jeffrey Clark 2014-05-25 11:56:42 -05:00
parent e4acc8dd6c
commit 935b1d41f1
4 changed files with 12 additions and 10 deletions

View file

@ -19,17 +19,15 @@ source=('https://raw.githubusercontent.com/OpenBricks/openbricks/master/packages
'https://github.com/OpenBricks/openbricks/raw/master/packages/brcm-patchram-plus/sources/bcm4330.hcd' 'https://github.com/OpenBricks/openbricks/raw/master/packages/brcm-patchram-plus/sources/bcm4330.hcd'
'https://raw.githubusercontent.com/OpenBricks/openbricks/master/packages/brcm-patchram-plus/sources/brcm_patchram_plus.c' 'https://raw.githubusercontent.com/OpenBricks/openbricks/master/packages/brcm-patchram-plus/sources/brcm_patchram_plus.c'
'start-brcm-patchram-plus' 'start-brcm-patchram-plus'
'brcm43xx.service' 'brcm43xx.service')
'bcm43xx')
md5sums=('bf01292eec17815baa68a83d3d7722ad' md5sums=('bf01292eec17815baa68a83d3d7722ad'
'31a9a011ce24707ed3c1024616c9005e' '31a9a011ce24707ed3c1024616c9005e'
'31a9a011ce24707ed3c1024616c9005e' '31a9a011ce24707ed3c1024616c9005e'
'ff27325602dc223203adfdd23a89844b' 'ff27325602dc223203adfdd23a89844b'
'8e32f9168aaa540467589c153129c57a' '8e32f9168aaa540467589c153129c57a'
'627e9612337e5ef6027a87a79c491446' '627e9612337e5ef6027a87a79c491446'
'c2d65a43d3c1c5eb7e2d168440867db4' '33ec0f0cfbbdd42b933d0a2ad93f7181'
'7e4dcf16c3def9b5a159627b25b21e1e' 'f2eefa2042130e559b2d664a3fcc7b50')
'587fa5f25768380605287057924238e6')
build() { build() {
cd "${srcdir}/" cd "${srcdir}/"

View file

@ -1 +0,0 @@
MAC_ADDR=43:29:B1:55:01:01

View file

@ -3,7 +3,7 @@ Description=Load Broadcom bluetooth firmware
Before=bluetooth.service Before=bluetooth.service
[Service] [Service]
EnvironmentFile=/etc/conf.d/bcm43xx EnvironmentFile=-/etc/conf.d/bcm43xx
Type=oneshot Type=oneshot
ExecStart=/usr/lib/systemd/scripts/start-brcm-patchram-plus ExecStart=/usr/lib/systemd/scripts/start-brcm-patchram-plus
RemainAfterExit=yes RemainAfterExit=yes

View file

@ -1,12 +1,17 @@
#!/bin/sh #!/bin/sh
CACHE=/var/cache/brcm43xx-mac
MAC_OPTIONS="" MAC_OPTIONS=""
if [ -z "$MAC_ADDR" ]; then if [ -z "$MAC_ADDR" ]; then
echo "MAC_ADDR in /etc/conf.d/bcm4329 not set, will use MAC set by device (expect this to be buggy)" if [ ! -f "$CACHE" ]; then
echo 43:29:B1$(od -txC -An -N3 /dev/random|tr \ : | tr '[:lower:]' '[:upper:]') >"$CACHE"
fi
MAC_ADDR=`cat "$CACHE"`
echo "Warning: Using self generated MAC address! MAC_ADDR should be defined in /etc/conf.d/brcm43xx."
else else
MAC_OPTIONS="--bd_addr $MAC_ADDR" [ -f "$CACHE" ] && rm "$CACHE"
fi fi
MAC_OPTIONS="--bd_addr $MAC_ADDR"
a=`cat /sys/class/mmc_host/mmc0/mmc0\:0001/mmc0\:0001\:1/device` a=`cat /sys/class/mmc_host/mmc0/mmc0\:0001/mmc0\:0001\:1/device`