From 255de16d3eff1baf3c806c280153c8d5df0e112f Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sun, 2 Aug 2015 11:22:10 -0700 Subject: [PATCH] Use head/cat, /dev/zero to pad HackRF firmware dd approach didn't work for at least one user. Resolves #42. --- firmware/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/Makefile b/firmware/Makefile index 54705d1c..5e89d2ab 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -25,7 +25,7 @@ PATH_BASEBAND=baseband # TODO: Pass these (as #defines?) to Makefiles, use values in code. PAD_BOOTSTRAP=0x10000 -PAD_HACKRF_FIRMWARE=0x10000 +PAD_HACKRF_FIRMWARE=65536 PAD_BASEBAND=0x20000 TARGET=portapack-h1-firmware @@ -64,8 +64,8 @@ $(TARGET_BOOTSTRAP)_pad.bin: $(TARGET_BOOTSTRAP).elf $(TARGET_HACKRF_FIRMWARE)_dfu_pad.bin: $(TARGET_HACKRF_FIRMWARE).dfu # TODO: Not confident this is reliable. It certainly won't work on Windows. - cp $(TARGET_HACKRF_FIRMWARE).dfu $(TARGET_HACKRF_FIRMWARE)_dfu_pad.bin - dd if=/dev/null of=$(TARGET_HACKRF_FIRMWARE)_dfu_pad.bin bs=1 count=1 seek=$(PAD_HACKRF_FIRMWARE) + # Pad the .dfu with zeros, then truncate to the desired length. + head -c $(PAD_HACKRF_FIRMWARE) /dev/zero | cat $(TARGET_HACKRF_FIRMWARE).dfu - | head -c $(PAD_HACKRF_FIRMWARE) >$(TARGET_HACKRF_FIRMWARE)_dfu_pad.bin $(TARGET_BASEBAND)_pad.bin: $(TARGET_BASEBAND).elf $(CP) -O binary --pad-to $(PAD_BASEBAND) $(TARGET_BASEBAND).elf $(TARGET_BASEBAND)_pad.bin