Root/tools/yaffs2/patches/100-compile.patch

1--- a/yaffs2/utils/Makefile
2+++ b/yaffs2/utils/Makefile
3@@ -16,12 +16,11 @@
4 
5 #KERNELDIR = /usr/src/kernel-headers-2.4.18
6 
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
11+CFLAGS = -O2
12 
13 ## Change if you are using a cross-compiler
14-MAKETOOLS =
15+MAKETOOLS =
16 
17 CC=$(MAKETOOLS)gcc
18 
19@@ -41,7 +40,7 @@ $(COMMONLINKS) $(MKYAFFSLINKS) $(MKYAFFS
20     ln -s ../$@ $@
21 
22 $(COMMONOBJS) $(MKYAFFSIMAGEOBJS) $(MKYAFFS2IMAGEOBJS) : %.o: %.c
23- $(CC) -c $(CFLAGS) $< -o $@
24+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
25 
26 mkyaffsimage: $(COMMONOBJS) $(MKYAFFSIMAGEOBJS)
27     $(CC) -o $@ $(COMMONOBJS) $(MKYAFFSIMAGEOBJS)
28--- a/yaffs2/utils/mkyaffs2image.c
29+++ b/yaffs2/utils/mkyaffs2image.c
30@@ -32,8 +32,6 @@
31 #include <string.h>
32 #include <unistd.h>
33 
34-#include <private/android_filesystem_config.h>
35-
36 #include "yaffs_ecc.h"
37 #include "yaffs_guts.h"
38 
39@@ -69,10 +67,12 @@ static int outFile;
40 
41 static int error;
42 
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;
49+#else
50+#error Unknown endian type
51 #endif
52 
53 static int obj_compare(const void *a, const void * b)
54@@ -298,8 +298,8 @@ static int write_object_header(int objId
55 
56 static void fix_stat(const char *path, struct stat *s)
57 {
58- path += source_path_len;
59- fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &s->st_mode);
60+ s->st_uid = 0;
61+ s->st_gid = 0;
62 }
63 
64 static int process_directory(int parent, const char *path, int fixstats)
65@@ -342,9 +342,8 @@ static int process_directory(int parent,
66                     newObj = obj_id++;
67                     nObjects++;
68 
69- if (fixstats) {
70+ if (fixstats)
71                         fix_stat(full_name, &stats);
72- }
73 
74                     //printf("Object %d, %s is a ",newObj,full_name);
75                     
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");
82         exit(1);
83     }
84 
85     if ((argc == 4) && (!strncmp(argv[3], "convert", strlen("convert"))))
86     {
87- convert_endian = 1;
88+ convert_endian = !convert_endian;
89     }
90     
91     if(stat(argv[1],&stats) < 0)
92@@ -503,20 +502,9 @@ int main(int argc, char *argv[])
93         exit(1);
94     }
95 
96- if (fixstats) {
97- int len = strlen(argv[1]);
98-
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;
103- } else {
104- fprintf(stderr,"Fixstats (-f) option requested but filesystem is not data or android!\n");
105- exit(1);
106- }
107+ if (fixstats)
108         fix_stat(argv[1], &stats);
109- }
110-
111+
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);
114     if(error)
115

Archive Download this file



interactive