| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Title : bladeRF-install-firmware |
| 4 |
# Purpose : fetch non-free BladeRF firmware |
| 5 |
# Author : A. Maitland Bottoms <[email protected]> |
| 6 |
# Date : 2013-10-10 |
| 7 |
# Update : 2026-06-20 |
| 8 |
# |
| 9 |
# Copyright 2013-2026 A. Maitland Bottoms <[email protected]> |
| 10 |
# |
| 11 |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 12 |
# of this software and associated documentation files (the "Software"), to deal |
| 13 |
# in the Software without restriction, including without limitation the rights |
| 14 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 15 |
# copies of the Software, and to permit persons to whom the Software is |
| 16 |
# furnished to do so, subject to the following conditions: |
| 17 |
# |
| 18 |
# The above copyright notice and this permission notice shall be included in |
| 19 |
# all copies or substantial portions of the Software. |
| 20 |
# |
| 21 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 22 |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 23 |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 24 |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 25 |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 26 |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 27 |
# THE SOFTWARE. |
| 28 |
|
| 29 |
set -e |
| 30 |
|
| 31 |
show_usage() |
| 32 |
{ |
| 33 |
echo "Usage: $0 [-i imagedir] [imagetarball]" >&2 |
| 34 |
exit 1 |
| 35 |
} |
| 36 |
|
| 37 |
FX3UPSTREAM='https://www.nuand.com/fx3/bladeRF_fw_v2.6.0.img' |
| 38 |
FX3CHECKSUM='7cc51b4eedebf54dd01be83745d1c59f' |
| 39 |
FX3SHA256SUM='a5f65bffd51107c09e36b45eda77593d900d975388bcfd83a9b6c3c45240b54a' |
| 40 |
FX3IMGFILE='/usr/share/Nuand/bladeRF/bladeRF_fw.img' |
| 41 |
|
| 42 |
FPGAWLANXA9STREAM='https://www.nuand.com/fpga/v0.15.3/wlanxA9.rbf' |
| 43 |
FPGAWLANXA9CHECKSUM='fb1dc76308b64ffe5f2a4146e44c7b79' |
| 44 |
FPGAWLANXA9SHA256SUM='9f1fd747561a77f5f23e5d80785f161a4fb01c3f849f87a9fc309590d73c09bf' |
| 45 |
FPGAWLANXA9RBFILE='/usr/share/Nuand/bladeRF/wlanxA9.rbf' |
| 46 |
|
| 47 |
FPGA115UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedx115.rbf' |
| 48 |
FPGA115CHECKSUM='a7f25be8abdab3835e734599eb846ea4' |
| 49 |
FPGA115SHA256SUM='7bb0c7b0fb9976cd631b679352aff3383ab371dad29306452140984363711fdf' |
| 50 |
FPGA115RBFFILE='/usr/share/Nuand/bladeRF/hostedx115.rbf' |
| 51 |
|
| 52 |
FPGA40UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedx40.rbf' |
| 53 |
FPGA40CHECKSUM='f3d0e55aa4cae485df6d3c20004b7742' |
| 54 |
FPGA40SHA256SUM='b21a50c87bccf915b8b1630354dbd07c87c17892c6011ec086bbf9e50dedc15a' |
| 55 |
FPGA40RBFFILE='/usr/share/Nuand/bladeRF/hostedx40.rbf' |
| 56 |
|
| 57 |
FPGAA4UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedxA4.rbf' |
| 58 |
FPGAA4CHECKSUM='76a74b748d699a9fc348babd34af19c' |
| 59 |
FPGAA4SHA256SUM='c0d1ed6a38900629ec7983ddd27b2d438ca7a7d2b897d37364ff0c2511210ace' |
| 60 |
FPGAA4RBFFILE='/usr/share/Nuand/bladeRF/hostedxA4.rbf' |
| 61 |
|
| 62 |
FPGAA5UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedxA5.rbf' |
| 63 |
FPGAA5CHECKSUM='be0909dc27b48a08c54db33675130f27' |
| 64 |
FPGAA5SHA256SUM='b85b413c0b305a04bd3fdb604ff6c77a1eac427f07d72251920a60b6a2f5b062' |
| 65 |
FPGAA5RBFFILE='/usr/share/Nuand/bladeRF/hostedxA5.rbf' |
| 66 |
|
| 67 |
FPGAA9UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedxA9.rbf' |
| 68 |
FPGAA9CHECKSUM='1ab3bc8bdcf16a5f0ddf3fcdbaa6556b' |
| 69 |
FPGASHA256SUM='3004467110e2b2790c8f6128f998c2149905a88eed91a87f11af3db524d60c65' |
| 70 |
FPGAA9RBFFILE='/usr/share/Nuand/bladeRF/hostedxA9.rbf' |
| 71 |
|
| 72 |
ADSBA4UPSTREAM='https://www.nuand.com/fpga/adsbxA4.rbf' |
| 73 |
ADSBA4CHECKSUM='2fe523c4c3f62100a19eab1446676f39' |
| 74 |
ADSBA4SHA256SUM='e3ef41920c148f34990a16a6d9614a4f1632391ee5ed05f16149dd82c5367d14' |
| 75 |
ADSBA4RBFFILE='/usr/share/Nuand/bladeRF/adsbxA4.rbf' |
| 76 |
|
| 77 |
ADSBA9UPSTREAM='https://www.nuand.com/fpga/adsbxA9.rbf' |
| 78 |
ADSBA9CHECKSUM='4526ef899fef566619625982fdc5cfb4' |
| 79 |
ADSBA9SHA256SUM='b1e1be9228f2b6629f49dd357b5c5e65b5c3c581e6769e9abd341639617ca212' |
| 80 |
ADSBA9RBFFILE='/usr/share/Nuand/bladeRF/adsbxA9.rbf' |
| 81 |
|
| 82 |
ADSB40UPSTREAM='https://www.nuand.com/fpga/adsbx40.rbf' |
| 83 |
ADSB40CHECKSUM='5c6045066ac2e62c8a2c3e770c6c355c' |
| 84 |
ADSB40SHA256SUM='2801df76b13b243d3b4a211f39841326fbbdf8e4656c61761b814ef5386a6a08' |
| 85 |
ADSB40RBFFILE='/usr/share/Nuand/bladeRF/adsbx40.rbf' |
| 86 |
|
| 87 |
ADSB115UPSTREAM='https://www.nuand.com/fpga/adsbx115.rbf' |
| 88 |
ADSB115CHECKSUM='178f1d952be3a05f2f0a4a0e9429746a' |
| 89 |
ADSB115SHA256SUM='e5ff37596f6d46ca9124001bde73237a85c435024963c911658b922e6e960142' |
| 90 |
ADSB115RBFFILE='/usr/share/Nuand/bladeRF/adsbx115.rbf' |
| 91 |
|
| 92 |
# Default values: |
| 93 |
# The imagedir is the path bladerf-host and libbladerf packages |
| 94 |
# use to find firmware. |
| 95 |
imagedir="/usr/share/Nuand/bladeRF" |
| 96 |
# The imagetarball is the source of firmware built with matching |
| 97 |
# source code. |
| 98 |
fpgaimageurl="" |
| 99 |
usbimageurl="" |
| 100 |
while [ "$1" != "" ]; do |
| 101 |
case $1 in |
| 102 |
-h | --help ) show_usage |
| 103 |
exit 0 |
| 104 |
;; |
| 105 |
-i | --imagedir ) shift |
| 106 |
imagedir=$1 |
| 107 |
;; |
| 108 |
-f | --fpgafile ) shift |
| 109 |
fpgaimageurl=$1 |
| 110 |
;; |
| 111 |
-u | --usbfile ) shift |
| 112 |
usbimageurl=$1 |
| 113 |
;; |
| 114 |
* ) fpgaimageurl=$1 |
| 115 |
;; |
| 116 |
esac |
| 117 |
shift |
| 118 |
done |
| 119 |
|
| 120 |
if mkdir -p $imagedir ; then |
| 121 |
if [ -w $imagedir ] ;then |
| 122 |
echo Using imagedir: $imagedir |
| 123 |
else |
| 124 |
echo You need to run this script as a user who can write to $imagedir |
| 125 |
exit 1 |
| 126 |
fi |
| 127 |
else |
| 128 |
echo You need to run this script as a user who can create $imagedir |
| 129 |
exit 1 |
| 130 |
fi |
| 131 |
|
| 132 |
tdir=`mktemp -d` |
| 133 |
fetchlist="" |
| 134 |
echo "Using tempdir:" $tdir |
| 135 |
if [ "x$fpgaimageurl" = "x" ] && [ "x$usbimageurl" = "x" ] ; then |
| 136 |
fetchlist="$FX3UPSTREAM $FPGA40UPSTREAM $FPGA115UPSTREAM $FPGAA4UPSTREAM $FPGAA5UPSTREAM $FPGAA9UPSTREAM \ |
| 137 |
$ADSB40UPSTREAM $ADSB115UPSTREAM $ADSBA4UPSTREAM $ADSBA9UPSTREAM" |
| 138 |
else |
| 139 |
if [ "x$fpgaimageurl" != "x" ] ; then |
| 140 |
fetchlist="$fetchlist $fpgaimageurl" |
| 141 |
fi |
| 142 |
if [ "x$usbimageurl" != "x" ] ; then |
| 143 |
fetchlist="$fetchlist $usbimageurl" |
| 144 |
fi |
| 145 |
fi |
| 146 |
|
| 147 |
for item in $fetchlist; do |
| 148 |
echo "Using: " $item |
| 149 |
|
| 150 |
# if URL, fetch it first |
| 151 |
if echo $item | grep -q :// ; then |
| 152 |
echo Fetching $item ; |
| 153 |
if [ -x /usr/bin/wget ] ; then |
| 154 |
/usr/bin/wget --user-agent="Debian BladeRF image installer" -O $tdir/`basename $item` $item |
| 155 |
else |
| 156 |
curl --user-agent "Debian BladeRF image installer" -o $tdir/`basename $item` $item |
| 157 |
fi |
| 158 |
else |
| 159 |
if [ -f $item ] ; then |
| 160 |
echo Copying $item |
| 161 |
cp -p $item $tdir/ |
| 162 |
else |
| 163 |
echo "Cannot find" $item; |
| 164 |
show_usage |
| 165 |
exit 1 |
| 166 |
fi |
| 167 |
fi; |
| 168 |
if [ `basename $item` = "bladeRF_fw_v2.4.0.img" ] ; then |
| 169 |
md5sum --check - <<- EOF |
| 170 |
$FX3CHECKSUM $tdir/`basename $item` |
| 171 |
EOF |
| 172 |
sha256sum --check - <<- EOF |
| 173 |
$FX3SHA256SUM $tdir/`basename $item` |
| 174 |
EOF |
| 175 |
cp -p $tdir/`basename $item` $imagedir/bladeRF_fw.img ; |
| 176 |
fi |
| 177 |
if [ `basename $item` = "hostedx40.rbf" ] ; then |
| 178 |
md5sum --check - <<- EOF |
| 179 |
$FPGA40CHECKSUM $tdir/`basename $item` |
| 180 |
EOF |
| 181 |
sha256sum --check - <<- EOF |
| 182 |
$FPGA40SHA256SUM $tdir/`basename $item` |
| 183 |
EOF |
| 184 |
fi |
| 185 |
if [ `basename $item` = "hostedx115.rbf" ] ; then |
| 186 |
md5sum --check - <<- EOF |
| 187 |
$FPGA115CHECKSUM $tdir/`basename $item` |
| 188 |
EOF |
| 189 |
sha256sum --check - <<- EOF |
| 190 |
$FPGA115SHA256SUM $tdir/`basename $item` |
| 191 |
EOF |
| 192 |
fi |
| 193 |
if [ `basename $item` = "hostedxa4.rbf" ] ; then |
| 194 |
md5sum --check - <<- EOF |
| 195 |
$FPGAA4CHECKSUM $tdir/`basename $item` |
| 196 |
EOF |
| 197 |
sha256sum --check - <<- EOF |
| 198 |
$FPGAA4SHA256SUM $tdir/`basename $item` |
| 199 |
EOF |
| 200 |
fi |
| 201 |
if [ `basename $item` = "hostedxa5.rbf" ] ; then |
| 202 |
md5sum --check - <<- EOF |
| 203 |
$FPGAA5CHECKSUM $tdir/`basename $item` |
| 204 |
EOF |
| 205 |
sha256sum --check - <<- EOF |
| 206 |
$FPGAA5SHA256SUM $tdir/`basename $item` |
| 207 |
EOF |
| 208 |
fi |
| 209 |
if [ `basename $item` = "hostedxa9.rbf" ] ; then |
| 210 |
md5sum --check - <<- EOF |
| 211 |
$FPGAA9CHECKSUM $tdir/`basename $item` |
| 212 |
EOF |
| 213 |
sha256sum --check - <<- EOF |
| 214 |
$FPGAA9SHA256SUM $tdir/`basename $item` |
| 215 |
EOF |
| 216 |
fi |
| 217 |
cp -p $tdir/`basename $item` $imagedir/`basename $item` |
| 218 |
done |
| 219 |
|
| 220 |
for file in `ls $imagedir`; do md5sum $imagedir/$file ; done |
| 221 |
rm -i -rf $tdir |
| 222 |
|
| 223 |
exit 0 |