diff options
Diffstat (limited to 'meta/packages/mtd')
-rw-r--r-- | meta/packages/mtd/mtd-utils-native.inc | 10 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils-native_0.0.0+cvs20060223.bb | 12 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils-native_1.0.0+git.bb | 2 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils-native_1.0.0.bb | 2 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch | 106 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils/add_lzo.patch | 220 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils/favour_lzo.patch | 136 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils/fix-ignoreerrors-git.patch | 26 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils_0.0.0+cvs20060223.bb | 3 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils_1.0.0+git.bb | 39 | ||||
-rw-r--r-- | meta/packages/mtd/mtd-utils_1.0.0.bb | 19 |
11 files changed, 564 insertions, 11 deletions
diff --git a/meta/packages/mtd/mtd-utils-native.inc b/meta/packages/mtd/mtd-utils-native.inc new file mode 100644 index 0000000000..edccb2bb5d --- /dev/null +++ b/meta/packages/mtd/mtd-utils-native.inc | |||
@@ -0,0 +1,10 @@ | |||
1 | inherit native | ||
2 | DEPENDS = "zlib-native" | ||
3 | FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/mtd-utils" | ||
4 | |||
5 | do_stage () { | ||
6 | for binary in ${mtd_utils}; do | ||
7 | install -m 0755 $binary ${STAGING_BINDIR} | ||
8 | done | ||
9 | } | ||
10 | \ No newline at end of file | ||
diff --git a/meta/packages/mtd/mtd-utils-native_0.0.0+cvs20060223.bb b/meta/packages/mtd/mtd-utils-native_0.0.0+cvs20060223.bb index ac060ecef2..6f9d71e10c 100644 --- a/meta/packages/mtd/mtd-utils-native_0.0.0+cvs20060223.bb +++ b/meta/packages/mtd/mtd-utils-native_0.0.0+cvs20060223.bb | |||
@@ -1,12 +1,2 @@ | |||
1 | LICENSE = "GPLv2" | ||
2 | SECTION = "base" | ||
3 | require mtd-utils_${PV}.bb | 1 | require mtd-utils_${PV}.bb |
4 | inherit native | 2 | require mtd-utils-native.inc |
5 | DEPENDS = "zlib-native" | ||
6 | FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/mtd-utils" | ||
7 | |||
8 | do_stage () { | ||
9 | for binary in ${mtd_utils}; do | ||
10 | install -m 0755 util/$binary ${STAGING_BINDIR}/ | ||
11 | done | ||
12 | } | ||
diff --git a/meta/packages/mtd/mtd-utils-native_1.0.0+git.bb b/meta/packages/mtd/mtd-utils-native_1.0.0+git.bb new file mode 100644 index 0000000000..6f9d71e10c --- /dev/null +++ b/meta/packages/mtd/mtd-utils-native_1.0.0+git.bb | |||
@@ -0,0 +1,2 @@ | |||
1 | require mtd-utils_${PV}.bb | ||
2 | require mtd-utils-native.inc | ||
diff --git a/meta/packages/mtd/mtd-utils-native_1.0.0.bb b/meta/packages/mtd/mtd-utils-native_1.0.0.bb new file mode 100644 index 0000000000..6f9d71e10c --- /dev/null +++ b/meta/packages/mtd/mtd-utils-native_1.0.0.bb | |||
@@ -0,0 +1,2 @@ | |||
1 | require mtd-utils_${PV}.bb | ||
2 | require mtd-utils-native.inc | ||
diff --git a/meta/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch b/meta/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch new file mode 100644 index 0000000000..5504a11e8a --- /dev/null +++ b/meta/packages/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch | |||
@@ -0,0 +1,106 @@ | |||
1 | --- | ||
2 | mkfs.jffs2.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- | ||
3 | 1 file changed, 42 insertions(+), 3 deletions(-) | ||
4 | |||
5 | Index: git/mkfs.jffs2.c | ||
6 | =================================================================== | ||
7 | --- git.orig/mkfs.jffs2.c 2007-01-23 15:42:34.000000000 +0000 | ||
8 | +++ git/mkfs.jffs2.c 2007-01-23 15:46:08.000000000 +0000 | ||
9 | @@ -97,7 +97,12 @@ struct filesystem_entry { | ||
10 | struct filesystem_entry *files; /* Only relevant to directories */ | ||
11 | }; | ||
12 | |||
13 | - | ||
14 | +struct ignorepath_entry { | ||
15 | + struct ignorepath_entry* next; /* Points to the next ignorepath element */ | ||
16 | + char name[PATH_MAX]; /* Name of the entry */ | ||
17 | +}; | ||
18 | + | ||
19 | +static struct ignorepath_entry* ignorepath = 0; | ||
20 | static int out_fd = -1; | ||
21 | static int in_fd = -1; | ||
22 | static char default_rootdir[] = "."; | ||
23 | @@ -372,7 +377,7 @@ static struct filesystem_entry *recursiv | ||
24 | char *hpath, *tpath; | ||
25 | struct dirent *dp, **namelist; | ||
26 | struct filesystem_entry *entry; | ||
27 | - | ||
28 | + struct ignorepath_entry* element = ignorepath; | ||
29 | |||
30 | if (lstat(hostpath, &sb)) { | ||
31 | perror_msg_and_die("%s", hostpath); | ||
32 | @@ -381,6 +386,15 @@ static struct filesystem_entry *recursiv | ||
33 | entry = add_host_filesystem_entry(targetpath, hostpath, | ||
34 | sb.st_uid, sb.st_gid, sb.st_mode, 0, parent); | ||
35 | |||
36 | + while ( element ) { | ||
37 | + if ( strcmp( element->name, targetpath ) == 0 ) { | ||
38 | + printf( "Note: ignoring directories below '%s'\n", targetpath ); | ||
39 | + return entry; | ||
40 | + break; | ||
41 | + } | ||
42 | + element = element->next; | ||
43 | + } | ||
44 | + | ||
45 | n = scandir(hostpath, &namelist, 0, alphasort); | ||
46 | if (n < 0) { | ||
47 | perror_msg_and_die("opening directory %s", hostpath); | ||
48 | @@ -1405,6 +1419,7 @@ static struct option long_options[] = { | ||
49 | {"root", 1, NULL, 'r'}, | ||
50 | {"pagesize", 1, NULL, 's'}, | ||
51 | {"eraseblock", 1, NULL, 'e'}, | ||
52 | + {"ignore", 1, NULL, 'I'}, | ||
53 | {"output", 1, NULL, 'o'}, | ||
54 | {"help", 0, NULL, 'h'}, | ||
55 | {"verbose", 0, NULL, 'v'}, | ||
56 | @@ -1452,6 +1467,7 @@ static char *helptext = | ||
57 | " -L, --list-compressors Show the list of the avaiable compressors\n" | ||
58 | " -t, --test-compression Call decompress and compare with the original (for test)\n" | ||
59 | " -n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock\n" | ||
60 | +" -I, --ignore=PATH Ignore sub directory and file tree below PATH when recursing over the file system\n" | ||
61 | " -o, --output=FILE Output to FILE (default: stdout)\n" | ||
62 | " -l, --little-endian Create a little-endian filesystem\n" | ||
63 | " -b, --big-endian Create a big-endian filesystem\n" | ||
64 | @@ -1617,11 +1633,12 @@ int main(int argc, char **argv) | ||
65 | struct filesystem_entry *root; | ||
66 | char *compr_name = NULL; | ||
67 | int compr_prior = -1; | ||
68 | + struct ignorepath_entry* element = ignorepath; | ||
69 | |||
70 | jffs2_compressors_init(); | ||
71 | |||
72 | while ((opt = getopt_long(argc, argv, | ||
73 | - "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) | ||
74 | + "D:d:r:s:I:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) | ||
75 | { | ||
76 | switch (opt) { | ||
77 | case 'D': | ||
78 | @@ -1644,6 +1661,28 @@ int main(int argc, char **argv) | ||
79 | page_size = strtol(optarg, NULL, 0); | ||
80 | break; | ||
81 | |||
82 | + case 'I': | ||
83 | + printf( "Note: Adding '%s' to ignore Path\n", optarg ); | ||
84 | + element = ignorepath; | ||
85 | + if ( !ignorepath ) { | ||
86 | + ignorepath = xmalloc( sizeof( struct ignorepath_entry ) ); | ||
87 | + ignorepath->next = 0; | ||
88 | + strcpy( &ignorepath->name[0], optarg ); | ||
89 | + } else { | ||
90 | + while ( element->next ) element = element->next; | ||
91 | + element->next = xmalloc( sizeof( struct ignorepath_entry ) ); | ||
92 | + element->next->next = 0; | ||
93 | + strcpy( &element->next->name[0], optarg ); | ||
94 | + } | ||
95 | + printf( "--------- Dumping ignore path list ----------------\n" ); | ||
96 | + element = ignorepath; | ||
97 | + while ( element ) { | ||
98 | + printf( " * '%s'\n", &element->name[0] ); | ||
99 | + element = element->next; | ||
100 | + } | ||
101 | + printf( "---------------------------------------------------\n" ); | ||
102 | + break; | ||
103 | + | ||
104 | case 'o': | ||
105 | if (out_fd != -1) { | ||
106 | error_msg_and_die("output filename specified more than once"); | ||
diff --git a/meta/packages/mtd/mtd-utils/add_lzo.patch b/meta/packages/mtd/mtd-utils/add_lzo.patch new file mode 100644 index 0000000000..9afd1ca46b --- /dev/null +++ b/meta/packages/mtd/mtd-utils/add_lzo.patch | |||
@@ -0,0 +1,220 @@ | |||
1 | Add LZO support to mtd-utils to generate LZO compressed jffs2 images | ||
2 | |||
3 | Unlike the kernel version, the standard lzo userspace library is used | ||
4 | along with lzo1x_999_compress rather than the lzo1x_1_compress version | ||
5 | since better compression ratios can be obtained (at no significant cost | ||
6 | to decompression time). | ||
7 | |||
8 | Signed-off-by: Richard Purdie <rpurdie@openedhand.com> | ||
9 | |||
10 | --- | ||
11 | Makefile | 3 - | ||
12 | compr.c | 6 ++ | ||
13 | compr.h | 6 ++ | ||
14 | compr_lzo.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
15 | include/linux/jffs2.h | 1 | ||
16 | 5 files changed, 135 insertions(+), 1 deletion(-) | ||
17 | |||
18 | Index: git/Makefile | ||
19 | =================================================================== | ||
20 | --- git.orig/Makefile 2007-03-01 11:57:58.000000000 +0000 | ||
21 | +++ git/Makefile 2007-03-01 11:58:01.000000000 +0000 | ||
22 | @@ -58,8 +58,9 @@ $(BUILDDIR)/mkfs.jffs2: $(BUILDDIR)/crc3 | ||
23 | $(BUILDDIR)/compr_rtime.o \ | ||
24 | $(BUILDDIR)/mkfs.jffs2.o \ | ||
25 | $(BUILDDIR)/compr_zlib.o \ | ||
26 | + $(BUILDDIR)/compr_lzo.o \ | ||
27 | $(BUILDDIR)/compr.o | ||
28 | - $(CC) $(LDFLAGS) -o $@ $^ -lz | ||
29 | + $(CC) $(LDFLAGS) -o $@ $^ -lz -llzo | ||
30 | |||
31 | $(BUILDDIR)/flash_eraseall: $(BUILDDIR)/crc32.o $(BUILDDIR)/flash_eraseall.o | ||
32 | $(CC) $(LDFLAGS) -o $@ $^ | ||
33 | Index: git/compr.c | ||
34 | =================================================================== | ||
35 | --- git.orig/compr.c 2007-03-01 11:57:58.000000000 +0000 | ||
36 | +++ git/compr.c 2007-03-01 11:58:01.000000000 +0000 | ||
37 | @@ -474,6 +474,9 @@ int jffs2_compressors_init(void) | ||
38 | #ifdef CONFIG_JFFS2_RTIME | ||
39 | jffs2_rtime_init(); | ||
40 | #endif | ||
41 | +#ifdef CONFIG_JFFS2_LZO | ||
42 | + jffs2_lzo_init(); | ||
43 | +#endif | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | @@ -485,5 +488,8 @@ int jffs2_compressors_exit(void) | ||
48 | #ifdef CONFIG_JFFS2_ZLIB | ||
49 | jffs2_zlib_exit(); | ||
50 | #endif | ||
51 | +#ifdef CONFIG_JFFS2_LZO | ||
52 | + jffs2_lzo_exit(); | ||
53 | +#endif | ||
54 | return 0; | ||
55 | } | ||
56 | Index: git/compr.h | ||
57 | =================================================================== | ||
58 | --- git.orig/compr.h 2007-03-01 11:57:58.000000000 +0000 | ||
59 | +++ git/compr.h 2007-03-01 11:58:01.000000000 +0000 | ||
60 | @@ -21,11 +21,13 @@ | ||
61 | |||
62 | #define CONFIG_JFFS2_ZLIB | ||
63 | #define CONFIG_JFFS2_RTIME | ||
64 | +#define CONFIG_JFFS2_LZO | ||
65 | |||
66 | #define JFFS2_RUBINMIPS_PRIORITY 10 | ||
67 | #define JFFS2_DYNRUBIN_PRIORITY 20 | ||
68 | #define JFFS2_RTIME_PRIORITY 50 | ||
69 | #define JFFS2_ZLIB_PRIORITY 60 | ||
70 | +#define JFFS2_LZO_PRIORITY 80 | ||
71 | |||
72 | #define JFFS2_COMPR_MODE_NONE 0 | ||
73 | #define JFFS2_COMPR_MODE_PRIORITY 1 | ||
74 | @@ -111,5 +113,9 @@ void jffs2_zlib_exit(void); | ||
75 | int jffs2_rtime_init(void); | ||
76 | void jffs2_rtime_exit(void); | ||
77 | #endif | ||
78 | +#ifdef CONFIG_JFFS2_LZO | ||
79 | +int jffs2_lzo_init(void); | ||
80 | +void jffs2_lzo_exit(void); | ||
81 | +#endif | ||
82 | |||
83 | #endif /* __JFFS2_COMPR_H__ */ | ||
84 | Index: git/compr_lzo.c | ||
85 | =================================================================== | ||
86 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
87 | +++ git/compr_lzo.c 2007-03-01 11:58:01.000000000 +0000 | ||
88 | @@ -0,0 +1,120 @@ | ||
89 | +/* | ||
90 | + * JFFS2 LZO Compression Interface. | ||
91 | + * | ||
92 | + * Copyright (C) 2007 Nokia Corporation. All rights reserved. | ||
93 | + * | ||
94 | + * Author: Richard Purdie <rpurdie@openedhand.com> | ||
95 | + * | ||
96 | + * This program is free software; you can redistribute it and/or | ||
97 | + * modify it under the terms of the GNU General Public License | ||
98 | + * version 2 as published by the Free Software Foundation. | ||
99 | + * | ||
100 | + * This program is distributed in the hope that it will be useful, but | ||
101 | + * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
102 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
103 | + * General Public License for more details. | ||
104 | + * | ||
105 | + * You should have received a copy of the GNU General Public License | ||
106 | + * along with this program; if not, write to the Free Software | ||
107 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
108 | + * 02110-1301 USA | ||
109 | + * | ||
110 | + */ | ||
111 | + | ||
112 | +#include <stdint.h> | ||
113 | +#include <stdio.h> | ||
114 | +#include <string.h> | ||
115 | +#include <asm/types.h> | ||
116 | +#include <linux/jffs2.h> | ||
117 | +#include <lzo1x.h> | ||
118 | +#include "compr.h" | ||
119 | + | ||
120 | +extern int page_size; | ||
121 | + | ||
122 | +static void *lzo_mem; | ||
123 | +static void *lzo_compress_buf; | ||
124 | + | ||
125 | +/* | ||
126 | + * Note about LZO compression. | ||
127 | + * | ||
128 | + * We want to use the _999_ compression routine which gives better compression | ||
129 | + * rates at the expense of time. Decompression time is unaffected. We might as | ||
130 | + * well use the standard lzo library routines for this but they will overflow | ||
131 | + * the destination buffer since they don't check the destination size. | ||
132 | + * | ||
133 | + * We therefore compress to a temporary buffer and copy if it will fit. | ||
134 | + * | ||
135 | + */ | ||
136 | +static int jffs2_lzo_cmpr(unsigned char *data_in, unsigned char *cpage_out, | ||
137 | + uint32_t *sourcelen, uint32_t *dstlen, void *model) | ||
138 | +{ | ||
139 | + uint32_t compress_size; | ||
140 | + int ret; | ||
141 | + | ||
142 | + ret = lzo1x_999_compress(data_in, *sourcelen, lzo_compress_buf, &compress_size, lzo_mem); | ||
143 | + | ||
144 | + if (ret != LZO_E_OK) | ||
145 | + return -1; | ||
146 | + | ||
147 | + if (compress_size > *dstlen) | ||
148 | + return -1; | ||
149 | + | ||
150 | + memcpy(cpage_out, lzo_compress_buf, compress_size); | ||
151 | + *dstlen = compress_size; | ||
152 | + | ||
153 | + return 0; | ||
154 | +} | ||
155 | + | ||
156 | +static int jffs2_lzo_decompress(unsigned char *data_in, unsigned char *cpage_out, | ||
157 | + uint32_t srclen, uint32_t destlen, void *model) | ||
158 | +{ | ||
159 | + int ret; | ||
160 | + uint32_t dl; | ||
161 | + | ||
162 | + ret = lzo1x_decompress_safe(data_in,srclen,cpage_out,&dl,NULL); | ||
163 | + | ||
164 | + if (ret != LZO_E_OK || dl != destlen) | ||
165 | + return -1; | ||
166 | + | ||
167 | + return 0; | ||
168 | +} | ||
169 | + | ||
170 | +static struct jffs2_compressor jffs2_lzo_comp = { | ||
171 | + .priority = JFFS2_LZO_PRIORITY, | ||
172 | + .name = "lzo", | ||
173 | + .compr = JFFS2_COMPR_LZO, | ||
174 | + .compress = &jffs2_lzo_cmpr, | ||
175 | + .decompress = &jffs2_lzo_decompress, | ||
176 | + .disabled = 0, | ||
177 | +}; | ||
178 | + | ||
179 | +int jffs2_lzo_init(void) | ||
180 | +{ | ||
181 | + int ret; | ||
182 | + | ||
183 | + lzo_mem = malloc(LZO1X_999_MEM_COMPRESS); | ||
184 | + if (!lzo_mem) | ||
185 | + return -1; | ||
186 | + | ||
187 | + /* Worse case LZO compression size from their FAQ */ | ||
188 | + lzo_compress_buf = malloc(page_size + (page_size / 64) + 16 + 3); | ||
189 | + if (!lzo_compress_buf) { | ||
190 | + free(lzo_mem); | ||
191 | + return -1; | ||
192 | + } | ||
193 | + | ||
194 | + ret = jffs2_register_compressor(&jffs2_lzo_comp); | ||
195 | + if (ret < 0) { | ||
196 | + free(lzo_compress_buf); | ||
197 | + free(lzo_mem); | ||
198 | + } | ||
199 | + | ||
200 | + return ret; | ||
201 | +} | ||
202 | + | ||
203 | +void jffs2_lzo_exit(void) | ||
204 | +{ | ||
205 | + jffs2_unregister_compressor(&jffs2_lzo_comp); | ||
206 | + free(lzo_compress_buf); | ||
207 | + free(lzo_mem); | ||
208 | +} | ||
209 | Index: git/include/linux/jffs2.h | ||
210 | =================================================================== | ||
211 | --- git.orig/include/linux/jffs2.h 2007-03-01 11:57:58.000000000 +0000 | ||
212 | +++ git/include/linux/jffs2.h 2007-03-01 11:58:01.000000000 +0000 | ||
213 | @@ -46,6 +46,7 @@ | ||
214 | #define JFFS2_COMPR_COPY 0x04 | ||
215 | #define JFFS2_COMPR_DYNRUBIN 0x05 | ||
216 | #define JFFS2_COMPR_ZLIB 0x06 | ||
217 | +#define JFFS2_COMPR_LZO 0x07 | ||
218 | /* Compatibility flags. */ | ||
219 | #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ | ||
220 | #define JFFS2_NODE_ACCURATE 0x2000 | ||
diff --git a/meta/packages/mtd/mtd-utils/favour_lzo.patch b/meta/packages/mtd/mtd-utils/favour_lzo.patch new file mode 100644 index 0000000000..9e55d5f4b3 --- /dev/null +++ b/meta/packages/mtd/mtd-utils/favour_lzo.patch | |||
@@ -0,0 +1,136 @@ | |||
1 | Add a favourlzo compression mode to mtd-utils | ||
2 | |||
3 | This allows lzo compression to be used in the cases where the | ||
4 | compression ratio isn't quite as good zlib. This can make sense in | ||
5 | certain use cases because LZO decompression is much faster than zlib. | ||
6 | |||
7 | Signed-off-by: Richard Purdie <rpurdie@openedhand.com> | ||
8 | |||
9 | --- | ||
10 | compr.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- | ||
11 | compr.h | 1 + | ||
12 | 2 files changed, 50 insertions(+), 3 deletions(-) | ||
13 | |||
14 | Index: git/compr.c | ||
15 | =================================================================== | ||
16 | --- git.orig/compr.c 2007-03-01 11:58:01.000000000 +0000 | ||
17 | +++ git/compr.c 2007-03-01 11:58:09.000000000 +0000 | ||
18 | @@ -16,6 +16,8 @@ | ||
19 | #include <stdlib.h> | ||
20 | #include <linux/jffs2.h> | ||
21 | |||
22 | +#define FAVOUR_LZO_PERCENT 80 | ||
23 | + | ||
24 | extern int page_size; | ||
25 | |||
26 | /* LIST IMPLEMENTATION (from linux/list.h) */ | ||
27 | @@ -166,6 +168,33 @@ static void jffs2_decompression_test(str | ||
28 | } | ||
29 | } | ||
30 | |||
31 | +/* | ||
32 | + * Return 1 to use this compression | ||
33 | + */ | ||
34 | +static int jffs2_is_best_compression(struct jffs2_compressor *this, | ||
35 | + struct jffs2_compressor *best, uint32_t size, uint32_t bestsize) | ||
36 | +{ | ||
37 | + switch (jffs2_compression_mode) { | ||
38 | + case JFFS2_COMPR_MODE_SIZE: | ||
39 | + if (bestsize > size) | ||
40 | + return 1; | ||
41 | + return 0; | ||
42 | + case JFFS2_COMPR_MODE_FAVOURLZO: | ||
43 | + if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > size)) | ||
44 | + return 1; | ||
45 | + if ((best->compr != JFFS2_COMPR_LZO) && (bestsize > size)) | ||
46 | + return 1; | ||
47 | + if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > (size * FAVOUR_LZO_PERCENT / 100))) | ||
48 | + return 1; | ||
49 | + if ((bestsize * FAVOUR_LZO_PERCENT / 100) > size) | ||
50 | + return 1; | ||
51 | + | ||
52 | + return 0; | ||
53 | + } | ||
54 | + /* Shouldn't happen */ | ||
55 | + return 0; | ||
56 | +} | ||
57 | + | ||
58 | /* jffs2_compress: | ||
59 | * @data: Pointer to uncompressed data | ||
60 | * @cdata: Pointer to returned pointer to buffer for compressed data | ||
61 | @@ -231,21 +260,29 @@ uint16_t jffs2_compress( unsigned char * | ||
62 | } | ||
63 | if (ret == JFFS2_COMPR_NONE) free(output_buf); | ||
64 | break; | ||
65 | + case JFFS2_COMPR_MODE_FAVOURLZO: | ||
66 | case JFFS2_COMPR_MODE_SIZE: | ||
67 | orig_slen = *datalen; | ||
68 | orig_dlen = *cdatalen; | ||
69 | list_for_each_entry(this, &jffs2_compressor_list, list) { | ||
70 | + uint32_t needed_buf_size; | ||
71 | + | ||
72 | + if (jffs2_compression_mode == JFFS2_COMPR_MODE_FAVOURLZO) | ||
73 | + needed_buf_size = orig_slen+jffs2_compression_check; | ||
74 | + else | ||
75 | + needed_buf_size = orig_dlen+jffs2_compression_check; | ||
76 | + | ||
77 | /* Skip decompress-only backwards-compatibility and disabled modules */ | ||
78 | if ((!this->compress)||(this->disabled)) | ||
79 | continue; | ||
80 | /* Allocating memory for output buffer if necessary */ | ||
81 | - if ((this->compr_buf_size<orig_dlen+jffs2_compression_check)&&(this->compr_buf)) { | ||
82 | + if ((this->compr_buf_size < needed_buf_size) && (this->compr_buf)) { | ||
83 | free(this->compr_buf); | ||
84 | this->compr_buf_size=0; | ||
85 | this->compr_buf=NULL; | ||
86 | } | ||
87 | if (!this->compr_buf) { | ||
88 | - tmp_buf = malloc(orig_dlen+jffs2_compression_check); | ||
89 | + tmp_buf = malloc(needed_buf_size); | ||
90 | if (!tmp_buf) { | ||
91 | fprintf(stderr,"mkfs.jffs2: No memory for compressor allocation. (%d bytes)\n",orig_dlen); | ||
92 | continue; | ||
93 | @@ -265,7 +302,8 @@ uint16_t jffs2_compress( unsigned char * | ||
94 | if (!compr_ret) { | ||
95 | if (jffs2_compression_check) | ||
96 | jffs2_decompression_test(this, data_in, this->compr_buf, *cdatalen, *datalen, this->compr_buf_size); | ||
97 | - if ((!best_dlen)||(best_dlen>*cdatalen)) { | ||
98 | + if (((!best_dlen) || jffs2_is_best_compression(this, best, *cdatalen, best_dlen)) | ||
99 | + && (*cdatalen < *datalen)) { | ||
100 | best_dlen = *cdatalen; | ||
101 | best_slen = *datalen; | ||
102 | best = this; | ||
103 | @@ -377,6 +415,9 @@ char *jffs2_stats(void) | ||
104 | case JFFS2_COMPR_MODE_SIZE: | ||
105 | act_buf += sprintf(act_buf,"size"); | ||
106 | break; | ||
107 | + case JFFS2_COMPR_MODE_FAVOURLZO: | ||
108 | + act_buf += sprintf(act_buf,"favourlzo"); | ||
109 | + break; | ||
110 | default: | ||
111 | act_buf += sprintf(act_buf,"unkown"); | ||
112 | break; | ||
113 | @@ -413,6 +454,11 @@ int jffs2_set_compression_mode_name(cons | ||
114 | jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE; | ||
115 | return 0; | ||
116 | } | ||
117 | + if (!strcmp("favourlzo", name)) { | ||
118 | + jffs2_compression_mode = JFFS2_COMPR_MODE_FAVOURLZO; | ||
119 | + return 0; | ||
120 | + } | ||
121 | + | ||
122 | return 1; | ||
123 | } | ||
124 | |||
125 | Index: git/compr.h | ||
126 | =================================================================== | ||
127 | --- git.orig/compr.h 2007-03-01 11:58:01.000000000 +0000 | ||
128 | +++ git/compr.h 2007-03-01 11:58:09.000000000 +0000 | ||
129 | @@ -32,6 +32,7 @@ | ||
130 | #define JFFS2_COMPR_MODE_NONE 0 | ||
131 | #define JFFS2_COMPR_MODE_PRIORITY 1 | ||
132 | #define JFFS2_COMPR_MODE_SIZE 2 | ||
133 | +#define JFFS2_COMPR_MODE_FAVOURLZO 3 | ||
134 | |||
135 | #define kmalloc(a,b) malloc(a) | ||
136 | #define kfree(a) free(a) | ||
diff --git a/meta/packages/mtd/mtd-utils/fix-ignoreerrors-git.patch b/meta/packages/mtd/mtd-utils/fix-ignoreerrors-git.patch new file mode 100644 index 0000000000..bec60a18c1 --- /dev/null +++ b/meta/packages/mtd/mtd-utils/fix-ignoreerrors-git.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | --- | ||
2 | nanddump.c | 4 ++-- | ||
3 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
4 | |||
5 | Index: git/nanddump.c | ||
6 | =================================================================== | ||
7 | --- git.orig/nanddump.c 2007-01-23 15:42:34.000000000 +0000 | ||
8 | +++ git/nanddump.c 2007-01-23 15:47:57.000000000 +0000 | ||
9 | @@ -281,7 +281,7 @@ int main(int argc, char **argv) | ||
10 | } | ||
11 | } | ||
12 | |||
13 | - if (badblock) { | ||
14 | + if (badblock && !ignoreerrors) { | ||
15 | if (omitbad) | ||
16 | continue; | ||
17 | memset (readbuf, 0xff, bs); | ||
18 | @@ -335,7 +335,7 @@ int main(int argc, char **argv) | ||
19 | if (omitoob) | ||
20 | continue; | ||
21 | |||
22 | - if (badblock) { | ||
23 | + if (badblock && !ignoreerrors) { | ||
24 | memset (readbuf, 0xff, meminfo.oobsize); | ||
25 | } else { | ||
26 | /* Read OOB data and exit on failure */ | ||
diff --git a/meta/packages/mtd/mtd-utils_0.0.0+cvs20060223.bb b/meta/packages/mtd/mtd-utils_0.0.0+cvs20060223.bb index 50e4dc184f..96199f1602 100644 --- a/meta/packages/mtd/mtd-utils_0.0.0+cvs20060223.bb +++ b/meta/packages/mtd/mtd-utils_0.0.0+cvs20060223.bb | |||
@@ -22,6 +22,9 @@ do_stage () { | |||
22 | for f in ${S}/include/mtd/*.h; do | 22 | for f in ${S}/include/mtd/*.h; do |
23 | install -m 0644 $f ${STAGING_INCDIR}/mtd/ | 23 | install -m 0644 $f ${STAGING_INCDIR}/mtd/ |
24 | done | 24 | done |
25 | for binary in ${mtd_utils}; do | ||
26 | install -m 0755 util/$binary ${STAGING_BINDIR} | ||
27 | done | ||
25 | } | 28 | } |
26 | 29 | ||
27 | mtd_utils = "ftl_format flash_erase flash_eraseall nanddump doc_loadbios \ | 30 | mtd_utils = "ftl_format flash_erase flash_eraseall nanddump doc_loadbios \ |
diff --git a/meta/packages/mtd/mtd-utils_1.0.0+git.bb b/meta/packages/mtd/mtd-utils_1.0.0+git.bb new file mode 100644 index 0000000000..e15a40046f --- /dev/null +++ b/meta/packages/mtd/mtd-utils_1.0.0+git.bb | |||
@@ -0,0 +1,39 @@ | |||
1 | DESCRIPTION = "Tools for managing memory technology devices." | ||
2 | SECTION = "base" | ||
3 | DEPENDS = "zlib" | ||
4 | HOMEPAGE = "http://www.linux-mtd.infradead.org/" | ||
5 | LICENSE = "GPLv2" | ||
6 | PR = "r1" | ||
7 | |||
8 | SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=master \ | ||
9 | file://add_lzo.patch;patch=1 \ | ||
10 | file://favour_lzo.patch;patch=1 \ | ||
11 | file://add-exclusion-to-mkfs-jffs2-git.patch;patch=1 \ | ||
12 | file://fix-ignoreerrors-git.patch;patch=1" | ||
13 | |||
14 | S = "${WORKDIR}/git/" | ||
15 | |||
16 | EXTRA_OEMAKE = "WITHOUT_XATTR=1" | ||
17 | |||
18 | #CFLAGS_prepend = "-I${S}/include " | ||
19 | |||
20 | do_stage () { | ||
21 | install -d ${STAGING_INCDIR}/mtd | ||
22 | for f in ${S}/include/mtd/*.h; do | ||
23 | install -m 0644 $f ${STAGING_INCDIR}/mtd/ | ||
24 | done | ||
25 | for binary in ${mtd_utils}; do | ||
26 | install -m 0755 $binary ${STAGING_BINDIR} | ||
27 | done | ||
28 | } | ||
29 | |||
30 | mtd_utils = "ftl_format flash_erase flash_eraseall nanddump doc_loadbios \ | ||
31 | mkfs.jffs ftl_check mkfs.jffs2 flash_lock flash_unlock flash_info mtd_debug \ | ||
32 | flashcp nandwrite jffs2dump sumtool" | ||
33 | |||
34 | do_install () { | ||
35 | install -d ${D}${bindir} | ||
36 | for binary in ${mtd_utils}; do | ||
37 | install -m 0755 $binary ${D}${bindir} | ||
38 | done | ||
39 | } | ||
diff --git a/meta/packages/mtd/mtd-utils_1.0.0.bb b/meta/packages/mtd/mtd-utils_1.0.0.bb new file mode 100644 index 0000000000..0ebb47fb22 --- /dev/null +++ b/meta/packages/mtd/mtd-utils_1.0.0.bb | |||
@@ -0,0 +1,19 @@ | |||
1 | DESCRIPTION = "Tools for managing memory technology devices." | ||
2 | SECTION = "base" | ||
3 | DEPENDS = "zlib" | ||
4 | HOMEPAGE = "http://www.linux-mtd.infradead.org/" | ||
5 | LICENSE = "GPLv2" | ||
6 | PR = "r0" | ||
7 | |||
8 | # RP/kergoth: Builds seem to break with recent mtd-utils | ||
9 | # Can't pin down the exact problems | ||
10 | DEFAULT_PREFERENCE = "-1" | ||
11 | |||
12 | SRC_URI = "ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-1.0.0.tar.gz" | ||
13 | S = "${WORKDIR}/mtd-utils-${PV}" | ||
14 | |||
15 | CFLAGS_prepend = "-I${WORKDIR}/mtd-utils-${PV}/include " | ||
16 | |||
17 | do_install() { | ||
18 | oe_runmake install DESTDIR=${D} | ||
19 | } | ||