[zaptel-commits] file: branch file/zaptel-firmware r1859 - /team/file/zaptel-firmware/firmware/

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Thu Jan 18 23:27:01 MST 2007


Author: file
Date: Fri Jan 19 00:27:01 2007
New Revision: 1859

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1859
Log:
Add even newer firmware Makefile. This one is capable of doing the following: 1. Downloading/decompressing firmware packages. 2. Building a header file suitable for usage in drivers to get the filename to use for hotplug. 3. Installing firmware into hotplug locations. 4. Building object files suitable for linking against if we can't use hotplug. 5. Uninstalling hotplug installed firmware files.

Modified:
    team/file/zaptel-firmware/firmware/Makefile

Modified: team/file/zaptel-firmware/firmware/Makefile
URL: http://svn.digium.com/view/zaptel/team/file/zaptel-firmware/firmware/Makefile?view=diff&rev=1859&r1=1858&r2=1859
==============================================================================
--- team/file/zaptel-firmware/firmware/Makefile (original)
+++ team/file/zaptel-firmware/firmware/Makefile Fri Jan 19 00:27:01 2007
@@ -23,9 +23,26 @@
 
 FIRMWARE_URL:=http://ftp.digium.com/pub/telephony/firmware/releases
 
+# Firmware files should use the naming convention: zaptel-fw-<base name>-<sub name>-<version> or zaptel-fw-<base name>-<version>
+# First example: zaptel-fw-octasic-064-6114
+# This means this is version 6114 of the octasic 64 firmware
+# Second example: zaptel-fw-tc400b-1
+# This means this is version 1 of the tc400b firmware
+
+# Build a list of firmware package filenames we need
 FIRMWARE:=$(MENUSELECT_FIRMWARE:FIRMWARE-OCTASIC-064=zaptel-fw-octasic-064-$(OCTASIC_064_VERSION).tar.gz)
 FIRMWARE:=$(FIRMWARE:FIRMWARE-OCTASIC-128=zaptel-fw-octasic-128-$(OCTASIC_128_VERSION).tar.gz)
 FIRMWARE:=$(FIRMWARE:FIRMWARE-TC400B=zaptel-fw-tc400b-$(TC400B_VERSION).tar.gz)
+
+# Build a list of object files if hotplug will not be used
+OBJECT_FILES:=$(MENUSELECT_FIRMWARE:FIRMWARE-OCTASIC-064=zaptel-fw-octasic-064.o)
+OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-OCTASIC-128=zaptel-fw-octasic-128.o)
+OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-TC400B=zaptel-fw-tc400b.o)
+
+# Build a list of firmware header files to include that give the current version of firmware
+HEADER_FILES:=$(MENUSELECT_FIRMWARE:FIRMWARE-OCTASIC-064=zaptel-fw-octasic-064.h)
+HEADER_FILES:=$(HEADER_FILES:FIRMWARE-OCTASIC-128=zaptel-fw-octasic-128.h)
+HEADER_FILES:=$(HEADER_FILES:FIRMWARE-TC400B=zaptel-fw-tc400b.h)
 
 # If "fetch" is used, --continue is not a valid option.
 ifeq ($(WGET),wget)
@@ -46,12 +63,68 @@
 		exit 1; \
 	fi
 
+# Download and extract firmware tarball
 zaptel-fw-%.tar.gz: have_download
 	@if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi;	
+	if test ! -f $@; then exit 1; fi; \
+	(cat $@ | gzip -d | tar -xf -)
 
+# Clean up any downloaded/extracted firmware packages
 dist-clean:
-	rm -f *.tar.gz
+	rm -f zaptel-fw-*.o
+	rm -f zaptel-fw-*.h
+	rm -f zaptel-fw-*.bin
+	rm -f zaptel-fw-*.tar.gz
 
-install: $(FIRMWARE)
+# Create object files suitable for linking against
+object-build: $(FIRMWARE) $(OBJECT_FILES)
 
-uninstall:
+# Install all downloaded firmware images for hotplug usage and build headers for inclusion
+hotplug-install: $(FIRMWARE) $(HEADER_FILES)
+	if [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ]; then \
+		$(INSTALL) -m 644 zaptel-fw-*.bin $(INSTALL_PREFIX)/usr/lib/hotplug/firmware; \
+	fi
+	if [ -d $(INSTALL_PREFIX)/lib/firmware ]; then \
+		$(INSTALL) -m 644 zaptel-fw-*.bin $(INSTALL_PREFIX)/lib/firmware; \
+	fi
+
+# Uninstall any installed zaptel firmware images from hotplug firmware directories
+hotplug-uninstall:
+	if [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ]; then \
+		rm -f $(INSTALL_PREFIX)/usr/lib/hotplug/firmware/zaptel-fw-*.bin; \
+	fi
+	if [ -d $(INSTALL_PREFIX)/lib/firmware ]; then \
+		rm -f $(INSTALL_PREFIX)/lib/firmware/zaptel-fw-*.bin; \
+	fi
+
+# Build object file of an octasic 064 firmware image for linking
+zaptel-fw-octasic-064.o: ../wct4xxp/base.o zaptel-fw-octasic-064-$(OCTASIC_064_VERSION).bin
+	@echo Making firmware object file for zaptel-fw-octasic-064-$(OCTASIC_064_VERSION).bin
+	@echo Temporarily copying to zaptel-fw-octasic-064.bin
+	@cp zaptel-fw-octasic-064-$(OCTASIC_064_VERSION).bin zaptel-fw-octasic-064.bin
+	../build_tools/make_firmware_object zaptel-fw-octasic-064.bin $@ ../wct4xxp/base.o
+	@rm -f zaptel-fw-octasic-064.bin
+
+# Build header file of an octasic 064 firmware image for inclusion
+zaptel-fw-octasic-064.h: zaptel-fw-octasic-064-$(OCTASIC_064_VERSION).bin
+	@echo Making firmware header file for zaptel-fw-octasic-064-$(OCTASIC_064_VERSION).bin
+	@echo "static const char *zaptel_fw_octasic_064 = \"zaptel-fw-octasic-064-$(OCTASIC_064_VERSION).bin\";" > $@
+
+# Build object file of an octasic 128 firmware image for linking
+zaptel-fw-octasic-128.o: ../wct4xxp/base.o zaptel-fw-octasic-128-$(OCTASIC_128_VERSION).bin
+	@echo Making firmware object file for zaptel-fw-octasic-128-$(OCTASIC_128_VERSION).bin
+	@echo Temporarily copying to zaptel-fw-octasic-128.bin
+	@cp zaptel-fw-octasic-128-$(OCTASIC_128_VERSION).bin zaptel-fw-octasic-128.bin
+	../build_tools/make_firmware_object zaptel-fw-octasic-128.bin $@ ../wct4xxp/base.o
+	@rm -f zaptel-fw-octasic-128.bin
+
+# Build header file of an octasic 128 firmware image for inclusion
+zaptel-fw-octasic-128.h: zaptel-fw-octasic-128-$(OCTASIC_128_VERSION).bin
+	@echo Making firmware header file for zaptel-fw-octasic-128-$(OCTASIC_128_VERSION).bin
+	@echo "static const char *zaptel_fw_octasic_128 = \"zaptel-fw-octasic-128-$(OCTASIC_128_VERSION).bin\";" > $@
+
+# Build object file of a TC400B firmware image for linking
+zaptel-fw-tc400b.o:
+
+# Build header file of a TC400B firmware image for inclusion
+zaptel-fw-tc400b.h:



More information about the zaptel-commits mailing list