diff options
author | Paul Sokolovsky <pmiscml@gmail.com> | 2007-07-25 15:38:14 +0000 |
---|---|---|
committer | Paul Sokolovsky <pmiscml@gmail.com> | 2007-07-25 15:38:14 +0000 |
commit | 2d281797eda9dc01a695141e9b2ff163df642046 (patch) | |
tree | db3c4e640b14d83724c824b68e11b340144ffc02 /packages/mtd/mtd-utils | |
parent | b17f2fdbbf1df6393aee46e1f375b32de5e55a9a (diff) | |
parent | 2da13ebbe1c7ddae7c77364217bb1cbaddb8fba7 (diff) |
merge of '92b38b8c6e237f7df0177373a95c59b85ad01087'
and 'd73006a33d6286f7506fbf07c816c81e2e9c215c'
Diffstat (limited to 'packages/mtd/mtd-utils')
-rw-r--r-- | packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-20041113.patch | 107 | ||||
-rw-r--r-- | packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-20060131.patch | 100 | ||||
-rw-r--r-- | packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2.patch | 103 | ||||
-rw-r--r-- | packages/mtd/mtd-utils/add_lzo.patch | 220 | ||||
-rw-r--r-- | packages/mtd/mtd-utils/favour_lzo.patch | 136 | ||||
-rw-r--r-- | packages/mtd/mtd-utils/fix-ignoreerrors-20060131.patch | 20 | ||||
-rw-r--r-- | packages/mtd/mtd-utils/fix-ignoreerrors.patch | 20 | ||||
-rw-r--r-- | packages/mtd/mtd-utils/lzo_1x.patch | 26 |
8 files changed, 26 insertions, 706 deletions
diff --git a/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-20041113.patch b/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-20041113.patch deleted file mode 100644 index cb819e19be..0000000000 --- a/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-20041113.patch +++ /dev/null @@ -1,107 +0,0 @@ - -# -# Patch managed by http://www.holgerschurig.de/patcher.html -# - ---- mtd/util/mkfs.jffs2.c~add-exclusion-to-mkfs-jffs2.patch -+++ mtd/util/mkfs.jffs2.c -@@ -89,7 +89,12 @@ - struct filesystem_entry *files; /* Only relevant to directories */ - }; - -+struct ignorepath_entry { -+ struct ignorepath_entry* next; /* Points to the next ignorepath element */ -+ char name[PATH_MAX]; /* Name of the entry */ -+}; - -+static struct ignorepath_entry* ignorepath = 0; - static int out_fd = -1; - static char default_rootdir[] = "."; - static char *rootdir = default_rootdir; -@@ -363,6 +368,7 @@ - char *hpath, *tpath; - struct dirent *dp, **namelist; - struct filesystem_entry *entry; -+ struct ignorepath_entry* element = ignorepath; - - - if (lstat(hostpath, &sb)) { -@@ -372,6 +378,15 @@ - entry = add_host_filesystem_entry(targetpath, hostpath, - sb.st_uid, sb.st_gid, sb.st_mode, 0, parent); - -+ while ( element ) { -+ if ( strcmp( element->name, hostpath ) == 0 ) { -+ printf( "Note: ignoring directories below '%s'\n", hostpath ); -+ return entry; -+ break; -+ } -+ element = element->next; -+ } -+ - n = scandir(hostpath, &namelist, 0, alphasort); - if (n < 0) { - perror_msg_and_die("opening directory %s", hostpath); -@@ -1139,6 +1154,7 @@ - {"root", 1, NULL, 'r'}, - {"pagesize", 1, NULL, 's'}, - {"eraseblock", 1, NULL, 'e'}, -+ {"ignore", 1, NULL, 'i'}, - {"output", 1, NULL, 'o'}, - {"help", 0, NULL, 'h'}, - {"verbose", 0, NULL, 'v'}, -@@ -1180,6 +1196,7 @@ - " -L, --list-compressors Show the list of the avaiable compressors\n" - " -t, --test-compression Call decompress and compare with the original (for test)\n" - " -n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock\n" -+ " -i, --ignore=PATH Ignore sub directory and file tree below PATH when recursing over the file system\n" - " -o, --output=FILE Output to FILE (default: stdout)\n" - " -l, --little-endian Create a little-endian filesystem\n" - " -b, --big-endian Create a big-endian filesystem\n" -@@ -1202,13 +1219,14 @@ - struct stat sb; - FILE *devtable = NULL; - struct filesystem_entry *root; -- char *compr_name = NULL; -- int compr_prior = -1; -+ char *compr_name = NULL; -+ int compr_prior = -1; -+ struct ignorepath_entry* element = ignorepath; - -- jffs2_compressors_init(); -+ jffs2_compressors_init(); - - while ((opt = getopt_long(argc, argv, -- "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:", long_options, &c)) >= 0) -+ "D:d:r:s:i:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:", long_options, &c)) >= 0) - { - switch (opt) { - case 'D': -@@ -1231,6 +1249,27 @@ - page_size = strtol(optarg, NULL, 0); - break; - -+ case 'i': -+ printf( "Note: Adding '%s' to ignore Path\n", optarg ); -+ if ( !ignorepath ) { -+ ignorepath = xmalloc( sizeof( struct ignorepath_entry ) ); -+ ignorepath->next = 0; -+ strcpy( &ignorepath->name[0], optarg ); -+ } else { -+ while ( element->next ) element = element->next; -+ element->next = xmalloc( sizeof( struct ignorepath_entry ) ); -+ element->next->next = 0; -+ strcpy( &element->next->name[0], optarg ); -+ } -+ printf( "--------- Dumping ignore path list ----------------\n" ); -+ element=ignorepath; -+ while ( element ) { -+ printf( " * '%s'\n", &element->name[0] ); -+ element = element->next; -+ } -+ printf( "---------------------------------------------------\n" ); -+ break; -+ - case 'o': - if (out_fd != -1) { - error_msg_and_die("output filename specified more than once"); diff --git a/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-20060131.patch b/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-20060131.patch deleted file mode 100644 index e24f395890..0000000000 --- a/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-20060131.patch +++ /dev/null @@ -1,100 +0,0 @@ ---- mtd/util/mkfs.jffs2.c~add-exclusion-to-mkfs-jffs2.patch -+++ mtd/util/mkfs.jffs2.c -@@ -92,7 +92,12 @@ - struct filesystem_entry *files; /* Only relevant to directories */ - }; - -- -+struct ignorepath_entry { -+ struct ignorepath_entry* next; /* Points to the next ignorepath element */ -+ char name[PATH_MAX]; /* Name of the entry */ -+}; -+ -+static struct ignorepath_entry* ignorepath = 0; - static int out_fd = -1; - static int in_fd = -1; - static char default_rootdir[] = "."; -@@ -367,7 +372,7 @@ - char *hpath, *tpath; - struct dirent *dp, **namelist; - struct filesystem_entry *entry; -- -+ struct ignorepath_entry* element = ignorepath; - - if (lstat(hostpath, &sb)) { - perror_msg_and_die("%s", hostpath); -@@ -376,6 +381,15 @@ - entry = add_host_filesystem_entry(targetpath, hostpath, - sb.st_uid, sb.st_gid, sb.st_mode, 0, parent); - -+ while ( element ) { -+ if ( strcmp( element->name, targetpath ) == 0 ) { -+ printf( "Note: ignoring directories below '%s'\n", targetpath ); -+ return entry; -+ break; -+ } -+ element = element->next; -+ } -+ - n = scandir(hostpath, &namelist, 0, alphasort); - if (n < 0) { - perror_msg_and_die("opening directory %s", hostpath); -@@ -1157,6 +1171,7 @@ - {"root", 1, NULL, 'r'}, - {"pagesize", 1, NULL, 's'}, - {"eraseblock", 1, NULL, 'e'}, -+ {"ignore", 1, NULL, 'I'}, - {"output", 1, NULL, 'o'}, - {"help", 0, NULL, 'h'}, - {"verbose", 0, NULL, 'v'}, -@@ -1199,6 +1214,7 @@ - " -L, --list-compressors Show the list of the avaiable compressors\n" - " -t, --test-compression Call decompress and compare with the original (for test)\n" - " -n, --no-eraseblock-headers Don't add a eraseblock header to every eraseblock\n" -+ " -I, --ignore=PATH Ignore sub directory and file tree below PATH when recursing over the file system\n" - " -o, --output=FILE Output to FILE (default: stdout)\n" - " -l, --little-endian Create a little-endian filesystem\n" - " -b, --big-endian Create a big-endian filesystem\n" -@@ -1368,11 +1384,12 @@ - struct filesystem_entry *root; - char *compr_name = NULL; - int compr_prior = -1; -+ struct ignorepath_entry* element = ignorepath; - - jffs2_compressors_init(); - - while ((opt = getopt_long(argc, argv, -- "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) -+ "D:d:r:s:I:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) - { - switch (opt) { - case 'D': -@@ -1395,6 +1412,28 @@ - page_size = strtol(optarg, NULL, 0); - break; - -+ case 'I': -+ printf( "Note: Adding '%s' to ignore Path\n", optarg ); -+ element = ignorepath; -+ if ( !ignorepath ) { -+ ignorepath = xmalloc( sizeof( struct ignorepath_entry ) ); -+ ignorepath->next = 0; -+ strcpy( &ignorepath->name[0], optarg ); -+ } else { -+ while ( element->next ) element = element->next; -+ element->next = xmalloc( sizeof( struct ignorepath_entry ) ); -+ element->next->next = 0; -+ strcpy( &element->next->name[0], optarg ); -+ } -+ printf( "--------- Dumping ignore path list ----------------\n" ); -+ element = ignorepath; -+ while ( element ) { -+ printf( " * '%s'\n", &element->name[0] ); -+ element = element->next; -+ } -+ printf( "---------------------------------------------------\n" ); -+ break; -+ - case 'o': - if (out_fd != -1) { - error_msg_and_die("output filename specified more than once"); diff --git a/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2.patch b/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2.patch deleted file mode 100644 index 3ac41280bb..0000000000 --- a/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2.patch +++ /dev/null @@ -1,103 +0,0 @@ - -# -# Patch managed by http://www.holgerschurig.de/patcher.html -# - ---- mtd/util/mkfs.jffs2.c~add-exclusion-to-mkfs-jffs2.patch -+++ mtd/util/mkfs.jffs2.c -@@ -92,7 +92,12 @@ - struct filesystem_entry *files; /* Only relevant to directories */ - }; - -+struct ignorepath_entry { -+ struct ignorepath_entry* next; /* Points to the next ignorepath element */ -+ char name[PATH_MAX]; /* Name of the entry */ -+}; - -+static struct ignorepath_entry* ignorepath = 0; - static int out_fd = -1; - static int in_fd = -1; - static char default_rootdir[] = "."; -@@ -367,6 +372,7 @@ - char *hpath, *tpath; - struct dirent *dp, **namelist; - struct filesystem_entry *entry; -+ struct ignorepath_entry* element = ignorepath; - - - if (lstat(hostpath, &sb)) { -@@ -376,6 +382,15 @@ - entry = add_host_filesystem_entry(targetpath, hostpath, - sb.st_uid, sb.st_gid, sb.st_mode, 0, parent); - -+ while ( element ) { -+ if ( strcmp( element->name, targetpath ) == 0 ) { -+ printf( "Note: ignoring directories below '%s'\n", targetpath ); -+ return entry; -+ break; -+ } -+ element = element->next; -+ } -+ - n = scandir(hostpath, &namelist, 0, alphasort); - if (n < 0) { - perror_msg_and_die("opening directory %s", hostpath); -@@ -1147,6 +1162,7 @@ - {"root", 1, NULL, 'r'}, - {"pagesize", 1, NULL, 's'}, - {"eraseblock", 1, NULL, 'e'}, -+ {"ignore", 1, NULL, 'I'}, - {"output", 1, NULL, 'o'}, - {"help", 0, NULL, 'h'}, - {"verbose", 0, NULL, 'v'}, -@@ -1189,6 +1205,7 @@ - " -L, --list-compressors Show the list of the avaiable compressors\n" - " -t, --test-compression Call decompress and compare with the original (for test)\n" - " -n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock\n" -+ " -I, --ignore=PATH Ignore sub directory and file tree below PATH when recursing over the file system\n" - " -o, --output=FILE Output to FILE (default: stdout)\n" - " -l, --little-endian Create a little-endian filesystem\n" - " -b, --big-endian Create a big-endian filesystem\n" -@@ -1349,11 +1366,12 @@ - struct filesystem_entry *root; - char *compr_name = NULL; - int compr_prior = -1; -+ struct ignorepath_entry* element = ignorepath; - - jffs2_compressors_init(); - - while ((opt = getopt_long(argc, argv, -- "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) -+ "D:d:r:s:I:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) - { - switch (opt) { - case 'D': -@@ -1376,6 +1394,28 @@ - page_size = strtol(optarg, NULL, 0); - break; - -+ case 'I': -+ printf( "Note: Adding '%s' to ignore Path\n", optarg ); -+ element = ignorepath; -+ if ( !ignorepath ) { -+ ignorepath = xmalloc( sizeof( struct ignorepath_entry ) ); -+ ignorepath->next = 0; -+ strcpy( &ignorepath->name[0], optarg ); -+ } else { -+ while ( element->next ) element = element->next; -+ element->next = xmalloc( sizeof( struct ignorepath_entry ) ); -+ element->next->next = 0; -+ strcpy( &element->next->name[0], optarg ); -+ } -+ printf( "--------- Dumping ignore path list ----------------\n" ); -+ element = ignorepath; -+ while ( element ) { -+ printf( " * '%s'\n", &element->name[0] ); -+ element = element->next; -+ } -+ printf( "---------------------------------------------------\n" ); -+ break; -+ - case 'o': - if (out_fd != -1) { - error_msg_and_die("output filename specified more than once"); diff --git a/packages/mtd/mtd-utils/add_lzo.patch b/packages/mtd/mtd-utils/add_lzo.patch deleted file mode 100644 index 9afd1ca46b..0000000000 --- a/packages/mtd/mtd-utils/add_lzo.patch +++ /dev/null @@ -1,220 +0,0 @@ -Add LZO support to mtd-utils to generate LZO compressed jffs2 images - -Unlike the kernel version, the standard lzo userspace library is used -along with lzo1x_999_compress rather than the lzo1x_1_compress version -since better compression ratios can be obtained (at no significant cost -to decompression time). - -Signed-off-by: Richard Purdie <rpurdie@openedhand.com> - ---- - Makefile | 3 - - compr.c | 6 ++ - compr.h | 6 ++ - compr_lzo.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++ - include/linux/jffs2.h | 1 - 5 files changed, 135 insertions(+), 1 deletion(-) - -Index: git/Makefile -=================================================================== ---- git.orig/Makefile 2007-03-01 11:57:58.000000000 +0000 -+++ git/Makefile 2007-03-01 11:58:01.000000000 +0000 -@@ -58,8 +58,9 @@ $(BUILDDIR)/mkfs.jffs2: $(BUILDDIR)/crc3 - $(BUILDDIR)/compr_rtime.o \ - $(BUILDDIR)/mkfs.jffs2.o \ - $(BUILDDIR)/compr_zlib.o \ -+ $(BUILDDIR)/compr_lzo.o \ - $(BUILDDIR)/compr.o -- $(CC) $(LDFLAGS) -o $@ $^ -lz -+ $(CC) $(LDFLAGS) -o $@ $^ -lz -llzo - - $(BUILDDIR)/flash_eraseall: $(BUILDDIR)/crc32.o $(BUILDDIR)/flash_eraseall.o - $(CC) $(LDFLAGS) -o $@ $^ -Index: git/compr.c -=================================================================== ---- git.orig/compr.c 2007-03-01 11:57:58.000000000 +0000 -+++ git/compr.c 2007-03-01 11:58:01.000000000 +0000 -@@ -474,6 +474,9 @@ int jffs2_compressors_init(void) - #ifdef CONFIG_JFFS2_RTIME - jffs2_rtime_init(); - #endif -+#ifdef CONFIG_JFFS2_LZO -+ jffs2_lzo_init(); -+#endif - return 0; - } - -@@ -485,5 +488,8 @@ int jffs2_compressors_exit(void) - #ifdef CONFIG_JFFS2_ZLIB - jffs2_zlib_exit(); - #endif -+#ifdef CONFIG_JFFS2_LZO -+ jffs2_lzo_exit(); -+#endif - return 0; - } -Index: git/compr.h -=================================================================== ---- git.orig/compr.h 2007-03-01 11:57:58.000000000 +0000 -+++ git/compr.h 2007-03-01 11:58:01.000000000 +0000 -@@ -21,11 +21,13 @@ - - #define CONFIG_JFFS2_ZLIB - #define CONFIG_JFFS2_RTIME -+#define CONFIG_JFFS2_LZO - - #define JFFS2_RUBINMIPS_PRIORITY 10 - #define JFFS2_DYNRUBIN_PRIORITY 20 - #define JFFS2_RTIME_PRIORITY 50 - #define JFFS2_ZLIB_PRIORITY 60 -+#define JFFS2_LZO_PRIORITY 80 - - #define JFFS2_COMPR_MODE_NONE 0 - #define JFFS2_COMPR_MODE_PRIORITY 1 -@@ -111,5 +113,9 @@ void jffs2_zlib_exit(void); - int jffs2_rtime_init(void); - void jffs2_rtime_exit(void); - #endif -+#ifdef CONFIG_JFFS2_LZO -+int jffs2_lzo_init(void); -+void jffs2_lzo_exit(void); -+#endif - - #endif /* __JFFS2_COMPR_H__ */ -Index: git/compr_lzo.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ git/compr_lzo.c 2007-03-01 11:58:01.000000000 +0000 -@@ -0,0 +1,120 @@ -+/* -+ * JFFS2 LZO Compression Interface. -+ * -+ * Copyright (C) 2007 Nokia Corporation. All rights reserved. -+ * -+ * Author: Richard Purdie <rpurdie@openedhand.com> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -+ * 02110-1301 USA -+ * -+ */ -+ -+#include <stdint.h> -+#include <stdio.h> -+#include <string.h> -+#include <asm/types.h> -+#include <linux/jffs2.h> -+#include <lzo1x.h> -+#include "compr.h" -+ -+extern int page_size; -+ -+static void *lzo_mem; -+static void *lzo_compress_buf; -+ -+/* -+ * Note about LZO compression. -+ * -+ * We want to use the _999_ compression routine which gives better compression -+ * rates at the expense of time. Decompression time is unaffected. We might as -+ * well use the standard lzo library routines for this but they will overflow -+ * the destination buffer since they don't check the destination size. -+ * -+ * We therefore compress to a temporary buffer and copy if it will fit. -+ * -+ */ -+static int jffs2_lzo_cmpr(unsigned char *data_in, unsigned char *cpage_out, -+ uint32_t *sourcelen, uint32_t *dstlen, void *model) -+{ -+ uint32_t compress_size; -+ int ret; -+ -+ ret = lzo1x_999_compress(data_in, *sourcelen, lzo_compress_buf, &compress_size, lzo_mem); -+ -+ if (ret != LZO_E_OK) -+ return -1; -+ -+ if (compress_size > *dstlen) -+ return -1; -+ -+ memcpy(cpage_out, lzo_compress_buf, compress_size); -+ *dstlen = compress_size; -+ -+ return 0; -+} -+ -+static int jffs2_lzo_decompress(unsigned char *data_in, unsigned char *cpage_out, -+ uint32_t srclen, uint32_t destlen, void *model) -+{ -+ int ret; -+ uint32_t dl; -+ -+ ret = lzo1x_decompress_safe(data_in,srclen,cpage_out,&dl,NULL); -+ -+ if (ret != LZO_E_OK || dl != destlen) -+ return -1; -+ -+ return 0; -+} -+ -+static struct jffs2_compressor jffs2_lzo_comp = { -+ .priority = JFFS2_LZO_PRIORITY, -+ .name = "lzo", -+ .compr = JFFS2_COMPR_LZO, -+ .compress = &jffs2_lzo_cmpr, -+ .decompress = &jffs2_lzo_decompress, -+ .disabled = 0, -+}; -+ -+int jffs2_lzo_init(void) -+{ -+ int ret; -+ -+ lzo_mem = malloc(LZO1X_999_MEM_COMPRESS); -+ if (!lzo_mem) -+ return -1; -+ -+ /* Worse case LZO compression size from their FAQ */ -+ lzo_compress_buf = malloc(page_size + (page_size / 64) + 16 + 3); -+ if (!lzo_compress_buf) { -+ free(lzo_mem); -+ return -1; -+ } -+ -+ ret = jffs2_register_compressor(&jffs2_lzo_comp); -+ if (ret < 0) { -+ free(lzo_compress_buf); -+ free(lzo_mem); -+ } -+ -+ return ret; -+} -+ -+void jffs2_lzo_exit(void) -+{ -+ jffs2_unregister_compressor(&jffs2_lzo_comp); -+ free(lzo_compress_buf); -+ free(lzo_mem); -+} -Index: git/include/linux/jffs2.h -=================================================================== ---- git.orig/include/linux/jffs2.h 2007-03-01 11:57:58.000000000 +0000 -+++ git/include/linux/jffs2.h 2007-03-01 11:58:01.000000000 +0000 -@@ -46,6 +46,7 @@ - #define JFFS2_COMPR_COPY 0x04 - #define JFFS2_COMPR_DYNRUBIN 0x05 - #define JFFS2_COMPR_ZLIB 0x06 -+#define JFFS2_COMPR_LZO 0x07 - /* Compatibility flags. */ - #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ - #define JFFS2_NODE_ACCURATE 0x2000 diff --git a/packages/mtd/mtd-utils/favour_lzo.patch b/packages/mtd/mtd-utils/favour_lzo.patch deleted file mode 100644 index 9e55d5f4b3..0000000000 --- a/packages/mtd/mtd-utils/favour_lzo.patch +++ /dev/null @@ -1,136 +0,0 @@ -Add a favourlzo compression mode to mtd-utils - -This allows lzo compression to be used in the cases where the -compression ratio isn't quite as good zlib. This can make sense in -certain use cases because LZO decompression is much faster than zlib. - -Signed-off-by: Richard Purdie <rpurdie@openedhand.com> - ---- - compr.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- - compr.h | 1 + - 2 files changed, 50 insertions(+), 3 deletions(-) - -Index: git/compr.c -=================================================================== ---- git.orig/compr.c 2007-03-01 11:58:01.000000000 +0000 -+++ git/compr.c 2007-03-01 11:58:09.000000000 +0000 -@@ -16,6 +16,8 @@ - #include <stdlib.h> - #include <linux/jffs2.h> - -+#define FAVOUR_LZO_PERCENT 80 -+ - extern int page_size; - - /* LIST IMPLEMENTATION (from linux/list.h) */ -@@ -166,6 +168,33 @@ static void jffs2_decompression_test(str - } - } - -+/* -+ * Return 1 to use this compression -+ */ -+static int jffs2_is_best_compression(struct jffs2_compressor *this, -+ struct jffs2_compressor *best, uint32_t size, uint32_t bestsize) -+{ -+ switch (jffs2_compression_mode) { -+ case JFFS2_COMPR_MODE_SIZE: -+ if (bestsize > size) -+ return 1; -+ return 0; -+ case JFFS2_COMPR_MODE_FAVOURLZO: -+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > size)) -+ return 1; -+ if ((best->compr != JFFS2_COMPR_LZO) && (bestsize > size)) -+ return 1; -+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > (size * FAVOUR_LZO_PERCENT / 100))) -+ return 1; -+ if ((bestsize * FAVOUR_LZO_PERCENT / 100) > size) -+ return 1; -+ -+ return 0; -+ } -+ /* Shouldn't happen */ -+ return 0; -+} -+ - /* jffs2_compress: - * @data: Pointer to uncompressed data - * @cdata: Pointer to returned pointer to buffer for compressed data -@@ -231,21 +260,29 @@ uint16_t jffs2_compress( unsigned char * - } - if (ret == JFFS2_COMPR_NONE) free(output_buf); - break; -+ case JFFS2_COMPR_MODE_FAVOURLZO: - case JFFS2_COMPR_MODE_SIZE: - orig_slen = *datalen; - orig_dlen = *cdatalen; - list_for_each_entry(this, &jffs2_compressor_list, list) { -+ uint32_t needed_buf_size; -+ -+ if (jffs2_compression_mode == JFFS2_COMPR_MODE_FAVOURLZO) -+ needed_buf_size = orig_slen+jffs2_compression_check; -+ else -+ needed_buf_size = orig_dlen+jffs2_compression_check; -+ - /* Skip decompress-only backwards-compatibility and disabled modules */ - if ((!this->compress)||(this->disabled)) - continue; - /* Allocating memory for output buffer if necessary */ -- if ((this->compr_buf_size<orig_dlen+jffs2_compression_check)&&(this->compr_buf)) { -+ if ((this->compr_buf_size < needed_buf_size) && (this->compr_buf)) { - free(this->compr_buf); - this->compr_buf_size=0; - this->compr_buf=NULL; - } - if (!this->compr_buf) { -- tmp_buf = malloc(orig_dlen+jffs2_compression_check); -+ tmp_buf = malloc(needed_buf_size); - if (!tmp_buf) { - fprintf(stderr,"mkfs.jffs2: No memory for compressor allocation. (%d bytes)\n",orig_dlen); - continue; -@@ -265,7 +302,8 @@ uint16_t jffs2_compress( unsigned char * - if (!compr_ret) { - if (jffs2_compression_check) - jffs2_decompression_test(this, data_in, this->compr_buf, *cdatalen, *datalen, this->compr_buf_size); -- if ((!best_dlen)||(best_dlen>*cdatalen)) { -+ if (((!best_dlen) || jffs2_is_best_compression(this, best, *cdatalen, best_dlen)) -+ && (*cdatalen < *datalen)) { - best_dlen = *cdatalen; - best_slen = *datalen; - best = this; -@@ -377,6 +415,9 @@ char *jffs2_stats(void) - case JFFS2_COMPR_MODE_SIZE: - act_buf += sprintf(act_buf,"size"); - break; -+ case JFFS2_COMPR_MODE_FAVOURLZO: -+ act_buf += sprintf(act_buf,"favourlzo"); -+ break; - default: - act_buf += sprintf(act_buf,"unkown"); - break; -@@ -413,6 +454,11 @@ int jffs2_set_compression_mode_name(cons - jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE; - return 0; - } -+ if (!strcmp("favourlzo", name)) { -+ jffs2_compression_mode = JFFS2_COMPR_MODE_FAVOURLZO; -+ return 0; -+ } -+ - return 1; - } - -Index: git/compr.h -=================================================================== ---- git.orig/compr.h 2007-03-01 11:58:01.000000000 +0000 -+++ git/compr.h 2007-03-01 11:58:09.000000000 +0000 -@@ -32,6 +32,7 @@ - #define JFFS2_COMPR_MODE_NONE 0 - #define JFFS2_COMPR_MODE_PRIORITY 1 - #define JFFS2_COMPR_MODE_SIZE 2 -+#define JFFS2_COMPR_MODE_FAVOURLZO 3 - - #define kmalloc(a,b) malloc(a) - #define kfree(a) free(a) diff --git a/packages/mtd/mtd-utils/fix-ignoreerrors-20060131.patch b/packages/mtd/mtd-utils/fix-ignoreerrors-20060131.patch deleted file mode 100644 index 8266a37c46..0000000000 --- a/packages/mtd/mtd-utils/fix-ignoreerrors-20060131.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- mtd/util/nanddump.c.orig 2006-01-30 21:19:22.000000000 +0100 -+++ mtd/util/nanddump.c 2006-01-30 21:19:24.000000000 +0100 -@@ -224,7 +224,7 @@ - } - } - -- if (badblock) { -+ if (badblock && !ignoreerrors) { - if (omitbad) - continue; - memset (readbuf, 0xff, bs); -@@ -259,7 +259,7 @@ - if (omitoob) - continue; - -- if (badblock) { -+ if (badblock && !ignoreerrors) { - memset (readbuf, 0xff, meminfo.oobsize); - } else { - /* Read OOB data and exit on failure */ diff --git a/packages/mtd/mtd-utils/fix-ignoreerrors.patch b/packages/mtd/mtd-utils/fix-ignoreerrors.patch deleted file mode 100644 index b1f702a316..0000000000 --- a/packages/mtd/mtd-utils/fix-ignoreerrors.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- mtd/util/nanddump.c.orig 2005-12-30 19:07:39.000000000 +0100 -+++ mtd/util/nanddump.c 2005-12-30 19:08:53.000000000 +0100 -@@ -224,7 +224,7 @@ - } - } - -- if (badblock) { -+ if (badblock && !ignoreerrors) { - if (omitbad) - continue; - memset (readbuf, 0xff, bs); -@@ -259,7 +259,7 @@ - if (omitoob) - continue; - -- if (badblock) { -+ if (badblock && !ignoreerrors) { - memset (readbuf, 0xff, meminfo.oobsize); - } else { - /* Read OOB data and exit on failure */ diff --git a/packages/mtd/mtd-utils/lzo_1x.patch b/packages/mtd/mtd-utils/lzo_1x.patch new file mode 100644 index 0000000000..b882d9f504 --- /dev/null +++ b/packages/mtd/mtd-utils/lzo_1x.patch @@ -0,0 +1,26 @@ +Index: git/Makefile +=================================================================== +--- git.orig/Makefile ++++ git/Makefile +@@ -60,7 +60,7 @@ $(BUILDDIR)/mkfs.jffs2: $(BUILDDIR)/crc3 + $(BUILDDIR)/compr_zlib.o \ + $(BUILDDIR)/compr_lzo.o \ + $(BUILDDIR)/compr.o +- $(CC) $(LDFLAGS) -o $@ $^ -lz -llzo2 ++ $(CC) $(LDFLAGS) -o $@ $^ -lz -llzo + + $(BUILDDIR)/flash_eraseall: $(BUILDDIR)/crc32.o $(BUILDDIR)/flash_eraseall.o + $(CC) $(LDFLAGS) -o $@ $^ +Index: git/compr_lzo.c +=================================================================== +--- git.orig/compr_lzo.c ++++ git/compr_lzo.c +@@ -26,7 +26,7 @@ + #include <string.h> + #include <asm/types.h> + #include <linux/jffs2.h> +-#include <lzo/lzo1x.h> ++#include <lzo1x.h> + #include "compr.h" + + extern int page_size; |