rpms/mtd-utils/devel mtd-utils-1.1.0-mcast-git.patch, NONE, 1.1 .cvsignore, 1.3, 1.4 mtd-utils.spec, 1.6, 1.7 sources, 1.3, 1.4 COPYING, 1.1, NONE
David Woodhouse (dwmw2)
fedora-extras-commits at redhat.com
Wed Aug 22 16:01:51 UTC 2007
Author: dwmw2
Update of /cvs/pkgs/rpms/mtd-utils/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10881
Modified Files:
.cvsignore mtd-utils.spec sources
Added Files:
mtd-utils-1.1.0-mcast-git.patch
Removed Files:
COPYING
Log Message:
update
mtd-utils-1.1.0-mcast-git.patch:
--- NEW FILE mtd-utils-1.1.0-mcast-git.patch ---
diff --git a/Makefile b/Makefile
index ae45261..b7ffd58 100644
--- a/Makefile
+++ b/Makefile
@@ -21,10 +21,11 @@ endif
RAWTARGETS = ftl_format flash_erase flash_eraseall nanddump doc_loadbios \
mkfs.jffs ftl_check mkfs.jffs2 flash_lock flash_unlock flash_info \
- flash_otp_info flash_otp_dump mtd_debug flashcp nandwrite \
+ flash_otp_info flash_otp_dump mtd_debug flashcp nandwrite nandtest \
jffs2dump \
nftldump nftl_format docfdisk \
rfddump rfdformat \
+ serve_image recv_image \
sumtool #jffs2reader
TARGETS = $(foreach target,$(RAWTARGETS),$(BUILDDIR)/$(target))
@@ -72,6 +73,17 @@ $(BUILDDIR)/jffs2dump: $(BUILDDIR)/jffs2dump.o $(BUILDDIR)/crc32.o
$(BUILDDIR)/sumtool: $(BUILDDIR)/sumtool.o $(BUILDDIR)/crc32.o
$(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/serve_image: $(BUILDDIR)/serve_image.o $(BUILDDIR)/crc32.o $(BUILDDIR)/fec.o
+ $(CC) $(LDFLAGS) -o $@ $^
+
+$(BUILDDIR)/recv_image: $(BUILDDIR)/recv_image.o $(BUILDDIR)/crc32.o $(BUILDDIR)/fec.o
+ $(CC) $(LDFLAGS) -o $@ $^
+
+$(BUILDDIR)/fectest: $(BUILDDIR)/fectest.o $(BUILDDIR)/crc32.o $(BUILDDIR)/fec.o
+ $(CC) $(LDFLAGS) -o $@ $^
+
+
+
install: ${TARGETS}
mkdir -p ${DESTDIR}/${SBINDIR}
install -m0755 ${TARGETS} ${DESTDIR}/${SBINDIR}/
diff --git a/fec.c b/fec.c
new file mode 100644
index 0000000..09e8453
--- /dev/null
+++ b/fec.c
@@ -0,0 +1,917 @@
+/*
+ * fec.c -- forward error correction based on Vandermonde matrices
+ * 980624
+ * (C) 1997-98 Luigi Rizzo (luigi at iet.unipi.it)
+ *
+ * Portions derived from code by Phil Karn (karn at ka9q.ampr.org),
+ * Robert Morelos-Zaragoza (robert at spectra.eng.hawaii.edu) and Hari
+ * Thirumoorthy (harit at spectra.eng.hawaii.edu), Aug 1995
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+/*
+ * The following parameter defines how many bits are used for
+ * field elements. The code supports any value from 2 to 16
+ * but fastest operation is achieved with 8 bit elements
+ * This is the only parameter you may want to change.
+ */
+#ifndef GF_BITS
+#define GF_BITS 8 /* code over GF(2**GF_BITS) - change to suit */
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * compatibility stuff
+ */
+#ifdef MSDOS /* but also for others, e.g. sun... */
+#define NEED_BCOPY
+#define bcmp(a,b,n) memcmp(a,b,n)
+#endif
+
+#ifdef NEED_BCOPY
+#define bcopy(s, d, siz) memcpy((d), (s), (siz))
+#define bzero(d, siz) memset((d), '\0', (siz))
+#endif
+
+/*
+ * stuff used for testing purposes only
+ */
+
+#ifdef TEST
+#define DEB(x)
+#define DDB(x) x
+#define DEBUG 0 /* minimal debugging */
+#ifdef MSDOS
+#include <time.h>
+struct timeval {
+ unsigned long ticks;
+};
+#define gettimeofday(x, dummy) { (x)->ticks = clock() ; }
+#define DIFF_T(a,b) (1+ 1000000*(a.ticks - b.ticks) / CLOCKS_PER_SEC )
+typedef unsigned long u_long ;
+typedef unsigned short u_short ;
+#else /* typically, unix systems */
+#include <sys/time.h>
+#define DIFF_T(a,b) \
+ (1+ 1000000*(a.tv_sec - b.tv_sec) + (a.tv_usec - b.tv_usec) )
+#endif
+
+#define TICK(t) \
+ {struct timeval x ; \
+ gettimeofday(&x, NULL) ; \
+ t = x.tv_usec + 1000000* (x.tv_sec & 0xff ) ; \
+ }
+#define TOCK(t) \
+ { u_long t1 ; TICK(t1) ; \
+ if (t1 < t) t = 256000000 + t1 - t ; \
+ else t = t1 - t ; \
+ if (t == 0) t = 1 ;}
+
+u_long ticks[10]; /* vars for timekeeping */
+#else
+#define DEB(x)
+#define DDB(x)
+#define TICK(x)
+#define TOCK(x)
+#endif /* TEST */
+
+/*
+ * You should not need to change anything beyond this point.
+ * The first part of the file implements linear algebra in GF.
+ *
+ * gf is the type used to store an element of the Galois Field.
+ * Must constain at least GF_BITS bits.
+ *
+ * Note: unsigned char will work up to GF(256) but int seems to run
+ * faster on the Pentium. We use int whenever have to deal with an
+ * index, since they are generally faster.
+ */
+#if (GF_BITS < 2 && GF_BITS >16)
+#error "GF_BITS must be 2 .. 16"
+#endif
+#if (GF_BITS <= 8)
+typedef unsigned char gf;
+#else
+typedef unsigned short gf;
+#endif
+
+#define GF_SIZE ((1 << GF_BITS) - 1) /* powers of \alpha */
+
+/*
+ * Primitive polynomials - see Lin & Costello, Appendix A,
+ * and Lee & Messerschmitt, p. 453.
+ */
+static char *allPp[] = { /* GF_BITS polynomial */
+ NULL, /* 0 no code */
+ NULL, /* 1 no code */
+ "111", /* 2 1+x+x^2 */
+ "1101", /* 3 1+x+x^3 */
+ "11001", /* 4 1+x+x^4 */
+ "101001", /* 5 1+x^2+x^5 */
+ "1100001", /* 6 1+x+x^6 */
+ "10010001", /* 7 1 + x^3 + x^7 */
+ "101110001", /* 8 1+x^2+x^3+x^4+x^8 */
+ "1000100001", /* 9 1+x^4+x^9 */
+ "10010000001", /* 10 1+x^3+x^10 */
+ "101000000001", /* 11 1+x^2+x^11 */
+ "1100101000001", /* 12 1+x+x^4+x^6+x^12 */
+ "11011000000001", /* 13 1+x+x^3+x^4+x^13 */
+ "110000100010001", /* 14 1+x+x^6+x^10+x^14 */
+ "1100000000000001", /* 15 1+x+x^15 */
+ "11010000000010001" /* 16 1+x+x^3+x^12+x^16 */
+};
+
+
+/*
+ * To speed up computations, we have tables for logarithm, exponent
+ * and inverse of a number. If GF_BITS <= 8, we use a table for
+ * multiplication as well (it takes 64K, no big deal even on a PDA,
+ * especially because it can be pre-initialized an put into a ROM!),
+ * otherwhise we use a table of logarithms.
+ * In any case the macro gf_mul(x,y) takes care of multiplications.
+ */
[...1887 lines suppressed...]
+ bitrate in the second half of the sequence */
+ if (block_nr & 1)
+ actualpkt = pkt_nr;
+ else
+ actualpkt = total_pkts_per_block - 1 - pkt_nr;
+
+ blockptr = image + (erasesize * block_nr);
+ if (block_nr == nr_blocks - 1)
+ blockptr = last_block;
+
+ fec_encode_linear(fec, blockptr, pktbuf.data, actualpkt, PKT_SIZE);
+
+ pktbuf.hdr.thiscrc = htonl(crc32(-1, pktbuf.data, PKT_SIZE));
+ pktbuf.hdr.block_crc = htonl(block_crcs[block_nr]);
+ pktbuf.hdr.block_nr = htonl(block_nr);
+ pktbuf.hdr.pkt_nr = htons(actualpkt);
+ pktbuf.hdr.pkt_sequence = htonl(sequence++);
+
+ printf("\rSending data block %08x packet %3d/%d",
+ block_nr * erasesize,
+ pkt_nr, total_pkts_per_block);
+
+ if (pkt_nr && !block_nr) {
+ unsigned long amt_sent = pkt_nr * nr_blocks * sizeof(pktbuf);
+
+ gettimeofday(&now, NULL);
+
+ time_msecs = (now.tv_sec - then.tv_sec) * 1000;
+ time_msecs += ((int)(now.tv_usec - then.tv_usec)) / 1000;
+ printf(" (%ld KiB/s) ",
+ amt_sent / 1024 * 1000 / time_msecs);
+ }
+
+ fflush(stdout);
+
+#ifdef RANDOMDROP
+ if ((rand() % 1000) < 20) {
+ printf("\nDropping packet %d of block %08x\n", pkt_nr+1, block_nr * erasesize);
+ continue;
+ }
+#endif
+ gettimeofday(&now, NULL);
+#if 1
+ tosleep = nextpkt.tv_usec - now.tv_usec +
+ (1000000 * (nextpkt.tv_sec - now.tv_sec));
+
+ /* We need hrtimers for this to actually work */
+ if (tosleep > 0) {
+ struct timespec req;
+
+ req.tv_nsec = (tosleep % 1000000) * 1000;
+ req.tv_sec = tosleep / 1000000;
+
+ nanosleep(&req, NULL);
+ }
+#else
+ while (now.tv_sec < nextpkt.tv_sec ||
+ (now.tv_sec == nextpkt.tv_sec &&
+ now.tv_usec < nextpkt.tv_usec)) {
+ gettimeofday(&now, NULL);
+ }
+#endif
+ nextpkt.tv_usec += pkt_delay;
+ if (nextpkt.tv_usec >= 1000000) {
+ nextpkt.tv_sec += nextpkt.tv_usec / 1000000;
+ nextpkt.tv_usec %= 1000000;
+ }
+
+ /* If the time for the next packet has already
+ passed (by some margin), then we've lost time
+ Adjust our expected timings accordingly. If
+ we're only a little way behind, don't slip yet */
+ if (now.tv_usec > (now.tv_usec + (5 * pkt_delay) +
+ 1000000 * (nextpkt.tv_sec - now.tv_sec))) {
+ nextpkt = now;
+ }
+
+ if (write(sock, &pktbuf, sizeof(pktbuf)) < 0) {
+ perror("write");
+ writeerrors++;
+ if (writeerrors > 10) {
+ fprintf(stderr, "Too many consecutive write errors\n");
+ exit(1);
+ }
+ } else
+ writeerrors = 0;
+
+
+
+ }
+ }
+ munmap(image, st.st_size);
+ close(rfd);
+ close(sock);
+ return 0;
+}
diff --git a/ubi-utils/src/ubimkvol.c b/ubi-utils/src/ubimkvol.c
index 1368671..db57a93 100644
--- a/ubi-utils/src/ubimkvol.c
+++ b/ubi-utils/src/ubimkvol.c
@@ -55,6 +55,7 @@ struct args {
char *name;
int nlen;
char node[256];
+ int maxavs;
/* special stuff needed to get additional arguments */
char *arg1;
@@ -69,6 +70,7 @@ static struct args myargs = {
.vol_id = UBI_VOL_NUM_AUTO,
.name = NULL,
.nlen = 0,
+ .maxavs = 0,
};
static int param_sanity_check(struct args *args, libubi_t libubi);
@@ -85,6 +87,7 @@ static const char *optionsstr =
" -N, --name=<name> volume name\n"
" -s, --size=<bytes> volume size volume size in bytes, kilobytes (KiB)\n"
" or megabytes (MiB)\n"
+" -m, --maxavsize set volume size to maximum available size\n"
" -t, --type=<static|dynamic> volume type (dynamic, static), default is\n"
" dynamic\n"
" -?, --help Give this help list\n"
@@ -93,10 +96,10 @@ static const char *optionsstr =
static const char *usage =
"Usage: ubimkvol [-?V] [-a <alignment>] [-d <devn>] [-n <volume id>]\n"
-" [-N <name>] [-s <bytes>] [-t <static|dynamic>]\n"
+" [-N <name>] [-s <bytes>] [-t <static|dynamic>] [-m]\n"
" [--alignment=<alignment>] [--devn=<devn>] [--vol_id=<volume id>]\n"
" [--name=<name>] [--size=<bytes>] [--type=<static|dynamic>] [--help]\n"
-" [--usage] [--version]\n";
+" [--usage] [--version] [--maxavsize]\n";
struct option long_options[] = {
{ .name = "alignment", .has_arg = 1, .flag = NULL, .val = 'a' },
@@ -108,6 +111,7 @@ struct option long_options[] = {
{ .name = "help", .has_arg = 0, .flag = NULL, .val = '?' },
{ .name = "usage", .has_arg = 0, .flag = NULL, .val = 0 },
{ .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' },
+ { .name = "maxavsize", .has_arg = 0, .flag = NULL, .val = 'm' },
{ NULL, 0, NULL, 0}
};
@@ -129,7 +133,7 @@ parse_opt(int argc, char **argv, struct args *args)
while (1) {
int key;
- key = getopt_long(argc, argv, "a:d:n:N:s:t:?V", long_options, NULL);
+ key = getopt_long(argc, argv, "a:d:n:N:s:t:?Vm", long_options, NULL);
if (key == -1)
break;
@@ -216,6 +220,10 @@ parse_opt(int argc, char **argv, struct args *args)
exit(0);
break;
+ case 'm':
+ args->maxavs = 1;
+ break;
+
default:
fprintf(stderr, "%s", usage);
exit(-1);
@@ -232,7 +240,7 @@ static int param_sanity_check(struct args *args, libubi_t libubi)
int err, len;
struct ubi_info ubi;
- if (args->bytes == 0) {
+ if (args->bytes == 0 && !args->maxavs) {
fprintf(stderr, "Volume size was not specified\n");
goto out;
}
@@ -297,7 +305,24 @@ int main(int argc, char * const argv[])
req.vol_id = myargs.vol_id;
req.alignment = myargs.alignment;
- req.bytes = myargs.bytes;
+
+ if (myargs.maxavs) {
+ struct ubi_dev_info ubi_dev;
+
+ err = ubi_get_dev_info1(libubi, myargs.devn, &ubi_dev);
+ if (err) {
+ perror("Can't get UBI device info");
+ goto out_libubi;
+ }
+ req.bytes = ubi_dev.avail_bytes;
+ if (!req.bytes) {
+ fprintf(stderr, "There is no available free space on device!\n");
+ goto out_libubi;
+ }
+ printf("Setting the volume size to %lld\n", req.bytes);
+ } else
+ req.bytes = myargs.bytes;
+
req.vol_type = myargs.vol_type;
req.name = myargs.name;
Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/mtd-utils/devel/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- .cvsignore 18 Sep 2006 07:48:06 -0000 1.3
+++ .cvsignore 22 Aug 2007 16:01:13 -0000 1.4
@@ -1 +1 @@
-mtd-utils-1.0.1.tar.gz
+mtd-utils-1.1.0.tar.bz2
Index: mtd-utils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/mtd-utils/devel/mtd-utils.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mtd-utils.spec 4 Oct 2006 23:05:05 -0000 1.6
+++ mtd-utils.spec 22 Aug 2007 16:01:13 -0000 1.7
@@ -1,14 +1,14 @@
Summary: Utilities for dealing with MTD (flash) devices
Name: mtd-utils
-Version: 1.0.1
-Release: 2%{?dist}
-License: GPL
+Version: 1.1.0
+Release: 1%{?dist}
+License: GPLv2+
Group: Applications/System
URL: http://www.linux-mtd.infradead.org/
-Source0: ftp://ftp.infradead.org/pub/mtd-utils/%{name}-%{version}.tar.gz
-Source1: COPYING
+Source0: ftp://ftp.infradead.org/pub/mtd-utils/%{name}-%{version}.tar.bz2
+Patch0: mtd-utils-1.1.0-mcast-git.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: zlib-devel libacl-devel
+BuildRequires: zlib-devel libacl-devel lzo-devel
%description
The mtd-utils package contains utilities related to handling MTD devices,
@@ -16,8 +16,7 @@
%prep
%setup -q
-cp %{SOURCE1} .
-
+%patch0 -p1
%build
make CFLAGS="$RPM_OPT_FLAGS -I./include"
@@ -37,7 +36,10 @@
%changelog
-* Thu Oct 05 2006 Christian Iseli <Christian.Iseli at licr.org> 1.0.1-2
+* Wed Aug 22 2007 David Woodhouse <dwmw2 at infradead.org> - 1.1.0-1
+- Update to 1.1.0 + nandtest + multicast utils
+
+* Thu Oct 05 2006 Christian Iseli <Christian.Iseli at licr.org> - 1.0.1-2
- rebuilt for unwind info generation, broken in gcc-4.1.1-21
* Mon Sep 18 2006 David Woodhouse <dwmw2 at infradead.org> - 1.0.1-1
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/mtd-utils/devel/sources,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sources 18 Sep 2006 07:48:06 -0000 1.3
+++ sources 22 Aug 2007 16:01:13 -0000 1.4
@@ -1 +1 @@
-55c8214e1ef052ecc8a0fac45325f719 mtd-utils-1.0.1.tar.gz
+05aa9b015625aa20afba728fb7ee47b3 mtd-utils-1.1.0.tar.bz2
--- COPYING DELETED ---
More information about the fedora-extras-commits
mailing list