[zaptel-commits] kpfleming: branch 1.2 r1818 - in /branches/1.2: ./ build_tools/ wct4xxp/

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Mon Jan 15 18:28:55 MST 2007


Author: kpfleming
Date: Mon Jan 15 19:28:54 2007
New Revision: 1818

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1818
Log:
eliminate the fw2h tool, and instead use objcopy to directly make object files from the firmware binary files
pass HOTPLUG_FIRMWARE down to the module build so that we can avoid various compiler warnings

Added:
    branches/1.2/build_tools/make_firmware_object   (with props)
Removed:
    branches/1.2/wct4xxp/fw2h.c
Modified:
    branches/1.2/Makefile
    branches/1.2/wct4xxp/   (props changed)
    branches/1.2/wct4xxp/Kbuild
    branches/1.2/wct4xxp/Makefile
    branches/1.2/wct4xxp/base.c
    branches/1.2/wct4xxp/vpm450m.c
    branches/1.2/wct4xxp/vpm450m.h

Modified: branches/1.2/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/Makefile?view=diff&rev=1818&r1=1817&r2=1818
==============================================================================
--- branches/1.2/Makefile (original)
+++ branches/1.2/Makefile Mon Jan 15 19:28:54 2007
@@ -142,7 +142,7 @@
 linux26: prereq $(BINS)
 	@echo $(KSRC)
 	@if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi
-	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
+	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE) modules
 
 version.h: FORCE
 	ZAPTELVERSION="${ZAPTELVERSION}" build_tools/make_version_h > $@.tmp

Added: branches/1.2/build_tools/make_firmware_object
URL: http://svn.digium.com/view/zaptel/branches/1.2/build_tools/make_firmware_object?view=auto&rev=1818
==============================================================================
--- branches/1.2/build_tools/make_firmware_object (added)
+++ branches/1.2/build_tools/make_firmware_object Mon Jan 15 19:28:54 2007
@@ -1,0 +1,12 @@
+#!/bin/sh -e
+
+# make an object file from a raw binary firmware file
+# arguments:
+#   1 - firmware file
+#   2 - output file
+#   3 - template output file (used to learn desired format)
+
+bfdname=`objdump -f ${3} | grep -e "${3}:" | sed "s/.*file format \(.*\)/\1/"`
+bfdarch=`objdump -f ${3} | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"`
+
+objcopy -I binary ${1} -B ${bfdarch} -O ${bfdname} ${2}

Propchange: branches/1.2/build_tools/make_firmware_object
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/1.2/build_tools/make_firmware_object
------------------------------------------------------------------------------
    svn:executable = *

Propchange: branches/1.2/build_tools/make_firmware_object
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: branches/1.2/build_tools/make_firmware_object
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: branches/1.2/wct4xxp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Jan 15 19:28:54 2007
@@ -1,6 +1,3 @@
 *.mod.c
 *.cmd
 *.ko
-vpmoct064_fw.h
-vpmoct128_fw.h
-fw2h

Modified: branches/1.2/wct4xxp/Kbuild
URL: http://svn.digium.com/view/zaptel/branches/1.2/wct4xxp/Kbuild?view=diff&rev=1818&r1=1817&r2=1818
==============================================================================
--- branches/1.2/wct4xxp/Kbuild (original)
+++ branches/1.2/wct4xxp/Kbuild Mon Jan 15 19:28:54 2007
@@ -1,24 +1,23 @@
-# yes, this is redundant... the Kbuild system is changing to hostprogs-y,
-# but we need to be able to support older verions as well
-host-progs := fw2h
-hostprogs-y := fw2h
-
 obj-m += wct4xxp.o
 
 EXTRA_CFLAGS := -I$(src)/.. $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef
 
 wct4xxp-objs := base.o vpm450m.o $(shell $(src)/../oct612x/octasic-helper objects ../oct612x)
 
+ifneq ($(HOTPLUG_FIRMWARE),yes)
+wct4xxp-objs += firmware_oct6114-64d.o firmware_oct6114-128d.o
+endif
+
 $(obj)/base.o: $(src)/vpm450m.h $(src)/wct4xxp.h
 $(obj)/base.o: $(src)/../zaptel.h
 
-$(obj)/vpm450m.o: $(obj)/vpmoct128_fw.h $(obj)/vpmoct064_fw.h $(src)/vpm450m.h
+$(obj)/vpm450m.o: $(src)/vpm450m.h
 $(obj)/vpm450m.o: $(src)/../oct612x/include/oct6100api/oct6100_api.h
 
-$(obj)/vpmoct128_fw.h: $(src)/OCT6114-128D.ima $(obj)/fw2h
-	$(obj)/fw2h $< $@
+$(obj)/firmware_oct6114-64d.o: $(src)/OCT6114-64D.ima $(obj)/base.o
+	@echo Making firmware object file for $(notdir $<)
+	@cd $(src) && ../build_tools/make_firmware_object $(notdir $<) $@ $(obj)/base.o
 
-$(obj)/vpmoct064_fw.h: $(src)/OCT6114-64D.ima $(obj)/fw2h
-	$(obj)/fw2h $< $@
-
-clean-files := vpmoct128_fw.h vpmoct064_fw.h
+$(obj)/firmware_oct6114-128d.o: $(src)/OCT6114-128D.ima $(obj)/base.o
+	@echo Making firmware object file for $(notdir $<)
+	@cd $(src) && ../build_tools/make_firmware_object $(notdir $<) $@ $(obj)/base.o

