2015-07-31 18:37:11 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
printf "Hold down the HackRF's DFU button (the button closest to the antenna jack)\n"
|
|
|
|
printf "then plug the HackRF into a USB port on your computer.\n\n"
|
|
|
|
printf "After the HackRF is plugged in, you may release the DFU button.\n"
|
|
|
|
printf "Press any key to continue or ^c to abort\n"
|
|
|
|
read
|
|
|
|
|
2017-02-21 17:19:30 +00:00
|
|
|
for i in /usr/share/hackrf/hackrf_one_usb.dfu /usr/share/hackrf/hackrf_one_usb_ram.dfu hackrf_one_usb.dfu; do
|
|
|
|
if [ -r "${i}" ]; then
|
|
|
|
ram_firmware="${i}"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "${ram_firmware}" ]; then
|
|
|
|
printf "\nFound firmware: ${ram_firmware}\n"
|
|
|
|
printf "Flashing...\n"
|
|
|
|
else
|
2017-02-22 07:12:13 +00:00
|
|
|
printf "Unable to find firmware to flash, please have hackrf_one_usb.dfu\n"
|
2017-02-21 17:19:30 +00:00
|
|
|
printf "in current directory or /usr/share/hackrf/\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-02-22 07:12:13 +00:00
|
|
|
for i in /usr/share/hackrf/hackrf_one_usb.bin /usr/share/hackrf/hackrf_one_usb_rom_to_ram.bin hackrf_one_usb.bin; do
|
2017-02-21 17:19:30 +00:00
|
|
|
if [ -r "${i}" ]; then
|
|
|
|
rom_firmware="${i}"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "${rom_firmware}" ]; then
|
|
|
|
printf "\nFound firmware: ${rom_firmware}\n"
|
|
|
|
printf "Flashing...\n"
|
|
|
|
else
|
2017-02-22 07:12:13 +00:00
|
|
|
printf "Unable to find firmware to flash, please have hackrf_one_usb.bin\n"
|
2017-02-21 17:19:30 +00:00
|
|
|
printf "in current directory or /usr/share/hackrf/\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
dfu-util --device 1fc9:000c --download "${ram_firmware}" --reset
|
2015-07-31 18:37:11 +00:00
|
|
|
sleep 2s
|
2017-02-21 17:19:30 +00:00
|
|
|
hackrf_spiflash -w "${rom_firmware}"
|