summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch')
-rw-r--r--meta/recipes-devtools/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch134
1 files changed, 134 insertions, 0 deletions
diff --git a/meta/recipes-devtools/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch b/meta/recipes-devtools/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch
new file mode 100644
index 0000000000..5555654490
--- /dev/null
+++ b/meta/recipes-devtools/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git.patch
@@ -0,0 +1,134 @@
1---
2 mkfs.jffs2.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
3 1 file changed, 42 insertions(+), 2 deletions(-)
4
5--- git.orig/mkfs.jffs2.c
6+++ git/mkfs.jffs2.c
7@@ -98,10 +98,16 @@ struct filesystem_entry {
8 struct filesystem_entry *next; /* Only relevant to non-directories */
9 struct filesystem_entry *files; /* Only relevant to directories */
10 struct rb_node hardlink_rb;
11 };
12
13+struct ignorepath_entry {
14+ struct ignorepath_entry* next; /* Points to the next ignorepath element */
15+ char name[PATH_MAX]; /* Name of the entry */
16+};
17+
18+static struct ignorepath_entry* ignorepath = 0;
19 struct rb_root hardlinks;
20 static int out_fd = -1;
21 static int in_fd = -1;
22 static char default_rootdir[] = ".";
23 static char *rootdir = default_rootdir;
24@@ -404,19 +410,28 @@ static struct filesystem_entry *recursiv
25 int i, n;
26 struct stat sb;
27 char *hpath, *tpath;
28 struct dirent *dp, **namelist;
29 struct filesystem_entry *entry;
30-
31+ struct ignorepath_entry* element = ignorepath;
32
33 if (lstat(hostpath, &sb)) {
34 perror_msg_and_die("%s", hostpath);
35 }
36
37 entry = add_host_filesystem_entry(targetpath, hostpath,
38 sb.st_uid, sb.st_gid, sb.st_mode, 0, parent);
39
40+ while ( element ) {
41+ if ( strcmp( element->name, targetpath ) == 0 ) {
42+ printf( "Note: ignoring directories below '%s'\n", targetpath );
43+ return entry;
44+ break;
45+ }
46+ element = element->next;
47+ }
48+
49 n = scandir(hostpath, &namelist, 0, alphasort);
50 if (n < 0) {
51 perror_msg_and_die("opening directory %s", hostpath);
52 }
53
54@@ -1446,10 +1461,11 @@ static void create_target_filesystem(str
55 static struct option long_options[] = {
56 {"pad", 2, NULL, 'p'},
57 {"root", 1, NULL, 'r'},
58 {"pagesize", 1, NULL, 's'},
59 {"eraseblock", 1, NULL, 'e'},
60+ {"ignore", 1, NULL, 'I'},
61 {"output", 1, NULL, 'o'},
62 {"help", 0, NULL, 'h'},
63 {"verbose", 0, NULL, 'v'},
64 {"version", 0, NULL, 'V'},
65 {"big-endian", 0, NULL, 'b'},
66@@ -1493,10 +1509,11 @@ static char *helptext =
67 " -y, --compressor-priority=PRIORITY:COMPRESSOR_NAME\n"
68 " Set the priority of a compressor\n"
69 " -L, --list-compressors Show the list of the avaiable compressors\n"
70 " -t, --test-compression Call decompress and compare with the original (for test)\n"
71 " -n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock\n"
72+" -I, --ignore=PATH Ignore sub directory and file tree below PATH when recursing over the file system\n"
73 " -o, --output=FILE Output to FILE (default: stdout)\n"
74 " -l, --little-endian Create a little-endian filesystem\n"
75 " -b, --big-endian Create a big-endian filesystem\n"
76 " -D, --devtable=FILE Use the named FILE as a device table file\n"
77 " -f, --faketime Change all file times to '0' for regression testing\n"
78@@ -1659,21 +1676,22 @@ int main(int argc, char **argv)
79 FILE *devtable = NULL;
80 struct filesystem_entry *root;
81 char *compr_name = NULL;
82 int compr_prior = -1;
83 int warn_page_size = 0;
84+ struct ignorepath_entry* element = ignorepath;
85
86 page_size = sysconf(_SC_PAGESIZE);
87 if (page_size < 0) /* System doesn't know so ... */
88 page_size = 4096; /* ... we make an educated guess */
89 if (page_size != 4096)
90 warn_page_size = 1; /* warn user if page size not 4096 */
91
92 jffs2_compressors_init();
93
94 while ((opt = getopt_long(argc, argv,
95- "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0)
96+ "D:d:r:s:I:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0)
97 {
98 switch (opt) {
99 case 'D':
100 devtable = xfopen(optarg, "r");
101 if (fstat(fileno(devtable), &sb) < 0)
102@@ -1693,10 +1711,32 @@ int main(int argc, char **argv)
103 case 's':
104 page_size = strtol(optarg, NULL, 0);
105 warn_page_size = 0; /* set by user, so don't need to warn */
106 break;
107
108+ case 'I':
109+ printf( "Note: Adding '%s' to ignore Path\n", optarg );
110+ element = ignorepath;
111+ if ( !ignorepath ) {
112+ ignorepath = xmalloc( sizeof( struct ignorepath_entry ) );
113+ ignorepath->next = 0;
114+ strcpy( &ignorepath->name[0], optarg );
115+ } else {
116+ while ( element->next ) element = element->next;
117+ element->next = xmalloc( sizeof( struct ignorepath_entry ) );
118+ element->next->next = 0;
119+ strcpy( &element->next->name[0], optarg );
120+ }
121+ printf( "--------- Dumping ignore path list ----------------\n" );
122+ element = ignorepath;
123+ while ( element ) {
124+ printf( " * '%s'\n", &element->name[0] );
125+ element = element->next;
126+ }
127+ printf( "---------------------------------------------------\n" );
128+ break;
129+
130 case 'o':
131 if (out_fd != -1) {
132 error_msg_and_die("output filename specified more than once");
133 }
134 out_fd = open(optarg, O_CREAT | O_TRUNC | O_RDWR, 0644);