From 5a3245071840593218b88de24755cc68d23a8612 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sun, 25 Dec 2011 05:10:28 +0000 Subject: A collection of utilities to create firmware images for embedded devices, including many wireless routers from many vendors. The utilities are collected and maintained by the OpenWrt router project. WWW: http://www.openwrt.org/ PR: ports/163537 Submitted by: Stefan Bethke Feature safe: yes --- devel/firmware-utils/Makefile | 21 +++++++++ devel/firmware-utils/distinfo | 2 + devel/firmware-utils/files/Makefile | 59 ++++++++++++++++++++++++++ devel/firmware-utils/files/freebsd.h | 9 ++++ devel/firmware-utils/files/patch-freebsd.h | 12 ++++++ devel/firmware-utils/files/patch-mkcasfw.c | 19 +++++++++ devel/firmware-utils/files/patch-mkcsysimg.c | 19 +++++++++ devel/firmware-utils/files/patch-mkedimaximg.c | 15 +++++++ devel/firmware-utils/files/patch-mkmylofw.c | 15 +++++++ devel/firmware-utils/files/patch-mkzcfw.c | 12 ++++++ devel/firmware-utils/files/patch-mkzynfw.c | 18 ++++++++ devel/firmware-utils/files/patch-ptgen.c | 13 ++++++ devel/firmware-utils/files/patch-trx.c | 13 ++++++ devel/firmware-utils/files/patch-trx2edips.c | 13 ++++++ devel/firmware-utils/files/patch-wrt400n.c | 11 +++++ devel/firmware-utils/pkg-descr | 6 +++ devel/firmware-utils/pkg-plist | 38 +++++++++++++++++ 17 files changed, 295 insertions(+) create mode 100644 devel/firmware-utils/Makefile create mode 100644 devel/firmware-utils/distinfo create mode 100644 devel/firmware-utils/files/Makefile create mode 100644 devel/firmware-utils/files/freebsd.h create mode 100644 devel/firmware-utils/files/patch-freebsd.h create mode 100644 devel/firmware-utils/files/patch-mkcasfw.c create mode 100644 devel/firmware-utils/files/patch-mkcsysimg.c create mode 100644 devel/firmware-utils/files/patch-mkedimaximg.c create mode 100644 devel/firmware-utils/files/patch-mkmylofw.c create mode 100644 devel/firmware-utils/files/patch-mkzcfw.c create mode 100644 devel/firmware-utils/files/patch-mkzynfw.c create mode 100644 devel/firmware-utils/files/patch-ptgen.c create mode 100644 devel/firmware-utils/files/patch-trx.c create mode 100644 devel/firmware-utils/files/patch-trx2edips.c create mode 100644 devel/firmware-utils/files/patch-wrt400n.c create mode 100644 devel/firmware-utils/pkg-descr create mode 100644 devel/firmware-utils/pkg-plist (limited to 'devel/firmware-utils') diff --git a/devel/firmware-utils/Makefile b/devel/firmware-utils/Makefile new file mode 100644 index 000000000000..10392fc8c136 --- /dev/null +++ b/devel/firmware-utils/Makefile @@ -0,0 +1,21 @@ +# New ports collection makefile for: firmware-utils +# Date created: 2011-12-22 +# Whom: Stefan Bethke +# +# $FreeBSD$ +# + +PORTNAME= firmware-utils +PORTVERSION= 20111222 +CATEGORIES= devel +MASTER_SITES= http://www.transit.hanse.de/mirror/svn.openwrt.org/firmware-utils/ + +MAINTAINER= stb@assitu.de +COMMENT= Create device firmware images + +USE_BZIP2= yes + +MAKEFILE= ${FILESDIR}/Makefile +MAKE_ARGS+= INSTALL_PROGRAM="${INSTALL_PROGRAM}" PREFIX=${PREFIX} + +.include diff --git a/devel/firmware-utils/distinfo b/devel/firmware-utils/distinfo new file mode 100644 index 000000000000..b3c7768321e5 --- /dev/null +++ b/devel/firmware-utils/distinfo @@ -0,0 +1,2 @@ +SHA256 (firmware-utils-20111222.tar.bz2) = 0ff574300b761c902b6ce5fddcf78dc511a32b9aea86d31a3f140aa40aec974a +SIZE (firmware-utils-20111222.tar.bz2) = 103583 diff --git a/devel/firmware-utils/files/Makefile b/devel/firmware-utils/files/Makefile new file mode 100644 index 000000000000..7e2b5044fa46 --- /dev/null +++ b/devel/firmware-utils/files/Makefile @@ -0,0 +1,59 @@ +# Custom Makefile to build all firmware utilities. OpenWrt has its own build +# system for these which would be overkill to replicate here. +# +# $FreeBSD$ +# + +SIMPLES= add_header addpattern airlink dgfirmware encode_crc \ + lzma2eva makeamitbin mkcasfw mkchkimg mkcsysimg mkdniimg \ + mkedimaximg mkfwimage mkfwimage2 mkmylofw mktitanimg mktplinkfw \ + mkwrgimg mkzynfw motorola-bin nand_ecc osbridge-crc pc1crypt \ + ptgen spw303v srec2bin trx trx2edips trx2usr wndr3700 xorimage + +ALL= ${SIMPLES} buffalo-enc buffalo-tag buffalo-tftp \ + imagetag mkplanexfw mkzcfw wrt400n + +OBJS+= buffalo-lib.o buffalo-enc.o buffalo-tag.o \ + buffalo-tftp.o +OBJS+= imagetag.o imagetag_cmdline.o +OBJS+= mkplanexfw.o sha1.o +OBJS+= mkzcfw.o +OBJS+= wrt400n.o cyg_crc32.o + +LDFLAGS+= -lmd -lssl -lz + +INSTALL_PROGRAM?= echo /usr/bin/install -C -o root -g bin -m 0644 +PREFIX?= /usr/local + +all: ${ALL} + +install: ${ALL} + ${INSTALL_PROGRAM} ${ALL} ${PREFIX}/bin + +clean: + rm -f ${ALL} ${OBJS} + +.for i in ${SIMPLES} +${i}: ${i}.c +.endfor + +buffalo-enc: buffalo-enc.o buffalo-lib.o + ${CC} -o ${.TARGET} ${LDFLAGS} ${.ALLSRC} + +buffalo-tag: buffalo-tag.o buffalo-lib.o + ${CC} -o ${.TARGET} ${LDFLAGS} ${.ALLSRC} + +buffalo-tftp: buffalo-tftp.o buffalo-lib.o + ${CC} -o ${.TARGET} ${LDFLAGS} ${.ALLSRC} + +imagetag: imagetag.o imagetag_cmdline.o + ${CC} -o ${.TARGET} ${LDFLAGS} ${.ALLSRC} + +mkplanexfw: mkplanexfw.o sha1.o + ${CC} -o ${.TARGET} ${LDFLAGS} ${.ALLSRC} + +mkzcfw: mkzcfw.o cyg_crc32.o + ${CC} -o ${.TARGET} ${LDFLAGS} ${.ALLSRC} + +wrt400n: wrt400n.o cyg_crc32.o + ${CC} -o ${.TARGET} ${LDFLAGS} ${.ALLSRC} diff --git a/devel/firmware-utils/files/freebsd.h b/devel/firmware-utils/files/freebsd.h new file mode 100644 index 000000000000..a333b7930056 --- /dev/null +++ b/devel/firmware-utils/files/freebsd.h @@ -0,0 +1,9 @@ +/* + * + */ + +#define bswap_8(x) ((x) & 0xff) +#define bswap_16(x) ((bswap_8(x) << 8) | bswap_8((x) >> 8)) +#define bswap_32(x) ((bswap_16(x) << 16) | bswap_16((x) >> 16)) +#define bswap_64(x) ((bswap_32(x) << 32) | bswap_32((x) >> 32)) + diff --git a/devel/firmware-utils/files/patch-freebsd.h b/devel/firmware-utils/files/patch-freebsd.h new file mode 100644 index 000000000000..c3bd2af7b5fe --- /dev/null +++ b/devel/firmware-utils/files/patch-freebsd.h @@ -0,0 +1,12 @@ +--- /dev/null 2011-12-22 15:12:10.000000000 +0100 ++++ freebsd.h 2011-12-22 15:09:36.970404879 +0100 +@@ -0,0 +1,9 @@ ++/* ++ * ++ */ ++ ++#define bswap_8(x) ((x) & 0xff) ++#define bswap_16(x) ((bswap_8(x) << 8) | bswap_8((x) >> 8)) ++#define bswap_32(x) ((bswap_16(x) << 16) | bswap_16((x) >> 16)) ++#define bswap_64(x) ((bswap_32(x) << 32) | bswap_32((x) >> 32)) ++ diff --git a/devel/firmware-utils/files/patch-mkcasfw.c b/devel/firmware-utils/files/patch-mkcasfw.c new file mode 100644 index 000000000000..51b4aa3a78f5 --- /dev/null +++ b/devel/firmware-utils/files/patch-mkcasfw.c @@ -0,0 +1,19 @@ +diff --git a/mkcasfw.c b/mkcasfw.c +index 626e77d..fe9f122 100644 +--- mkcasfw.c ++++ mkcasfw.c +@@ -19,11 +19,13 @@ + #include + #include + #include +-#include /* for __BYTE_ORDER */ ++#include /* for __BYTE_ORDER */ + #if defined(__CYGWIN__) + # include + #endif + ++#include "freebsd.h" ++ + #if (__BYTE_ORDER == __LITTLE_ENDIAN) + # define HOST_TO_LE16(x) (x) + # define HOST_TO_LE32(x) (x) diff --git a/devel/firmware-utils/files/patch-mkcsysimg.c b/devel/firmware-utils/files/patch-mkcsysimg.c new file mode 100644 index 000000000000..f78a72e8f92c --- /dev/null +++ b/devel/firmware-utils/files/patch-mkcsysimg.c @@ -0,0 +1,19 @@ +diff --git a/mkcsysimg.c b/mkcsysimg.c +index 4f2352a..b0c16c6 100644 +--- mkcsysimg.c ++++ mkcsysimg.c +@@ -32,11 +32,13 @@ + #include + #include + #include +-#include /* for __BYTE_ORDER */ ++#include /* for __BYTE_ORDER */ + #if defined(__CYGWIN__) + # include + #endif + ++#include "freebsd.h" ++ + #include "csysimg.h" + + #if (__BYTE_ORDER == __LITTLE_ENDIAN) diff --git a/devel/firmware-utils/files/patch-mkedimaximg.c b/devel/firmware-utils/files/patch-mkedimaximg.c new file mode 100644 index 000000000000..4145286e452e --- /dev/null +++ b/devel/firmware-utils/files/patch-mkedimaximg.c @@ -0,0 +1,15 @@ +diff --git a/mkedimaximg.c b/mkedimaximg.c +index d8a017e..6d504e5 100644 +--- mkedimaximg.c ++++ mkedimaximg.c +@@ -15,7 +15,9 @@ + #include + #include + #include +-#include /* for __BYTE_ORDER */ ++#include /* for __BYTE_ORDER */ ++ ++#include "freebsd.h" + + #if (__BYTE_ORDER == __LITTLE_ENDIAN) + # define HOST_TO_LE16(x) (x) diff --git a/devel/firmware-utils/files/patch-mkmylofw.c b/devel/firmware-utils/files/patch-mkmylofw.c new file mode 100644 index 000000000000..b217ec0e5cf1 --- /dev/null +++ b/devel/firmware-utils/files/patch-mkmylofw.c @@ -0,0 +1,15 @@ +diff --git a/mkmylofw.c b/mkmylofw.c +index 585a9f9..927a0f7 100644 +--- mkmylofw.c ++++ mkmylofw.c +@@ -28,7 +28,9 @@ + #include + #include + #include +-#include /* for __BYTE_ORDER */ ++#include /* for __BYTE_ORDER */ ++ ++#include "freebsd.h" + + #if defined(__CYGWIN__) + # include diff --git a/devel/firmware-utils/files/patch-mkzcfw.c b/devel/firmware-utils/files/patch-mkzcfw.c new file mode 100644 index 000000000000..baaab712f4cd --- /dev/null +++ b/devel/firmware-utils/files/patch-mkzcfw.c @@ -0,0 +1,12 @@ +diff --git a/mkzcfw.c b/mkzcfw.c +index 7674e70..c60fc6f 100644 +--- mkzcfw.c ++++ mkzcfw.c +@@ -18,6 +18,7 @@ + #include + #include + ++#include "freebsd.h" + #include "cyg_crc.h" + + #if (__BYTE_ORDER == __BIG_ENDIAN) diff --git a/devel/firmware-utils/files/patch-mkzynfw.c b/devel/firmware-utils/files/patch-mkzynfw.c new file mode 100644 index 000000000000..3b206fbd1baf --- /dev/null +++ b/devel/firmware-utils/files/patch-mkzynfw.c @@ -0,0 +1,18 @@ +diff --git a/mkzynfw.c b/mkzynfw.c +index 36c176f..22d8bd3 100644 +--- mkzynfw.c ++++ mkzynfw.c +@@ -23,11 +23,12 @@ + #include + #include + #include +-#include /* for __BYTE_ORDER */ ++#include /* for __BYTE_ORDER */ + #if defined(__CYGWIN__) + # include + #endif + ++#include "freebsd.h" + #include "zynos.h" + + #if (__BYTE_ORDER == __LITTLE_ENDIAN) diff --git a/devel/firmware-utils/files/patch-ptgen.c b/devel/firmware-utils/files/patch-ptgen.c new file mode 100644 index 000000000000..36ee333fc8da --- /dev/null +++ b/devel/firmware-utils/files/patch-ptgen.c @@ -0,0 +1,13 @@ +diff --git a/ptgen.c b/ptgen.c +index d94aabb..4733311 100644 +--- ptgen.c ++++ ptgen.c +@@ -29,6 +29,8 @@ + #include + #include + ++#include "freebsd.h" ++ + #if __BYTE_ORDER == __BIG_ENDIAN + #define cpu_to_le16(x) bswap_16(x) + #elif __BYTE_ORDER == __LITTLE_ENDIAN diff --git a/devel/firmware-utils/files/patch-trx.c b/devel/firmware-utils/files/patch-trx.c new file mode 100644 index 000000000000..7d764a9438cc --- /dev/null +++ b/devel/firmware-utils/files/patch-trx.c @@ -0,0 +1,13 @@ +diff --git a/trx.c b/trx.c +index 8e95d98..765f83c 100644 +--- trx.c ++++ trx.c +@@ -51,6 +51,8 @@ + #include + #include + ++#include "freebsd.h" ++ + #if __BYTE_ORDER == __BIG_ENDIAN + #define STORE32_LE(X) bswap_32(X) + #define LOAD32_LE(X) bswap_32(X) diff --git a/devel/firmware-utils/files/patch-trx2edips.c b/devel/firmware-utils/files/patch-trx2edips.c new file mode 100644 index 000000000000..0c941a01932e --- /dev/null +++ b/devel/firmware-utils/files/patch-trx2edips.c @@ -0,0 +1,13 @@ +diff --git a/trx2edips.c b/trx2edips.c +index f8d068d..224bc12 100644 +--- trx2edips.c ++++ trx2edips.c +@@ -6,6 +6,8 @@ + #include + #include + ++#include "freebsd.h" ++ + #if __BYTE_ORDER == __BIG_ENDIAN + #define STORE32_LE(X) bswap_32(X) + #define LOAD32_LE(X) bswap_32(X) diff --git a/devel/firmware-utils/files/patch-wrt400n.c b/devel/firmware-utils/files/patch-wrt400n.c new file mode 100644 index 000000000000..9c6fd1843714 --- /dev/null +++ b/devel/firmware-utils/files/patch-wrt400n.c @@ -0,0 +1,11 @@ +diff --git a/wrt400n.c b/wrt400n.c +index a9a4908..f3c53db 100644 +--- wrt400n.c ++++ wrt400n.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include diff --git a/devel/firmware-utils/pkg-descr b/devel/firmware-utils/pkg-descr new file mode 100644 index 000000000000..51a4f5e65e2b --- /dev/null +++ b/devel/firmware-utils/pkg-descr @@ -0,0 +1,6 @@ +A collection of utilities to create firmware images for embedded devices, +including many wireless routers from many vendors. + +The utilities are collected and maintained by the OpenWrt router project. + +WWW: http://www.openwrt.org/ diff --git a/devel/firmware-utils/pkg-plist b/devel/firmware-utils/pkg-plist new file mode 100644 index 000000000000..c61b9e6de783 --- /dev/null +++ b/devel/firmware-utils/pkg-plist @@ -0,0 +1,38 @@ +bin/mkplanexfw +bin/trx +bin/osbridge-crc +bin/mkwrgimg +bin/add_header +bin/mktitanimg +bin/mkzynfw +bin/xorimage +bin/mkfwimage +bin/trx2usr +bin/mkcasfw +bin/mkdniimg +bin/mkfwimage2 +bin/motorola-bin +bin/nand_ecc +bin/buffalo-enc +bin/spw303v +bin/mkzcfw +bin/trx2edips +bin/wndr3700 +bin/mkchkimg +bin/makeamitbin +bin/mkcsysimg +bin/addpattern +bin/imagetag +bin/dgfirmware +bin/encode_crc +bin/ptgen +bin/mkmylofw +bin/airlink +bin/buffalo-tag +bin/mktplinkfw +bin/lzma2eva +bin/buffalo-tftp +bin/wrt400n +bin/mkedimaximg +bin/pc1crypt +bin/srec2bin -- cgit v1.2.3