Bug#699104: Needs to include FPGA bitfiles removed from dahdi-linux

Ben Hutchings ben at decadent.org.uk
Sun Jan 27 17:36:05 UTC 2013


Control: tag -1 patch

This modifies makefw to generate binaries, calls it at package build
time and adds the FPGA bitfiles into dahdi-firmware-nonfree.  All the
build logic is added to debian/rules since we can't use kbuild at
package build time.

I've verified that this produces the same blobs as were previously
embedded in the drivers.

By the way, the install/dahdi-firmware target is not used.

I am *not* intending to upload these changes but will do so if you want
me to.

Ben.

--- /dev/null
+++ b/debian/patches/make-binary-bitfiles
@@ -0,0 +1,73 @@
+Author: Ben Hutchings <ben at decadent.org.uk>
+Description: Add makefw -b option to enable binary output
+Bug-Debian: http://bugs.debian.org/699104
+
+We can't compile these bitfiles into the drivers in the free
+dahdi-source package.  Add the -b option to write a binary
+instead of a C array.
+
+---
+--- a/drivers/dahdi/makefw.c
++++ b/drivers/dahdi/makefw.c
+@@ -1,6 +1,7 @@
+ /* Xilinx firmware convertor program.
+  *
+  * Written by Jim Dixon <jim at lambdatel.com>.
++ * Binary output adde by Ben Hutchings <ben at decadent.org.uk>.
+  *
+  * Copyright (C) 2001 Jim Dixon / Zapata Telephony.
+  * Copyright (C) 2001-2008 Digium, Inc.
+@@ -34,10 +35,12 @@ FILE *fp;
+ int i,j,nbytes;
+ unsigned char c;
+ char	buf[300];
++int bin;
+ 
+ 	if (argc < 3)
+ 	   {
+ 		puts("Usage... makefw  filename.rbt  array_name");
++		puts("         makefw  filename.rbt  -b");
+ 		exit(1);
+ 	   }	
+ 
+@@ -47,8 +50,10 @@ char	buf[300];
+ 		perror("bit file open");
+ 		exit(1);
+ 	   }
++	bin = !strcmp(argv[2], "-b");
+ 	nbytes = 0;
+-	printf("static unsigned char %s[] = {\n",argv[2]);
++	if (!bin)
++		printf("static unsigned char %s[] = {\n",argv[2]);
+ 	i = 0;
+ 	while(fgets(buf,sizeof(buf) - 1,fp))
+ 	   {
+@@ -66,17 +71,22 @@ char	buf[300];
+ 			if ((j & 7) == 7)
+ 			   {
+ 				nbytes++;
+-				if (i) printf(",");				
+-				printf("0x%02x",c);
+-				if (i++ == SWATH) {
+-					printf(",\n");
+-					i = 0;
++				if (bin) {
++					putchar(c);
++				} else {
++					if (i) printf(",");
++					printf("0x%02x",c);
++					if (i++ == SWATH) {
++						printf(",\n");
++						i = 0;
++					}
+ 				}
+ 				c = 0;
+ 			   }
+ 		   }
+ 	   }
+-	printf("\n};\n\n");
++	if (!bin)
++		printf("\n};\n\n");
+ 	fprintf(stderr,"Loaded %d bytes from file\n",nbytes);
+ 	fclose(fp);
+ 	exit(0);
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+make-binary-bitfiles
--- a/debian/rules
+++ b/debian/rules
@@ -12,6 +12,24 @@
 # included in the tarball. The same tarball is properly built in
 # dahdi-linux
 
+drivers/dahdi/makefw: drivers/dahdi/makefw.c
+	$(CC) $(CFLAGS) -Wall -Wextra -o $@ $<
+
+drivers/dahdi/dahdi-fw-tor2.bin: drivers/dahdi/tormenta2.rbt drivers/dahdi/makefw
+	drivers/dahdi/makefw $< -b > $@
+
+drivers/dahdi/dahdi-fw-pciradio.bin: drivers/dahdi/pciradio.rbt drivers/dahdi/makefw
+	drivers/dahdi/makefw $< -b > $@
+
+build/dahdi-firmware-nonfree:: drivers/dahdi/dahdi-fw-tor2.bin drivers/dahdi/dahdi-fw-pciradio.bin
+
+clean::
+	rm -f drivers/dahdi/makefw drivers/dahdi/dahdi-fw-*.bin
+
+install/dahdi-firmware-nonfree::
+	mkdir -p $(CURDIR)/debian/dahdi-firmware-nonfree/lib/firmware
+	install -m 644 -t $(CURDIR)/debian/dahdi-firmware-nonfree/lib/firmware/ drivers/dahdi/dahdi-fw-*.bin
+
 install/dahdi-firmware::
 	chmod +x $(CURDIR)/debian/dahdi-firmware/usr/share/dahdi/get-digium-firmware
 
--- END ---

-- 
Ben Hutchings
Experience is what causes a person to make new mistakes instead of old ones.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-voip-maintainers/attachments/20130127/9896ce66/attachment-0001.pgp>


More information about the Pkg-voip-maintainers mailing list