100-compile.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. --- a/yaffs2/utils/Makefile
  2. +++ b/yaffs2/utils/Makefile
  3. @@ -16,12 +16,11 @@
  4. #KERNELDIR = /usr/src/kernel-headers-2.4.18
  5. -CFLAGS = -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL
  6. -CFLAGS+= -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations
  7. -CFLAGS+= -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
  8. +CPPFLAGS = -I.. -DCONFIG_YAFFS_UTIL
  9. +CFLAGS = -O2
  10. ## Change if you are using a cross-compiler
  11. -MAKETOOLS =
  12. +MAKETOOLS =
  13. CC=$(MAKETOOLS)gcc
  14. @@ -41,7 +40,7 @@ $(COMMONLINKS) $(MKYAFFSLINKS) $(MKYAFFS
  15. ln -s ../$@ $@
  16. $(COMMONOBJS) $(MKYAFFSIMAGEOBJS) $(MKYAFFS2IMAGEOBJS) : %.o: %.c
  17. - $(CC) -c $(CFLAGS) $< -o $@
  18. + $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
  19. mkyaffsimage: $(COMMONOBJS) $(MKYAFFSIMAGEOBJS)
  20. $(CC) -o $@ $(COMMONOBJS) $(MKYAFFSIMAGEOBJS)
  21. --- a/yaffs2/utils/mkyaffs2image.c
  22. +++ b/yaffs2/utils/mkyaffs2image.c
  23. @@ -32,8 +32,6 @@
  24. #include <string.h>
  25. #include <unistd.h>
  26. -#include <private/android_filesystem_config.h>
  27. -
  28. #include "yaffs_ecc.h"
  29. #include "yaffs_guts.h"
  30. @@ -69,10 +67,12 @@ static int outFile;
  31. static int error;
  32. -#ifdef HAVE_BIG_ENDIAN
  33. +#if BYTE_ORDER == BIG_ENDIAN
  34. static int convert_endian = 1;
  35. -#elif defined(HAVE_LITTLE_ENDIAN)
  36. +#elif BYTE_ORDER == LITTLE_ENDIAN
  37. static int convert_endian = 0;
  38. +#else
  39. +#error Unknown endian type
  40. #endif
  41. static int obj_compare(const void *a, const void * b)
  42. @@ -298,8 +298,8 @@ static int write_object_header(int objId
  43. static void fix_stat(const char *path, struct stat *s)
  44. {
  45. - path += source_path_len;
  46. - fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &s->st_mode);
  47. + s->st_uid = 0;
  48. + s->st_gid = 0;
  49. }
  50. static int process_directory(int parent, const char *path, int fixstats)
  51. @@ -342,9 +342,8 @@ static int process_directory(int parent,
  52. newObj = obj_id++;
  53. nObjects++;
  54. - if (fixstats) {
  55. + if (fixstats)
  56. fix_stat(full_name, &stats);
  57. - }
  58. //printf("Object %d, %s is a ",newObj,full_name);
  59. @@ -473,13 +472,13 @@ int main(int argc, char *argv[])
  60. fprintf(stderr," -f fix file stat (mods, user, group) for device\n");
  61. fprintf(stderr," dir the directory tree to be converted\n");
  62. fprintf(stderr," image_file the output file to hold the image\n");
  63. - fprintf(stderr," 'convert' produce a big-endian image from a little-endian machine\n");
  64. + fprintf(stderr," 'convert' produce a big-endian image\n");
  65. exit(1);
  66. }
  67. if ((argc == 4) && (!strncmp(argv[3], "convert", strlen("convert"))))
  68. {
  69. - convert_endian = 1;
  70. + convert_endian = !convert_endian;
  71. }
  72. if(stat(argv[1],&stats) < 0)
  73. @@ -503,20 +502,9 @@ int main(int argc, char *argv[])
  74. exit(1);
  75. }
  76. - if (fixstats) {
  77. - int len = strlen(argv[1]);
  78. -
  79. - if((len >= 4) && (!strcmp(argv[1] + len - 4, "data"))) {
  80. - source_path_len = len - 4;
  81. - } else if((len >= 7) && (!strcmp(argv[1] + len - 6, "system"))) {
  82. - source_path_len = len - 6;
  83. - } else {
  84. - fprintf(stderr,"Fixstats (-f) option requested but filesystem is not data or android!\n");
  85. - exit(1);
  86. - }
  87. + if (fixstats)
  88. fix_stat(argv[1], &stats);
  89. - }
  90. -
  91. +
  92. //printf("Processing directory %s into image file %s\n",argv[1],argv[2]);
  93. error = write_object_header(1, YAFFS_OBJECT_TYPE_DIRECTORY, &stats, 1,"", -1, NULL);
  94. if(error)
  95. --- a/yaffs2/devextras.h
  96. +++ b/yaffs2/devextras.h
  97. @@ -37,7 +37,7 @@ typedef unsigned char __u8;
  98. typedef unsigned short __u16;
  99. typedef unsigned __u32;
  100. -#if defined(__APPLE__)
  101. +#if defined(__APPLE__) || defined(__FreeBSD__)
  102. typedef long long loff_t;
  103. #endif