summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorSaul Wold <sgw@linux.intel.com>2011-05-13 17:43:12 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-18 14:32:43 +0100
commit7aabd71d0a84c689f747eab95a4e8370ff35889f (patch)
tree92d8755f82486ce9527b92437106982b3d691062 /meta
parent8fdd65f9977e5dc46bba208b9085a0b14ed7098b (diff)
downloadpoky-7aabd71d0a84c689f747eab95a4e8370ff35889f.tar.gz
yaffs2: Remove yaffs2 from oe-core
Move to meta-extras Also remove yaffs2 from image_types.bbclass (From OE-Core rev: 6a97657ae834945ae26e5933d29bd94d0f7fea67) Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/image_types.bbclass3
-rw-r--r--meta/recipes-devtools/yaffs2/files/mkyaffs2image.patch351
-rw-r--r--meta/recipes-devtools/yaffs2/files/yaffs2-unioob.patch218
-rw-r--r--meta/recipes-devtools/yaffs2/yaffs2-utils.inc28
-rw-r--r--meta/recipes-devtools/yaffs2/yaffs2-utils_cvs.bb4
5 files changed, 0 insertions, 604 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index f23c1f5710..ec0cafd87b 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -21,7 +21,6 @@ runimagecmd () {
21} 21}
22 22
23IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}" 23IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}"
24IMAGE_CMD_yaffs2 = "mkyaffs2image ${EXTRA_IMAGECMD} ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.yaffs2"
25IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}" 24IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}"
26IMAGE_CMD_ext2 = "genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${EXTRA_IMAGECMD} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2" 25IMAGE_CMD_ext2 = "genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${EXTRA_IMAGECMD} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2"
27IMAGE_CMD_ext2.gz () { 26IMAGE_CMD_ext2.gz () {
@@ -64,7 +63,6 @@ IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_
64 63
65EXTRA_IMAGECMD = "" 64EXTRA_IMAGECMD = ""
66EXTRA_IMAGECMD_jffs2 ?= "--pad --little-endian --eraseblock=0x40000" 65EXTRA_IMAGECMD_jffs2 ?= "--pad --little-endian --eraseblock=0x40000"
67EXTRA_IMAGECMD_yaffs2 = "1"
68# Change these if you want default genext2fs behavior (i.e. create minimal inode number) 66# Change these if you want default genext2fs behavior (i.e. create minimal inode number)
69EXTRA_IMAGECMD_ext2 ?= "-i 8192" 67EXTRA_IMAGECMD_ext2 ?= "-i 8192"
70EXTRA_IMAGECMD_ext2.gz ?= "-i 8192" 68EXTRA_IMAGECMD_ext2.gz ?= "-i 8192"
@@ -73,7 +71,6 @@ EXTRA_IMAGECMD_ext3.gz ?= "-i 8192"
73 71
74IMAGE_DEPENDS = "" 72IMAGE_DEPENDS = ""
75IMAGE_DEPENDS_jffs2 = "mtd-utils-native" 73IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
76IMAGE_DEPENDS_yaffs2 = "yaffs2-utils-native"
77IMAGE_DEPENDS_cramfs = "cramfs-native" 74IMAGE_DEPENDS_cramfs = "cramfs-native"
78IMAGE_DEPENDS_ext2 = "genext2fs-native" 75IMAGE_DEPENDS_ext2 = "genext2fs-native"
79IMAGE_DEPENDS_ext2.gz = "genext2fs-native" 76IMAGE_DEPENDS_ext2.gz = "genext2fs-native"
diff --git a/meta/recipes-devtools/yaffs2/files/mkyaffs2image.patch b/meta/recipes-devtools/yaffs2/files/mkyaffs2image.patch
deleted file mode 100644
index e78b350377..0000000000
--- a/meta/recipes-devtools/yaffs2/files/mkyaffs2image.patch
+++ /dev/null
@@ -1,351 +0,0 @@
1Upstream-Status: Backport
2
3 *
4 * mkyaffs2image hacks by NCB
5 *
6 * Changes by Sergey Kubushin flagged KSI
7 *
8 */
9
10/* KSI:
11 * All this nightmare should be rewritten from ground up. Why save return
12 * values if nobody checks them? The read/write function returns only one
13 * error, -1. Positive return value does NOT mean read/write operation has
14 * been completed successfully. If somebody opens files, he MUST close them
15 * when they are not longer needed. Only those brave enough can write 64
16 * bytes from a yaffs_PackedTags2 structure. The list is too long, there is
17 * enough bugs here to write a couple of thick books on how NOT to write
18 * programs...
19 *
20 * And BTW, what was one supposed to do with that file that this horror
21 * occasionally managed to generate?
22 */
23Index: yaffs2/utils/mkyaffs2image.c
24===================================================================
25--- yaffs2.orig/utils/mkyaffs2image.c 2010-01-11 13:43:18.000000000 -0800
26+++ yaffs2/utils/mkyaffs2image.c 2011-05-04 14:50:42.045984700 -0700
27@@ -29,10 +29,10 @@
28 #include <dirent.h>
29 #include <string.h>
30 #include <unistd.h>
31+#include <mtd/mtd-user.h>
32 #include "yaffs_ecc.h"
33 #include "yaffs_guts.h"
34
35-#include "yaffs_tagsvalidity.h"
36 #include "yaffs_packedtags2.h"
37
38 unsigned yaffs_traceMask=0;
39@@ -41,9 +41,47 @@
40
41 #define chunkSize 2048
42 #define spareSize 64
43+#define PT2_BYTES 25
44+
45
46 const char * mkyaffsimage_c_version = "$Id: mkyaffs2image.c,v 1.5 2010-01-11 21:43:18 charles Exp $";
47
48+static int layout_no;
49+
50+static struct nand_oobinfo oob_layout[] = {
51+ /* KSI:
52+ * Dummy "raw" layout - no ECC, all the bytes are free. Does NOT
53+ * really work, only used for compatibility with CVS YAFFS2 that
54+ * never ever worked with any stock MTD.
55+ */
56+ {
57+ .useecc = MTD_NANDECC_AUTOPLACE,
58+ .eccbytes = 0,
59+ .eccpos = {},
60+ .oobfree = { {0, 64} }
61+ },
62+ /* KSI:
63+ * Regular MTD AUTOPLACED ECC for large page NAND devices, the
64+ * only one existing in stock MTD so far. It corresponds to layout# 1
65+ * in command line arguments. Any other layouts could be added to
66+ * the list when they made their way in kernel's MTD. The structure
67+ * is simply copied from kernel's drivers/mtd/nand/nand_base.c as-is.
68+ */
69+ {
70+ .useecc = MTD_NANDECC_AUTOPLACE,
71+ .eccbytes = 24,
72+ .eccpos = {
73+ 40, 41, 42, 43, 44, 45, 46, 47,
74+ 48, 49, 50, 51, 52, 53, 54, 55,
75+ 56, 57, 58, 59, 60, 61, 62, 63},
76+ .oobfree = { {2, 38} }
77+ },
78+ /* End-of-list marker */
79+ {
80+ .useecc = -1,
81+ }
82+};
83+
84
85 typedef struct
86 {
87@@ -57,7 +95,7 @@
88 static int n_obj = 0;
89 static int obj_id = YAFFS_NOBJECT_BUCKETS + 1;
90
91-static int nObjects, nDirectories, nPages;
92+static int nObjects = 0, nDirectories = 0, nPages = 0;
93
94 static int outFile;
95
96@@ -121,6 +159,11 @@
97 return -1;
98 }
99
100+/* KSI:
101+ * No big endian for now. This is left for a later time. The existing code
102+ * is FUBAR.
103+ */
104+#if 0
105 /* This little function converts a little endian tag to a big endian tag.
106 * NOTE: The tag is not usable after this other than calculating the CRC
107 * with.
108@@ -153,11 +196,56 @@
109 tags->asBytes[7] = temp.asBytes[7];
110 #endif
111 }
112+#endif
113+
114+void nandmtd2_pt2buf(unsigned char *buf, yaffs_PackedTags2 *pt)
115+{
116+ int i, j = 0, k, n;
117+ unsigned char pt2_byte_buf[PT2_BYTES];
118+
119+ *((unsigned int *) &pt2_byte_buf[0]) = pt->t.sequenceNumber;
120+ *((unsigned int *) &pt2_byte_buf[4]) = pt->t.objectId;
121+ *((unsigned int *) &pt2_byte_buf[8]) = pt->t.chunkId;
122+ *((unsigned int *) &pt2_byte_buf[12]) = pt->t.byteCount;
123+ pt2_byte_buf[16] = pt->ecc.colParity;
124+ pt2_byte_buf[17] = pt->ecc.lineParity & 0xff;
125+ pt2_byte_buf[18] = (pt->ecc.lineParity >> 8) & 0xff;
126+ pt2_byte_buf[19] = (pt->ecc.lineParity >> 16) & 0xff;
127+ pt2_byte_buf[20] = (pt->ecc.lineParity >> 24) & 0xff;
128+ pt2_byte_buf[21] = pt->ecc.lineParityPrime & 0xff;
129+ pt2_byte_buf[22] = (pt->ecc.lineParityPrime >> 8) & 0xff;
130+ pt2_byte_buf[23] = (pt->ecc.lineParityPrime >> 16) & 0xff;
131+ pt2_byte_buf[24] = (pt->ecc.lineParityPrime >> 24) & 0xff;
132+
133+ k = oob_layout[layout_no].oobfree[j][0];
134+ n = oob_layout[layout_no].oobfree[j][1];
135+
136+ if (n == 0) {
137+ fprintf(stderr, "No OOB space for tags");
138+ exit(-1);
139+ }
140+
141+ for (i = 0; i < PT2_BYTES; i++) {
142+ if (n == 0) {
143+ j++;
144+ k = oob_layout[layout_no].oobfree[j][0];
145+ n = oob_layout[layout_no].oobfree[j][1];
146+ if (n == 0) {
147+ fprintf(stderr, "No OOB space for tags");
148+ exit(-1);
149+ }
150+ }
151+ buf[k++] = pt2_byte_buf[i];
152+ n--;
153+ }
154+}
155
156 static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes)
157 {
158 yaffs_ExtendedTags t;
159 yaffs_PackedTags2 pt;
160+ unsigned char spare_buf[spareSize];
161+
162
163 error = write(outFile,data,chunkSize);
164 if(error < 0) return error;
165@@ -175,18 +263,28 @@
166 // added NCB **CHECK**
167 t.chunkUsed = 1;
168
169+/* KSI: Broken anyway -- e.g. &t is pointer to a wrong type... */
170+#if 0
171 if (convert_endian)
172 {
173 little_to_big_endian(&t);
174 }
175+#endif
176
177 nPages++;
178
179 yaffs_PackTags2(&pt,&t,1);
180-
181-// return write(outFile,&pt,sizeof(yaffs_PackedTags2));
182- return write(outFile,&pt,spareSize);
183-
184+
185+ memset(spare_buf, 0xff, sizeof(spare_buf));
186+
187+ if (layout_no == 0) {
188+ memcpy(spare_buf, &pt, sizeof(yaffs_PackedTags2));
189+ } else {
190+ nandmtd2_pt2buf(spare_buf, &pt);
191+ }
192+
193+ return write(outFile,spare_buf,spareSize);
194+
195 }
196
197 #define SWAP32(x) ((((x) & 0x000000FF) << 24) | \
198@@ -197,6 +295,8 @@
199 #define SWAP16(x) ((((x) & 0x00FF) << 8) | \
200 (((x) & 0xFF00) >> 8))
201
202+/* KSI: Removed for now. TBD later when the proper util (from scratch) is written */
203+#if 0
204 // This one is easier, since the types are more standard. No funky shifts here.
205 static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
206 {
207@@ -254,6 +354,7 @@
208 oh->roomToGrow[11] = SWAP32(oh->roomToGrow[11]);
209 #endif
210 }
211+#endif
212
213 static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
214 {
215@@ -298,10 +399,13 @@
216 strncpy(oh->alias,alias,YAFFS_MAX_ALIAS_LENGTH);
217 }
218
219+/* KSI: FUBAR. Left for a leter time. */
220+#if 0
221 if (convert_endian)
222 {
223 object_header_little_to_big_endian(oh);
224 }
225+#endif
226
227 return write_chunk(bytes,objId,0,0xffff);
228
229@@ -317,7 +421,7 @@
230 nDirectories++;
231
232 dir = opendir(path);
233-
234+
235 if(dir)
236 {
237 while((entry = readdir(dir)) != NULL)
238@@ -401,12 +505,12 @@
239 error = nBytes;
240
241 printf("%d data chunks written\n",chunk);
242+ close(h);
243 }
244 else
245 {
246 perror("Error opening file");
247 }
248- close(h);
249
250 }
251
252@@ -446,58 +550,82 @@
253 }
254 }
255 }
256+ /* KSI:
257+ * Who is supposed to close those open directories in this
258+ * recursive function, lord Byron? Stock "ulimit -n" is 1024
259+ * and e.g. stock Fedora /etc directory has more that 1024
260+ * directories...
261+ */
262+ closedir(dir);
263 }
264
265 return 0;
266
267 }
268
269+void usage(void)
270+{
271+ printf("usage: mkyaffs2image layout# dir image_file [convert]\n");
272+ printf(" layout# NAND OOB layout # (0 - raw, 1 - nand_oob_64)\n");
273+ printf(" dir the directory tree to be converted\n");
274+ printf(" image_file the output file to hold the image\n");
275+ printf(" 'convert' make a big-endian img on a little-endian machine. BROKEN !\n");
276+ exit(1);
277+}
278
279 int main(int argc, char *argv[])
280 {
281 struct stat stats;
282+ int i;
283
284 printf("mkyaffs2image: image building tool for YAFFS2 built "__DATE__"\n");
285
286- if(argc < 3)
287+ if ((argc < 4) || (sscanf(argv[1], "%u", &layout_no) != 1))
288 {
289- printf("usage: mkyaffs2image dir image_file [convert]\n");
290- printf(" dir the directory tree to be converted\n");
291- printf(" image_file the output file to hold the image\n");
292- printf(" 'convert' produce a big-endian image from a little-endian machine\n");
293- exit(1);
294+ usage();
295 }
296
297- if ((argc == 4) && (!strncmp(argv[3], "convert", strlen("convert"))))
298- {
299- convert_endian = 1;
300- }
301+ i = 0;
302+
303+ while (oob_layout[i].useecc != -1)
304+ i++;
305+
306+ if (layout_no >= i)
307+ usage();
308+
309+ if ((argc == 5) && (!strncmp(argv[4], "convert", strlen("convert"))))
310+ {
311+ /* KSI: Broken as of now. TBD. Fail. */
312+ usage();
313+ convert_endian = 1;
314+ }
315
316- if(stat(argv[1],&stats) < 0)
317+ if(stat(argv[2],&stats) < 0)
318 {
319- printf("Could not stat %s\n",argv[1]);
320+ printf("Could not stat %s\n",argv[2]);
321 exit(1);
322 }
323
324 if(!S_ISDIR(stats.st_mode))
325 {
326- printf(" %s is not a directory\n",argv[1]);
327+ printf(" %s is not a directory\n",argv[2]);
328 exit(1);
329 }
330
331- outFile = open(argv[2],O_CREAT | O_TRUNC | O_WRONLY, S_IREAD | S_IWRITE);
332+ outFile = open(argv[3],O_CREAT | O_TRUNC | O_WRONLY, S_IREAD | S_IWRITE);
333
334
335 if(outFile < 0)
336 {
337- printf("Could not open output file %s\n",argv[2]);
338+ printf("Could not open output file %s\n",argv[3]);
339 exit(1);
340 }
341
342- printf("Processing directory %s into image file %s\n",argv[1],argv[2]);
343+ printf("Processing directory %s into image file %s\n",argv[2],argv[3]);
344 error = write_object_header(1, YAFFS_OBJECT_TYPE_DIRECTORY, &stats, 1,"", -1, NULL);
345+
346 if(error)
347- error = process_directory(YAFFS_OBJECTID_ROOT,argv[1]);
348+ error = process_directory(YAFFS_OBJECTID_ROOT,argv[2]);
349
350 close(outFile);
351
diff --git a/meta/recipes-devtools/yaffs2/files/yaffs2-unioob.patch b/meta/recipes-devtools/yaffs2/files/yaffs2-unioob.patch
deleted file mode 100644
index 8152dabe43..0000000000
--- a/meta/recipes-devtools/yaffs2/files/yaffs2-unioob.patch
+++ /dev/null
@@ -1,218 +0,0 @@
1Upstream-Status: Backport
2
3diff -urN yaffs2.orig/yaffs_mtdif2.c yaffs2/yaffs_mtdif2.c
4--- yaffs2.orig/yaffs_mtdif2.c 2005-12-07 14:00:38.000000000 -0800
5+++ yaffs2/yaffs_mtdif2.c 2006-02-10 17:13:58.000000000 -0800
6@@ -29,6 +29,130 @@
7
8 #include "yaffs_packedtags2.h"
9
10+#define PT2_BYTES 25
11+
12+void nandmtd2_pt2buf(yaffs_Device *dev, yaffs_PackedTags2 *pt, int is_raw)
13+{
14+ struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
15+ int i, j = 0, k, n;
16+ __u8 pt2_byte_buf[PT2_BYTES];
17+
18+ /* Pack buffer with 0xff */
19+ for (i = 0; i < mtd->oobsize; i++)
20+ dev->spareBuffer[i] = 0xff;
21+
22+ if (!is_raw) {
23+ *((unsigned int *) &dev->spareBuffer[0]) = pt->t.sequenceNumber;
24+ *((unsigned int *) &dev->spareBuffer[4]) = pt->t.objectId;
25+ *((unsigned int *) &dev->spareBuffer[8]) = pt->t.chunkId;
26+ *((unsigned int *) &dev->spareBuffer[12]) = pt->t.byteCount;
27+ dev->spareBuffer[16] = pt->ecc.colParity;
28+ dev->spareBuffer[17] = pt->ecc.lineParity & 0xff;
29+ dev->spareBuffer[18] = (pt->ecc.lineParity >> 8) & 0xff;
30+ dev->spareBuffer[19] = (pt->ecc.lineParity >> 16) & 0xff;
31+ dev->spareBuffer[20] = (pt->ecc.lineParity >> 24) & 0xff;
32+ dev->spareBuffer[21] = pt->ecc.lineParityPrime & 0xff;
33+ dev->spareBuffer[22] = (pt->ecc.lineParityPrime >> 8) & 0xff;
34+ dev->spareBuffer[23] = (pt->ecc.lineParityPrime >> 16) & 0xff;
35+ dev->spareBuffer[24] = (pt->ecc.lineParityPrime >> 24) & 0xff;
36+ } else {
37+ *((unsigned int *) &pt2_byte_buf[0]) = pt->t.sequenceNumber;
38+ *((unsigned int *) &pt2_byte_buf[4]) = pt->t.objectId;
39+ *((unsigned int *) &pt2_byte_buf[8]) = pt->t.chunkId;
40+ *((unsigned int *) &pt2_byte_buf[12]) = pt->t.byteCount;
41+ pt2_byte_buf[16] = pt->ecc.colParity;
42+ pt2_byte_buf[17] = pt->ecc.lineParity & 0xff;
43+ pt2_byte_buf[18] = (pt->ecc.lineParity >> 8) & 0xff;
44+ pt2_byte_buf[19] = (pt->ecc.lineParity >> 16) & 0xff;
45+ pt2_byte_buf[20] = (pt->ecc.lineParity >> 24) & 0xff;
46+ pt2_byte_buf[21] = pt->ecc.lineParityPrime & 0xff;
47+ pt2_byte_buf[22] = (pt->ecc.lineParityPrime >> 8) & 0xff;
48+ pt2_byte_buf[23] = (pt->ecc.lineParityPrime >> 16) & 0xff;
49+ pt2_byte_buf[24] = (pt->ecc.lineParityPrime >> 24) & 0xff;
50+
51+ k = mtd->oobinfo.oobfree[j][0];
52+ n = mtd->oobinfo.oobfree[j][1];
53+
54+ if (n == 0) {
55+ T(YAFFS_TRACE_ERROR, (TSTR("No OOB space for tags" TENDSTR)));
56+ YBUG();
57+ }
58+
59+ for (i = 0; i < PT2_BYTES; i++) {
60+ if (n == 0) {
61+ j++;
62+ k = mtd->oobinfo.oobfree[j][0];
63+ n = mtd->oobinfo.oobfree[j][1];
64+ if (n == 0) {
65+ T(YAFFS_TRACE_ERROR, (TSTR("No OOB space for tags" TENDSTR)));
66+ YBUG();
67+ }
68+ }
69+ dev->spareBuffer[k++] = pt2_byte_buf[i];
70+ n--;
71+ }
72+ }
73+}
74+
75+void nandmtd2_buf2pt(yaffs_Device *dev, yaffs_PackedTags2 *pt, int is_raw)
76+{
77+ struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
78+ int i, j = 0, k, n;
79+ __u8 pt2_byte_buf[PT2_BYTES];
80+
81+
82+ if (!is_raw) {
83+ pt->t.sequenceNumber = *((unsigned int *) &dev->spareBuffer[0]);
84+ pt->t.objectId = *((unsigned int *) &dev->spareBuffer[4]);
85+ pt->t.chunkId = *((unsigned int *) &dev->spareBuffer[8]);
86+ pt->t.byteCount = *((unsigned int *) &dev->spareBuffer[12]);
87+ pt->ecc.colParity = dev->spareBuffer[16];
88+ pt->ecc.lineParity = (dev->spareBuffer[17] & 0x000000ff) |
89+ ((dev->spareBuffer[18] << 8) & 0x0000ff00) |
90+ ((dev->spareBuffer[19] << 16) & 0x00ff0000) |
91+ ((dev->spareBuffer[20] << 24) & 0xff000000);
92+ pt->ecc.lineParityPrime = (dev->spareBuffer[21] & 0x000000ff) |
93+ ((dev->spareBuffer[22] << 8) & 0x0000ff00) |
94+ ((dev->spareBuffer[23] << 16) & 0x00ff0000) |
95+ ((dev->spareBuffer[24] << 24) & 0xff000000);
96+ } else {
97+ k = mtd->oobinfo.oobfree[j][0];
98+ n = mtd->oobinfo.oobfree[j][1];
99+
100+ if (n == 0) {
101+ T(YAFFS_TRACE_ERROR, (TSTR("No space in OOB for tags" TENDSTR)));
102+ YBUG();
103+ }
104+
105+ for (i = 0; i < PT2_BYTES; i++) {
106+ if (n == 0) {
107+ j++;
108+ k = mtd->oobinfo.oobfree[j][0];
109+ n = mtd->oobinfo.oobfree[j][1];
110+ if (n == 0) {
111+ T(YAFFS_TRACE_ERROR, (TSTR("No space in OOB for tags" TENDSTR)));
112+ YBUG();
113+ }
114+ }
115+ pt2_byte_buf[i] = dev->spareBuffer[k++];
116+ n--;
117+ }
118+ pt->t.sequenceNumber = *((unsigned int *) &pt2_byte_buf[0]);
119+ pt->t.objectId = *((unsigned int *) &pt2_byte_buf[4]);
120+ pt->t.chunkId = *((unsigned int *) &pt2_byte_buf[8]);
121+ pt->t.byteCount = *((unsigned int *) &pt2_byte_buf[12]);
122+ pt->ecc.colParity = pt2_byte_buf[16];
123+ pt->ecc.lineParity = (pt2_byte_buf[17] & 0x000000ff) |
124+ ((pt2_byte_buf[18] << 8) & 0x0000ff00) |
125+ ((pt2_byte_buf[19] << 16) & 0x00ff0000) |
126+ ((pt2_byte_buf[20] << 24) & 0xff000000);
127+ pt->ecc.lineParityPrime = (pt2_byte_buf[21] & 0x000000ff) |
128+ ((pt2_byte_buf[22] << 8) & 0x0000ff00) |
129+ ((pt2_byte_buf[23] << 16) & 0x00ff0000) |
130+ ((pt2_byte_buf[24] << 24) & 0xff000000);
131+ }
132+}
133+
134 int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND,
135 const __u8 * data,
136 const yaffs_ExtendedTags * tags)
137@@ -51,24 +175,22 @@
138 }
139
140 if (data && tags) {
141- if (dev->useNANDECC)
142- retval =
143- mtd->write_ecc(mtd, addr, dev->nBytesPerChunk,
144- &dummy, data, (__u8 *) & pt, NULL);
145- else
146+ nandmtd2_pt2buf(dev, &pt, 0);
147 retval =
148 mtd->write_ecc(mtd, addr, dev->nBytesPerChunk,
149- &dummy, data, (__u8 *) & pt, NULL);
150+ &dummy, data, dev->spareBuffer,
151+ NULL);
152 } else {
153 if (data)
154 retval =
155 mtd->write(mtd, addr, dev->nBytesPerChunk, &dummy,
156 data);
157- if (tags)
158+ if (tags) {
159+ nandmtd2_pt2buf(dev, &pt, 1);
160 retval =
161 mtd->write_oob(mtd, addr, mtd->oobsize, &dummy,
162- (__u8 *) & pt);
163-
164+ dev->spareBuffer);
165+ }
166 }
167
168 if (retval == 0)
169@@ -94,30 +216,24 @@
170 TENDSTR), chunkInNAND, data, tags));
171
172 if (data && tags) {
173- if (dev->useNANDECC) {
174 retval =
175 mtd->read_ecc(mtd, addr, dev->nBytesPerChunk,
176 &dummy, data, dev->spareBuffer,
177 NULL);
178- } else {
179- retval =
180- mtd->read_ecc(mtd, addr, dev->nBytesPerChunk,
181- &dummy, data, dev->spareBuffer,
182- NULL);
183- }
184+ nandmtd2_buf2pt(dev, &pt, 0);
185 } else {
186 if (data)
187 retval =
188 mtd->read(mtd, addr, dev->nBytesPerChunk, &dummy,
189 data);
190- if (tags)
191+ if (tags) {
192 retval =
193 mtd->read_oob(mtd, addr, mtd->oobsize, &dummy,
194 dev->spareBuffer);
195+ nandmtd2_buf2pt(dev, &pt, 1);
196+ }
197 }
198
199- memcpy(&pt, dev->spareBuffer, sizeof(pt));
200-
201 if (tags)
202 yaffs_UnpackTags2(tags, &pt);
203
204@@ -178,10 +294,11 @@
205 *sequenceNumber = 0;
206 *state = YAFFS_BLOCK_STATE_EMPTY;
207 }
208+
209+ T(YAFFS_TRACE_MTD,
210+ (TSTR("block is OK seq %d state %d" TENDSTR), *sequenceNumber,
211+ *state));
212 }
213- T(YAFFS_TRACE_MTD,
214- (TSTR("block is bad seq %d state %d" TENDSTR), *sequenceNumber,
215- *state));
216
217 if (retval == 0)
218 return YAFFS_OK;
diff --git a/meta/recipes-devtools/yaffs2/yaffs2-utils.inc b/meta/recipes-devtools/yaffs2/yaffs2-utils.inc
deleted file mode 100644
index 23e202d704..0000000000
--- a/meta/recipes-devtools/yaffs2/yaffs2-utils.inc
+++ /dev/null
@@ -1,28 +0,0 @@
1DESCRIPTION = "Tools for managing 'yaffs2' file systems."
2SECTION = "base"
3HOMEPAGE = "http://www.yaffs.net"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://yaffs_fs.c;beginline=1;endline=19;md5=9e87e2e9244febcc0dffb752cb7679e1"
6PV = "0.0.0+cvs${SRCDATE}"
7PR = "r0"
8DEPENDS = "mtd-utils"
9
10SRC_URI = "cvs://anonymous@cvs.aleph1.co.uk/home/aleph1/cvs;module=yaffs2 \
11 file://mkyaffs2image.patch;patch=1"
12S = "${WORKDIR}/yaffs2"
13
14CFLAGS += "-I.. -DCONFIG_YAFFS_UTIL"
15CFLAGS_append_virtclass-native = " -I.. -DCONFIG_YAFFS_UTIL"
16
17do_compile() {
18 cd utils && oe_runmake
19}
20
21do_install() {
22 install -d ${D}${sbindir}/
23 for i in mkyaffsimage mkyaffs2image; do
24 install -m 0755 utils/$i ${D}${sbindir}/
25 done
26}
27
28BBCLASSEXTEND = "native"
diff --git a/meta/recipes-devtools/yaffs2/yaffs2-utils_cvs.bb b/meta/recipes-devtools/yaffs2/yaffs2-utils_cvs.bb
deleted file mode 100644
index 6414bd29d0..0000000000
--- a/meta/recipes-devtools/yaffs2/yaffs2-utils_cvs.bb
+++ /dev/null
@@ -1,4 +0,0 @@
1require yaffs2-utils.inc
2PR = "r1"
3
4SRCDATE = "20110505"