*** empty log message ***
authorcharles <charles>
Tue, 11 Oct 2005 23:39:55 +0000 (23:39 +0000)
committercharles <charles>
Tue, 11 Oct 2005 23:39:55 +0000 (23:39 +0000)
utils/Makefile
utils/mkyaffs.c
utils/mkyaffsimage.c

index 265bb04b41eadeead33b6c89b91a106db71d779f..4929e080d992f9fe6a88b9758946ada673fbe4b6 100644 (file)
@@ -14,9 +14,9 @@
 
 ## Change or override  KERNELDIR to your kernel
 
 
 ## Change or override  KERNELDIR to your kernel
 
-KERNELDIR = /usr/src/kernel-headers-2.4.18
+#KERNELDIR = /usr/src/kernel-headers-2.4.18
 
 
-CFLAGS =   -I$(KERNELDIR)/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL
+CFLAGS =   -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL
 CFLAGS+=   -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations
 CFLAGS+=   -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
 
 CFLAGS+=   -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations
 CFLAGS+=   -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
 
@@ -27,7 +27,7 @@ CC=$(MAKETOOLS)gcc
 
 MKYAFFSOBJS = mkyaffs.o
 
 
 MKYAFFSOBJS = mkyaffs.o
 
-MKYAFFSIMAGEOBJS = mkyaffsimage.o nand_ecc.o
+MKYAFFSIMAGEOBJS = mkyaffsimage.o yaffs_ecc.o
 
 
 all: mkyaffs mkyaffsimage
 
 
 all: mkyaffs mkyaffsimage
@@ -44,8 +44,8 @@ $(MKYAFFSOBJS): %.o: %.c
 mkyaffs: $(MKYAFFSOBJS)
        $(CC) -o $@ $(MKYAFFSOBJS)
 
 mkyaffs: $(MKYAFFSOBJS)
        $(CC) -o $@ $(MKYAFFSOBJS)
 
-nand_ecc.c:
-       ln -s ../nand_ecc.c nand_ecc.c
+yaffs_ecc.c:
+       ln -s ../yaffs_ecc.c yaffs_ecc.c
 
 
 clean:
 
 
 clean:
index a3ec11d2a46ef9d1dcf1080dd442739a7799ccdd..c9b436799a3f04ca5bf94c1f0a3520cfdbf4c24d 100644 (file)
 #include <stdlib.h>
 #include <time.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <time.h>
 #include <unistd.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <asm/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <asm/types.h>
-#include <linux/config.h>
-#include <linux/mtd/mtd.h>
+#include <mtd/mtd-user.h>
 
 
-const char *mkyaffs_c_version = "$Id: mkyaffs.c,v 1.8 2003-03-12 19:54:07 charles Exp $";
+const char *mkyaffs_c_version = "$Id: mkyaffs.c,v 1.9 2005-10-11 23:39:56 charles Exp $";
 
 // countBits is a quick way of counting the number of bits in a byte.
 // ie. countBits[n] holds the number of 1 bits in a byte with the value n.
 
 // countBits is a quick way of counting the number of bits in a byte.
 // ie. countBits[n] holds the number of 1 bits in a byte with the value n.
index c21c631f3272379b64121b31b53ae6a8d229b55c..8d57bc3272330be454f7396990153db9ad724b69 100644 (file)
 #include <dirent.h>
 #include <string.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <string.h>
 #include <unistd.h>
-
+#include "yaffs_ecc.h"
 #include "yaffs_guts.h"
 
 
 #define MAX_OBJECTS 10000
 
 #include "yaffs_guts.h"
 
 
 #define MAX_OBJECTS 10000
 
-const char * mkyaffsimage_c_version = "$Id: mkyaffsimage.c,v 1.7 2003-07-16 03:00:48 charles Exp $";
-
-// External functions for ECC on data
-void nand_calculate_ecc (const u_char *dat, u_char *ecc_code);
-int nand_correct_data (u_char *dat, u_char *read_ecc, u_char *calc_ecc);
+const char * mkyaffsimage_c_version = "$Id: mkyaffsimage.c,v 1.8 2005-10-11 23:39:56 charles Exp $";
 
 
 typedef struct
 
 
 typedef struct
@@ -139,8 +135,8 @@ static __u16 yaffs_CalcNameSum(const char *name)
 
 static void yaffs_CalcECC(const __u8 *data, yaffs_Spare *spare)
 {
 
 static void yaffs_CalcECC(const __u8 *data, yaffs_Spare *spare)
 {
-       nand_calculate_ecc (data , spare->ecc1);
-       nand_calculate_ecc (&data[256] , spare->ecc2);
+       yaffs_ECCCalculate(data , spare->ecc1);
+       yaffs_ECCCalculate(&data[256] , spare->ecc2);
 }
 
 static void yaffs_CalcTagsECC(yaffs_Tags *tags)
 }
 
 static void yaffs_CalcTagsECC(yaffs_Tags *tags)
