* [gentoo-commits] repo/gentoo:master commit in: net-wireless/hackrf-tools/, net-wireless/hackrf-tools/files/
@ 2019-01-08 22:19 Rick Farina
0 siblings, 0 replies; 2+ messages in thread
From: Rick Farina @ 2019-01-08 22:19 UTC (permalink / raw
To: gentoo-commits
commit: deed2865465552e9d6e3233470a89bbc2ffc9e73
Author: Rick Farina <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 8 22:17:48 2019 +0000
Commit: Rick Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Tue Jan 8 22:19:29 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=deed2865
net-wireless/hackrf-tools: add hackrf_easy_flash
helper script for updating firmware/cpld and switching firmware
Package-Manager: Portage-2.3.54, Repoman-2.3.12
Signed-off-by: Rick Farina <zerochaos <AT> gentoo.org>
net-wireless/hackrf-tools/files/hackrf_easy_flash | 161 +++++++++++++++++++++
...1.1.ebuild => hackrf-tools-2018.01.1-r1.ebuild} | 4 +-
2 files changed, 164 insertions(+), 1 deletion(-)
diff --git a/net-wireless/hackrf-tools/files/hackrf_easy_flash b/net-wireless/hackrf-tools/files/hackrf_easy_flash
new file mode 100755
index 00000000000..3c802b440fa
--- /dev/null
+++ b/net-wireless/hackrf-tools/files/hackrf_easy_flash
@@ -0,0 +1,161 @@
+#!/bin/sh
+
+DFU_MODE=0
+CPLD=0
+
+get_dfu() {
+ if [ -r "/usr/share/hackrf/hackrf_one_usb.dfu" ]; then
+ ram_firmware="/usr/share/hackrf/hackrf_one_usb.dfu"
+ else
+ printf "Unable to find hackrf_one_usb.dfu in the search path\n"
+ exit 1
+ fi
+ export ram_firmware
+}
+
+get_cpld() {
+ if [ -r "/usr/share/hackrf/hackrf_cpld_default.xsvf" ]; then
+ cpld="/usr/share/hackrf/hackrf_cpld_default.xsvf"
+ else
+ printf "Unable to find default.xsvf in the search path\n"
+ exit 1
+ fi
+ export cpld
+}
+
+usage() {
+ printf "hackrf_easy_flash list\n"
+ printf "hackrf_easy_flash upgrade\n"
+}
+
+if [ -z "${1}" ]; then
+ usage
+ exit 0
+fi
+
+list_firmware() {
+ if [ ${DFU_MODE} = 1 ]; then
+ if [ -z "${ram_firmware}" ]; then
+ get_dfu
+ fi
+ printf "Best DFU found: ${ram_firmware}\n"
+ fi
+ printf "Available firmware options:\n"
+ if [ -r "/usr/share/hackrf/hackrf_one_usb.bin" ]; then
+ printf "hackrf (default)\n"
+ fi
+ if [ -r "/usr/share/hackrf/portapack-h1-firmware.bin" ]; then
+ printf "portapack (--portapack)\n"
+ fi
+ if [ -r "/usr/share/hackrf/portapack-h1-havoc.bin" ]; then
+ printf "portapack-havoc (--havoc)\n"
+ fi
+}
+
+#parse args
+while [ -n "${1}" ]; do
+ case $1 in
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ list|--list)
+ list_firmware
+ exit 0
+ ;;
+ update|--update|upgrade|--upgrade|hackrf|--hackrf)
+ firmware="/usr/share/hackrf/hackrf_one_usb.bin"
+ TARGET=hackrf
+ shift
+ ;;
+ portapack|--portapack)
+ firmware="/usr/share/hackrf/portapack-h1-firmware.bin"
+ TARGET=portapack
+ shift
+ ;;
+ havoc|--havoc)
+ firmware="/usr/share/hackrf/portapack-h1-havoc.bin"
+ TARGET=havoc
+ shift
+ ;;
+ cpld|--cpld)
+ CPLD=1
+ get_cpld
+ shift
+ ;;
+ dfu|--dfu)
+ DFU_MODE=1
+ get_dfu
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+if [ -z "${firmware}" ]; then
+ firmware="/usr/share/hackrf/hackrf_one_usb.bin"
+ TARGET="hackrf"
+fi
+
+if [ ! -r "${firmware}" ]; then
+ printf "Unable to find or read ${firmware}\n"
+ printf "Please ensure the requested firmware is installed and readable\n"
+ exit 1
+fi
+
+if [ "${CPLD}" = 1 ] && [ "${TARGET}" != "hackrf" ]; then
+ printf "To update the CPLD you must use the stock hackrf firmware or do this update manually\n"
+ printf "Try \"$(basename $0) --cpld && $(basename $0) ${TARGET}\"\n"
+ exit 1
+fi
+
+if [ ${DFU_MODE} = 1 ]; then
+ printf "Preparing to reset hackrf with DFU ${ram_firmware}\n"
+ printf "Then flashing with ${firmware}\n\n"
+ 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"
+ 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
+ if ! dfu-util --device 1fc9:000c --download "${ram_firmware}" --reset; then
+ printf "dfu-util reported failure, quitting\n"
+ exit 1
+ fi
+ sleep 2s
+else
+ if hackrf_info | grep -q 'No HackRF boards found.'; then
+ printf "No hackrf found, please ensure you are in hackrf mode or try --dfu\n"
+ exit 1
+ fi
+fi
+if hackrf_spiflash -w "${firmware}"; then
+ sleep 3s
+ hackrf_spiflash -R
+ sleep 3s
+else
+ printf "hackrf_spiflash reported failure, quitting\n"
+ exit 1
+fi
+if [ "${CPLD}" = 1 ]; then
+ #printf "To update the cpld, please reset your hackrf into it's new firmware before updating the cpld\n"
+ #printf "Please reset your hackrf by pressing the button furthest from the antenna or power cycling it.\n"
+ #printf "Press any key to continue or ^c to abort\n"
+ #read
+ if hackrf_cpldjtag -x "${cpld}"; then
+ sleep 3s
+ hackrf_spiflash -R
+ else
+ printf "hackrf_cpldjtag reported failure\n"
+ exit 1
+ fi
+fi
+if [ "${TARGET}" = "hackrf" ]; then
+ hackrf_info
+fi
+printf "If you saw no errors, you are up to date with the requested firmware\n"
diff --git a/net-wireless/hackrf-tools/hackrf-tools-2018.01.1.ebuild b/net-wireless/hackrf-tools/hackrf-tools-2018.01.1-r1.ebuild
similarity index 91%
rename from net-wireless/hackrf-tools/hackrf-tools-2018.01.1.ebuild
rename to net-wireless/hackrf-tools/hackrf-tools-2018.01.1-r1.ebuild
index 8e2e2ed538c..077393444eb 100644
--- a/net-wireless/hackrf-tools/hackrf-tools-2018.01.1.ebuild
+++ b/net-wireless/hackrf-tools/hackrf-tools-2018.01.1-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
@@ -30,6 +30,7 @@ RDEPEND="${DEPEND}"
src_install() {
cmake-utils_src_install
+ dosbin "${FILESDIR}/hackrf_easy_flash"
if [[ ${PV} != "9999" ]] ; then
insinto /usr/share/hackrf
newins "${WORKDIR}/hackrf-${PV}/firmware-bin/hackrf_jawbreaker_usb.bin" hackrf_jawbreaker_usb-${PV}.bin
@@ -41,6 +42,7 @@ src_install() {
ln -s hackrf_one_usb-${PV}.bin "${ED}/usr/share/hackrf/hackrf_one_usb.bin"
ln -s hackrf_one_usb-${PV}.dfu "${ED}/usr/share/hackrf/hackrf_one_usb_ram.dfu"
ln -s hackrf_one_usb-${PV}.dfu "${ED}/usr/share/hackrf/hackrf_one_usb.dfu"
+ ln -s hackrf_cpld_default-${PV}.xsvf "${ED}/usr/share/hackrf/hackrf_cpld_default.xsvf"
else
ewarn "The compiled firmware files are only available in the versioned releases, you are on your own for this."
fi
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: net-wireless/hackrf-tools/, net-wireless/hackrf-tools/files/
@ 2020-08-20 21:26 Rick Farina
0 siblings, 0 replies; 2+ messages in thread
From: Rick Farina @ 2020-08-20 21:26 UTC (permalink / raw
To: gentoo-commits
commit: c4b3c6c06cfd14130ab9422f1ae4417b87c3f49c
Author: Rick Farina <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 20 21:26:32 2020 +0000
Commit: Rick Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Thu Aug 20 21:26:43 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4b3c6c0
net-wireless/hackrf-tools: add support for mayhem
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Rick Farina <zerochaos <AT> gentoo.org>
.../files/{hackrf_easy_flash => hackrf_easy_flash-r1} | 8 ++++++++
...tools-2018.01.1-r1.ebuild => hackrf-tools-2018.01.1-r2.ebuild} | 2 +-
net-wireless/hackrf-tools/hackrf-tools-9999.ebuild | 2 +-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/net-wireless/hackrf-tools/files/hackrf_easy_flash b/net-wireless/hackrf-tools/files/hackrf_easy_flash-r1
similarity index 94%
rename from net-wireless/hackrf-tools/files/hackrf_easy_flash
rename to net-wireless/hackrf-tools/files/hackrf_easy_flash-r1
index 78d0c69b0cd..deece5e3189 100644
--- a/net-wireless/hackrf-tools/files/hackrf_easy_flash
+++ b/net-wireless/hackrf-tools/files/hackrf_easy_flash-r1
@@ -50,6 +50,9 @@ list_firmware() {
if [ -r "/usr/share/hackrf/portapack-h1-havoc.bin" ]; then
printf "portapack-havoc (--havoc)\n"
fi
+ if [ -r "/usr/share/hackrf/portapack-h1_h2-mayhem.bin" ]; then
+ printf "portapack-mayhem (--mayhem)\n"
+ fi
}
#parse args
@@ -78,6 +81,11 @@ while [ -n "${1}" ]; do
TARGET=havoc
shift
;;
+ mayhem|--mayhem)
+ firmware="/usr/share/hackrf/portapack-h1_h2-mayhem.bin"
+ TARGET=mayhem
+ shift
+ ;;
cpld|--cpld)
CPLD=1
get_cpld
diff --git a/net-wireless/hackrf-tools/hackrf-tools-2018.01.1-r1.ebuild b/net-wireless/hackrf-tools/hackrf-tools-2018.01.1-r2.ebuild
similarity index 96%
rename from net-wireless/hackrf-tools/hackrf-tools-2018.01.1-r1.ebuild
rename to net-wireless/hackrf-tools/hackrf-tools-2018.01.1-r2.ebuild
index 85077b67001..bc7430341b0 100644
--- a/net-wireless/hackrf-tools/hackrf-tools-2018.01.1-r1.ebuild
+++ b/net-wireless/hackrf-tools/hackrf-tools-2018.01.1-r2.ebuild
@@ -30,7 +30,7 @@ RDEPEND="${DEPEND}"
src_install() {
cmake_src_install
- dosbin "${FILESDIR}/hackrf_easy_flash"
+ newsbin "${FILESDIR}/hackrf_easy_flash-r1" hackrf_easy_flash
if [[ ${PV} != "9999" ]] ; then
insinto /usr/share/hackrf
newins "${WORKDIR}/hackrf-${PV}/firmware-bin/hackrf_jawbreaker_usb.bin" hackrf_jawbreaker_usb-${PV}.bin
diff --git a/net-wireless/hackrf-tools/hackrf-tools-9999.ebuild b/net-wireless/hackrf-tools/hackrf-tools-9999.ebuild
index d7c23f08076..db45e737e6b 100644
--- a/net-wireless/hackrf-tools/hackrf-tools-9999.ebuild
+++ b/net-wireless/hackrf-tools/hackrf-tools-9999.ebuild
@@ -30,7 +30,7 @@ RDEPEND="${DEPEND}"
src_install() {
cmake_src_install
- dosbin "${FILESDIR}/hackrf_easy_flash"
+ newsbin "${FILESDIR}/hackrf_easy_flash-r1" hackrf_easy_flash
if [[ ${PV} != "9999" ]] ; then
insinto /usr/share/hackrf
newins "${WORKDIR}/hackrf-${PV}/firmware-bin/hackrf_jawbreaker_usb.bin" hackrf_jawbreaker_usb-${PV}.bin
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-20 21:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-20 21:26 [gentoo-commits] repo/gentoo:master commit in: net-wireless/hackrf-tools/, net-wireless/hackrf-tools/files/ Rick Farina
-- strict thread matches above, loose matches on Subject: below --
2019-01-08 22:19 Rick Farina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox