From 2b1564743ec337898e31300ccc97b3b91ecc50b3 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Tue, 16 Jan 2007 01:37:26 +0000 Subject: Merged revisions 1818 via svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1818 | kpfleming | 2007-01-15 19:28:54 -0600 (Mon, 15 Jan 2007) | 3 lines 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 ........ git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@1820 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wct4xxp/fw2h.c | 64 ---------------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 wct4xxp/fw2h.c (limited to 'wct4xxp/fw2h.c') diff --git a/wct4xxp/fw2h.c b/wct4xxp/fw2h.c deleted file mode 100644 index 61ff53a..0000000 --- a/wct4xxp/fw2h.c +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - char *c = NULL, *fw_hdr_name = NULL; - int fd, res, x; - FILE *f = NULL; - unsigned char buf[1024]; - - /* Make sure we have the right amount of arguments */ - if (argc != 3) { - fprintf(stderr, "Usage: fw2h \n"); - exit(1); - } - - /* Make sure we can open the firmware in file */ - if ((fd = open(argv[1], O_RDONLY)) < 0) { - fprintf(stderr, "Unable to open '%s': %s\n", argv[1], strerror(errno)); - exit(1); - } - - /* Make sure we can write out the firmware header file */ - if (!(f = fopen(argv[2], "w+"))) { - fprintf(stderr, "Unable to open '%s' for writing: %s\n", argv[2], strerror(errno)); - exit(1); - } - - /* Strip file extension */ - c = strrchr(argv[2], '.'); - if (c) - *c = '\0'; - - /* Now determine the firmware header name */ - c = strrchr(argv[2], '/'); - if (c) - fw_hdr_name = ++c; - else - fw_hdr_name = argv[2]; - - /* Write out the firmware as a header file */ - fprintf(f, "static unsigned char %s[] = {\t", fw_hdr_name); - while ((res = read(fd, buf, sizeof(buf))) > 0) { - for (x = 0; x < res; x++) { - if (!(x % 16)) - fprintf(f, "\n\t"); - fprintf(f, "0x%02x, ", buf[x]); - } - } - fprintf(f, "\n};\n"); - - if (res < 0) { - fprintf(stderr, "Error reading file: %s\n", strerror(errno)); - exit(1); - } - - fclose(f); - close(fd); - exit(0); -} -- cgit v1.2.3