From 6cebc1c1fb12cc0661f3810ef47ad33206b2e398 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Wed, 12 Mar 2014 23:01:47 -0500 Subject: [PATCH] build_tools/install_firwmare: Try to extract the .bin file from .tar.gz This allows a .tar.gz file that is normally downloaded from the server to be checked directly into a test branch. Now when the firmware is being installed, it can be extracted from any present .tar.gz. Again, this is primarily to simplify testing. A nice side effect is that when going from a newer version to an older version, any stale .bin files in the firmware directory will not be installed into /lib/firmware, but instead the bin file from the *versioned* .tar.gz will always be installed. This should reduce problems where you have to run "make dist-clean" when reverting to an older version that has a firmware change. Signed-off-by: Shaun Ruffell --- build_tools/install_firmware | 9 ++++++--- drivers/dahdi/firmware/Makefile | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build_tools/install_firmware b/build_tools/install_firmware index e98b4f9..f60c45a 100755 --- a/build_tools/install_firmware +++ b/build_tools/install_firmware @@ -8,13 +8,16 @@ DESTDIR=$3 if ! test -f ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION} || ! test -f ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}; then echo "Installing ${FIRMWARE_PATTERN}.bin to hotplug firmware directories" - set -e - install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/usr/lib/hotplug/firmware + tar --no-same-owner -xf ${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}.tar.gz || exit 1 + install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/usr/lib/hotplug/firmware || exit 1 rm -rf ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-* touch ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION} - install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/lib/firmware + install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/lib/firmware || exit 1 rm -rf ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-* touch ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION} + # Remove the .bin file so that if the version is reverted, it will not + # be installed with a non-matching ${FIRMARE_VERSION} file. + rm ${FIRMWARE_PATTERN}.bin else echo "Firmware ${FIRMWARE_PATTERN}.bin is already installed with required version ${FIRMWARE_VERSION}" fi diff --git a/drivers/dahdi/firmware/Makefile b/drivers/dahdi/firmware/Makefile index 67bb177..07d1a02 100644 --- a/drivers/dahdi/firmware/Makefile +++ b/drivers/dahdi/firmware/Makefile @@ -108,7 +108,6 @@ dahdi-fw-%.tar.gz: echo "Attempting to download $@"; \ if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; \ if test ! -f $@; then exit 1; fi; \ - (cat $@ | gzip -d | tar --no-same-owner -xf -) \ fi firmware-loaders: $(FWLOADERS)