[Hackrf-dev] off frequency
Bruce Barnett
grymoire at gmail.com
Mon Oct 20 16:42:35 EDT 2014
I wrote a simple shell script that should make it easier (I hope) to do the
firmware upgrade for your hackRF.
You do need to have either compiled the hackrf-tools, or to have installed
the hackrf package, i.e.
sudo apt-get install hackrf # on ubuntu
The shell script checks to make sure you have the proper executables,
downloads the firmware, makes sure the firmware is the right revision,
and once everything is in place, it will perform the upgrade.
it uses wget to download the file, unpacks it, and installs the firmware
Let me know if there are any problems.
I call it
HackRFUpgrade
------------------------cut here-------------
#!/bin/sh
# Script to update the HackRF firmware in a safer way.
# Based on info from
https://github.com/mossmann/hackrf/wiki/Updating-Firmware
# This script checks
# (a) that both firmware files exist
# (b) That they have the 'proper' hash. Update the hash values when
appropriate
# (c) that all executables are correct and installed
# I assume that the hackrf tools are installed
# Bruce Barnett Mon Oct 20 16:29:22 EDT 2014
URL=
http://sourceforge.net/projects/hackrf/files/hackrf-2014.08.1.tar.xz/download
#Firmware files
SPIFlashFirmware="./hackrf-2014.08.1/firmware-bin/hackrf_one_usb_rom_to_ram.bin"
CPLD="./hackrf-2014.08.1/firmware/cpld/sgpio_if/default.xsvf"
# sha1hash values for the firmware
SPIHASH=f2edc659a8cc92d82bd5db4e530b36b2aa0c7bbd
CPLDHASH=6c7e6a36ba5521c3d3e758d58428d10defd69228
# Executables that are necessary
Wget=`which wget`
Sha1sum=`which sha1sum`
Hackrf_spiflash=`which hackrf_spiflash`
Hackrf_cpldjtag=`which hackrf_cpldjtag`
# test to make sure we have all of the executables
[ -n "$Wget" ] || { echo "missing wget. type 'sudo apt-get install
wget'";exit 1 ;}
[ -n "$Sha1sum" ] || { echo "missing sha1sum. type 'sudo apt-get install
sha1sum'";exit 1 ;}
[ -n "$Hackrf_spiflash" ] || { echo I cannot find the hackrf_spiflash
executable. You need to install the hackrf tools;exit 1 ;}
[ -n "$Hackrf_cpldjtag" ] || { echo I cannot find the hackrf_cpldjtag
executable. You need to install the hackrf tools ;exit 1 ;}
echo "Good. we have the executables we need. Now lets download the file"
if [ -f download ]
then
echo 'remove existing file called download?'
/bin/rm -i download
fi
echo $Wget $URL
$Wget $URL
if [ ! -f download ]
then
echo wget did not retrieve the file 'download' - exit
exit 1
fi
tar xfJ download
if [ -f "$SPIFlashFirmware" ] # check for files existance
then
# Get the hash
h=`sha1sum "$SPIFlashFirmware" | awk '{print $1}'`
if [ "$h" != "$SPIHASH" ] # correct hash value
then
echo "SPI firmware hash does not agree. Should be '$SPIHASH' but
was '$h'. I better not continue"
exit 1
fi
else
echo Missing SPI Flash Firmware file: $SPIFlashFirmware
exit 1
fi
if [ -f "$CPLD" ]
then
h=`sha1sum "$CPLD" | awk '{print $1}'`
if [ "$h" != "$CPLDHASH" ]
then
echo "CPLD hash does not agree. Should be '$SPIHASH' but was '$h'.
I better not continue"
exit 1
fi
else
echo missing CPLD file $CPLD
exit 1
fi
echo "Both firmware files exist and have the correct hash. OK to continue"
echo press type "y" to update the SPI Flash Firmware
read ans
if [ "$ans" = "y" ]
then
echo $Hackrf_spiflash -w $SPIFlashFirmware
$Hackrf_spiflash -w "$SPIFlashFirmware"
fi
echo press press type "y" to update the CPLD
read ans
if [ "$ans" = "y" ]
then
echo $Hackrf_cpldjtag -x $CPLD
$Hackrf_cpldjtag -x "$CPLD"
# check for update
fi
hackrf_info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist9.pair.net/pipermail/hackrf-dev/attachments/20141020/33b49c58/attachment.html>
More information about the HackRF-dev
mailing list