1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-04 11:23:46 +00:00

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 <stb@lassitu.de>
Feature safe:	yes
This commit is contained in:
Eitan Adler 2011-12-25 05:10:28 +00:00
parent 73257da563
commit 5a32450718
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=287989
18 changed files with 296 additions and 0 deletions

View File

@ -385,6 +385,7 @@
SUBDIR += fga
SUBDIR += fhist
SUBDIR += fib
SUBDIR += firmware-utils
SUBDIR += fistgen
SUBDIR += flatzebra
SUBDIR += flex-sdk

View File

@ -0,0 +1,21 @@
# New ports collection makefile for: firmware-utils
# Date created: 2011-12-22
# Whom: Stefan Bethke <stb@lassitu.de>
#
# $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 <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (firmware-utils-20111222.tar.bz2) = 0ff574300b761c902b6ce5fddcf78dc511a32b9aea86d31a3f140aa40aec974a
SIZE (firmware-utils-20111222.tar.bz2) = 103583

View File

@ -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}

View File

@ -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))

View File

@ -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))
+

View File

@ -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 <stdarg.h>
#include <errno.h>
#include <sys/stat.h>
-#include <endian.h> /* for __BYTE_ORDER */
+#include <sys/endian.h> /* for __BYTE_ORDER */
#if defined(__CYGWIN__)
# include <byteswap.h>
#endif
+#include "freebsd.h"
+
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
# define HOST_TO_LE16(x) (x)
# define HOST_TO_LE32(x) (x)

View File

@ -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 <stdarg.h>
#include <errno.h>
#include <sys/stat.h>
-#include <endian.h> /* for __BYTE_ORDER */
+#include <sys/endian.h> /* for __BYTE_ORDER */
#if defined(__CYGWIN__)
# include <byteswap.h>
#endif
+#include "freebsd.h"
+
#include "csysimg.h"
#if (__BYTE_ORDER == __LITTLE_ENDIAN)

View File

@ -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 <getopt.h>
#include <errno.h>
#include <sys/stat.h>
-#include <endian.h> /* for __BYTE_ORDER */
+#include <sys/endian.h> /* for __BYTE_ORDER */
+
+#include "freebsd.h"
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
# define HOST_TO_LE16(x) (x)

View File

@ -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 <stdarg.h>
#include <errno.h>
#include <sys/stat.h>
-#include <endian.h> /* for __BYTE_ORDER */
+#include <sys/endian.h> /* for __BYTE_ORDER */
+
+#include "freebsd.h"
#if defined(__CYGWIN__)
# include <byteswap.h>

View File

@ -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 <errno.h>
#include <sys/stat.h>
+#include "freebsd.h"
#include "cyg_crc.h"
#if (__BYTE_ORDER == __BIG_ENDIAN)

View File

@ -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 <stdarg.h>
#include <errno.h>
#include <sys/stat.h>
-#include <endian.h> /* for __BYTE_ORDER */
+#include <sys/endian.h> /* for __BYTE_ORDER */
#if defined(__CYGWIN__)
# include <byteswap.h>
#endif
+#include "freebsd.h"
#include "zynos.h"
#if (__BYTE_ORDER == __LITTLE_ENDIAN)

View File

@ -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 <ctype.h>
#include <fcntl.h>
+#include "freebsd.h"
+
#if __BYTE_ORDER == __BIG_ENDIAN
#define cpu_to_le16(x) bswap_16(x)
#elif __BYTE_ORDER == __LITTLE_ENDIAN

View File

@ -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 <errno.h>
#include <unistd.h>
+#include "freebsd.h"
+
#if __BYTE_ORDER == __BIG_ENDIAN
#define STORE32_LE(X) bswap_32(X)
#define LOAD32_LE(X) bswap_32(X)

View File

@ -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 <errno.h>
#include <unistd.h>
+#include "freebsd.h"
+
#if __BYTE_ORDER == __BIG_ENDIAN
#define STORE32_LE(X) bswap_32(X)
#define LOAD32_LE(X) bswap_32(X)

View File

@ -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 <stdio.h>
#include <stdint.h>
#include <string.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>

View File

@ -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/

View File

@ -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