@@ -281,7 +277,7 @@ static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
     oh->parentObjectId = SWAP32(oh->parentObjectId); // int
     oh->sum__NoLongerUsed = SWAP16(oh->sum__NoLongerUsed); // __u16 - Not used, but done for completeness.
     // name = skip. Char array. Not swapped.
     oh->parentObjectId = SWAP32(oh->parentObjectId); // int
     oh->sum__NoLongerUsed = SWAP16(oh->sum__NoLongerUsed); // __u16 - Not used, but done for completeness.
     // name = skip. Char array. Not swapped.
-    oh->st_mode = SWAP32(oh->st_mode);
+    oh->yst_mode = SWAP32(oh->yst_mode);
 #ifdef CONFIG_YAFFS_WINCE // WinCE doesn't implement this, but we need to just in case. 
     // In fact, WinCE would be *THE* place where this would be an issue!
     oh->notForWinCE[0] = SWAP32(oh->notForWinCE[0]);
 #ifdef CONFIG_YAFFS_WINCE // WinCE doesn't implement this, but we need to just in case. 
     // In fact, WinCE would be *THE* place where this would be an issue!
     oh->notForWinCE[0] = SWAP32(oh->notForWinCE[0]);
@@ -291,17 +287,17 @@ static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
     oh->notForWinCE[4] = SWAP32(oh->notForWinCE[4]);
 #else
     // Regular POSIX.
     oh->notForWinCE[4] = SWAP32(oh->notForWinCE[4]);
 #else
     // Regular POSIX.
-    oh->st_uid = SWAP32(oh->st_uid);
-    oh->st_gid = SWAP32(oh->st_gid);
-    oh->st_atime = SWAP32(oh->st_atime);
-    oh->st_mtime = SWAP32(oh->st_mtime);
-    oh->st_ctime = SWAP32(oh->st_ctime);
+    oh->yst_uid = SWAP32(oh->yst_uid);
+    oh->yst_gid = SWAP32(oh->yst_gid);
+    oh->yst_atime = SWAP32(oh->yst_atime);
+    oh->yst_mtime = SWAP32(oh->yst_mtime);
+    oh->yst_ctime = SWAP32(oh->yst_ctime);
 #endif
 
     oh->fileSize = SWAP32(oh->fileSize); // Aiee. An int... signed, at that!
     oh->equivalentObjectId = SWAP32(oh->equivalentObjectId);
     // alias  - char array.
 #endif
 
     oh->fileSize = SWAP32(oh->fileSize); // Aiee. An int... signed, at that!
     oh->equivalentObjectId = SWAP32(oh->equivalentObjectId);
     // alias  - char array.
-    oh->st_rdev = SWAP32(oh->st_rdev);
+    oh->yst_rdev = SWAP32(oh->yst_rdev);
 
 #ifdef CONFIG_YAFFS_WINCE
     oh->win_ctime[0] = SWAP32(oh->win_ctime[0]);
 
 #ifdef CONFIG_YAFFS_WINCE
     oh->win_ctime[0] = SWAP32(oh->win_ctime[0]);
@@ -350,14 +346,14 @@ static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, in
        
        if(t != YAFFS_OBJECT_TYPE_HARDLINK)
        {
        
        if(t != YAFFS_OBJECT_TYPE_HARDLINK)
        {
-               oh->st_mode = s->st_mode;
-               oh->st_uid = s->st_uid;
-// NCB 12/9/02         oh->st_gid = s->st_uid;
-               oh->st_gid = s->st_gid;
-               oh->st_atime = s->st_atime;
-               oh->st_mtime = s->st_mtime;
-               oh->st_ctime = s->st_ctime;
-               oh->st_rdev  = s->st_rdev;
+               oh->yst_mode = s->st_mode;
+               oh->yst_uid = s->st_uid;
+// NCB 12/9/02         oh->yst_gid = s->yst_uid;
+               oh->yst_gid = s->st_gid;
+               oh->yst_atime = s->st_atime;
+               oh->yst_mtime = s->st_mtime;
+               oh->yst_ctime = s->st_ctime;
+               oh->yst_rdev  = s->st_rdev;
        }
        
        if(t == YAFFS_OBJECT_TYPE_FILE)
        }
        
        if(t == YAFFS_OBJECT_TYPE_FILE)