Modified: branches/1.2/wct4xxp/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/wct4xxp/Makefile?view=diff&rev=1818&r1=1817&r2=1818
==============================================================================
--- branches/1.2/wct4xxp/Makefile (original)
+++ branches/1.2/wct4xxp/Makefile Mon Jan 15 19:28:54 2007
@@ -14,23 +14,21 @@
 
 base.o: ../zaptel.h vpm450m.h wct4xxp.h
 
-vpm450m.o: vpm450m.h vpmoct128_fw.h vpmoct064_fw.h ../oct612x/include/oct6100api/oct6100_api.h
+vpm450m.o: vpm450m.h ../oct612x/include/oct6100api/oct6100_api.h
 
-wct4xxp.o: base.o vpm450m.o $(OCTASIC_OBJS)
+firmware_oct6114-64d.o: OCT6114-64D.ima base.o
+	@echo Making firmware object file for $<
+	../build_tools/make_firmware_object $< $@ base.o
+
+firmware_oct6114-128d.o: OCT6114-128D.ima base.o
+	@echo Making firmware object file for $<
+	../build_tools/make_firmware_object $< $@ base.o
+
+wct4xxp.o: base.o vpm450m.o $(OCTASIC_OBJS) firmware_oct6114-64d.o firmware_oct6114-128d.o
 	$(LD) -r -o $@ $^
 
-fw2h: CFLAGS=
-
-vpmoct128_fw.h: OCT6114-128D.ima fw2h
-	./fw2h $< $@
-
-vpmoct064_fw.h: OCT6114-64D.ima fw2h
-	./fw2h $< $@
-
 clean:
-	rm -f *.o fw2h
-	rm -f vpmoct128_fw.h
-	rm -f vpmoct064_fw.h
+	rm -f *.o
 	rm -f $(OCTASIC_OBJS)
 
 endif

Modified: branches/1.2/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wct4xxp/base.c?view=diff&rev=1818&r1=1817&r2=1818
==============================================================================
--- branches/1.2/wct4xxp/base.c (original)
+++ branches/1.2/wct4xxp/base.c Mon Jan 15 19:28:54 2007
@@ -46,6 +46,11 @@
 #endif
 #include "wct4xxp.h"
 #include "vpm450m.h"
+
+#ifdef HOTPLUG_FIRMWARE
+static const char *oct064_firmware = "OCT6114-64D.ima";
+static const char *oct128_firmware = "OCT6114-128D.ima";
+#endif
 
 /*
  * Tasklets provide better system interactive response at the cost of the

Modified: branches/1.2/wct4xxp/vpm450m.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wct4xxp/vpm450m.c?view=diff&rev=1818&r1=1817&r2=1818
==============================================================================
--- branches/1.2/wct4xxp/vpm450m.c (original)
+++ branches/1.2/wct4xxp/vpm450m.c Mon Jan 15 19:28:54 2007
@@ -13,8 +13,10 @@
 #ifdef HOTPLUG_FIRMWARE
 #include <linux/firmware.h>
 #else
-#include "vpmoct128_fw.h"
-#include "vpmoct064_fw.h"
+extern unsigned char _binary_OCT6114_64D_ima_start;
+extern unsigned int _binary_OCT6114_64D_ima_size;
+extern unsigned char _binary_OCT6114_128D_ima_start;
+extern unsigned int _binary_OCT6114_128D_ima_size;
 #endif
 
 #include "oct6100api/oct6100_api.h"
@@ -409,11 +411,11 @@
 	ChipOpen.ulImageSize = firmware->size;
 #else
 	if (vpm450m->numchans > 64) {
-		ChipOpen.pbyImageFile = vpmoct128_fw;
-		ChipOpen.ulImageSize = sizeof(vpmoct128_fw);
+		ChipOpen.pbyImageFile = &_binary_OCT6114_128D_ima_start;
+		ChipOpen.ulImageSize = _binary_OCT6114_128D_ima_size;
 	} else {
-		ChipOpen.pbyImageFile = vpmoct064_fw;
-		ChipOpen.ulImageSize = sizeof(vpmoct064_fw);
+		ChipOpen.pbyImageFile = &_binary_OCT6114_64D_ima_start;
+		ChipOpen.ulImageSize = _binary_OCT6114_64D_ima_size;
 	}
 #endif	
 

Modified: branches/1.2/wct4xxp/vpm450m.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/wct4xxp/vpm450m.h?view=diff&rev=1818&r1=1817&r2=1818
==============================================================================
--- branches/1.2/wct4xxp/vpm450m.h (original)
+++ branches/1.2/wct4xxp/vpm450m.h Mon Jan 15 19:28:54 2007
@@ -30,9 +30,6 @@
 struct firmware;
 #endif
 
-static const char *oct064_firmware = "OCT6114-64D.ima";
-static const char *oct128_firmware = "OCT6114-128D.ima";
-
 /* From driver */
 unsigned int oct_get_reg(void *data, unsigned int reg);
 void oct_set_reg(void *data, unsigned int reg, unsigned int val);



More information about the zaptel-commits mailing list