1 --- a/yaffs2/utils/Makefile
2 +++ b/yaffs2/utils/Makefile
5 #KERNELDIR = /usr/src/kernel-headers-2.4.18
7 -CFLAGS = -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL
8 -CFLAGS+= -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations
9 -CFLAGS+= -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
10 +CPPFLAGS = -I.. -DCONFIG_YAFFS_UTIL
13 ## Change if you are using a cross-compiler
19 @@ -41,7 +40,7 @@ $(COMMONLINKS) $(MKYAFFSLINKS) $(MKYAFFS
22 $(COMMONOBJS) $(MKYAFFSIMAGEOBJS) $(MKYAFFS2IMAGEOBJS) : %.o: %.c
23 - $(CC) -c $(CFLAGS) $< -o $@
24 + $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
26 mkyaffsimage: $(COMMONOBJS) $(MKYAFFSIMAGEOBJS)
27 $(CC) -o $@ $(COMMONOBJS) $(MKYAFFSIMAGEOBJS)
28 --- a/yaffs2/utils/mkyaffs2image.c
29 +++ b/yaffs2/utils/mkyaffs2image.c
34 -#include <private/android_filesystem_config.h>
36 #include "yaffs_ecc.h"
37 #include "yaffs_guts.h"
39 @@ -69,10 +67,12 @@ static int outFile;
43 -#ifdef HAVE_BIG_ENDIAN
44 +#if BYTE_ORDER == BIG_ENDIAN
45 static int convert_endian = 1;
46 -#elif defined(HAVE_LITTLE_ENDIAN)
47 +#elif BYTE_ORDER == LITTLE_ENDIAN
48 static int convert_endian = 0;
50 +#error Unknown endian type
53 static int obj_compare(const void *a, const void * b)
54 @@ -298,8 +298,8 @@ static int write_object_header(int objId
56 static void fix_stat(const char *path, struct stat *s)
58 - path += source_path_len;
59 - fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &s->st_mode);
64 static int process_directory(int parent, const char *path, int fixstats)
65 @@ -342,9 +342,8 @@ static int process_directory(int parent,
71 fix_stat(full_name, &stats);
74 //printf("Object %d, %s is a ",newObj,full_name);
76 @@ -473,13 +472,13 @@ int main(int argc, char *argv[])
77 fprintf(stderr," -f fix file stat (mods, user, group) for device\n");
78 fprintf(stderr," dir the directory tree to be converted\n");
79 fprintf(stderr," image_file the output file to hold the image\n");
80 - fprintf(stderr," 'convert' produce a big-endian image from a little-endian machine\n");
81 + fprintf(stderr," 'convert' produce a big-endian image\n");
85 if ((argc == 4) && (!strncmp(argv[3], "convert", strlen("convert"))))
88 + convert_endian = !convert_endian;
91 if(stat(argv[1],&stats) < 0)
92 @@ -503,20 +502,9 @@ int main(int argc, char *argv[])
97 - int len = strlen(argv[1]);
99 - if((len >= 4) && (!strcmp(argv[1] + len - 4, "data"))) {
100 - source_path_len = len - 4;
101 - } else if((len >= 7) && (!strcmp(argv[1] + len - 6, "system"))) {
102 - source_path_len = len - 6;
104 - fprintf(stderr,"Fixstats (-f) option requested but filesystem is not data or android!\n");
108 fix_stat(argv[1], &stats);
112 //printf("Processing directory %s into image file %s\n",argv[1],argv[2]);
113 error = write_object_header(1, YAFFS_OBJECT_TYPE_DIRECTORY, &stats, 1,"", -1, NULL);