aboutsummaryrefslogtreecommitdiff
path: root/jffsX-utils
diff options
context:
space:
mode:
Diffstat (limited to 'jffsX-utils')
-rw-r--r--jffsX-utils/Makemodule.am40
-rw-r--r--jffsX-utils/compr.c8
-rw-r--r--jffsX-utils/compr.h6
-rw-r--r--jffsX-utils/compr_lzo.c15
-rw-r--r--jffsX-utils/jffs2dump.c6
-rw-r--r--jffsX-utils/jffs2reader.c12
-rw-r--r--jffsX-utils/mkfs.jffs2.14
-rw-r--r--jffsX-utils/mkfs.jffs2.c15
8 files changed, 52 insertions, 54 deletions
diff --git a/jffsX-utils/Makemodule.am b/jffsX-utils/Makemodule.am
index fb181de..266c12e 100644
--- a/jffsX-utils/Makemodule.am
+++ b/jffsX-utils/Makemodule.am
@@ -1,37 +1,39 @@
mkfs_jffs2_SOURCES = \
jffsX-utils/mkfs.jffs2.c \
jffsX-utils/rbtree.h \
- jffsX-utils/compr_zlib.c \
jffsX-utils/compr.h \
jffsX-utils/rbtree.c \
- jffsX-utils/compr_lzo.c \
jffsX-utils/compr.c \
- jffsX-utils/compr_rtime.c
+ jffsX-utils/compr_rtime.c \
+ jffsX-utils/compr.h \
+ jffsX-utils/rbtree.h \
+ jffsX-utils/summary.h \
+ include/linux/jffs2.h \
+ include/mtd/jffs2-user.h
mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS)
mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS)
-jffs2reader_SOURCES = jffsX-utils/jffs2reader.c
+jffs2reader_SOURCES = jffsX-utils/jffs2reader.c include/mtd/jffs2-user.h
jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS)
+jffs2reader_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS)
-jffs2dump_SOURCES = jffsX-utils/jffs2dump.c
+jffs2dump_SOURCES = jffsX-utils/jffs2dump.c include/mtd/jffs2-user.h
+jffs2dump_SOURCES += jffsX-utils/summary.h
jffs2dump_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS)
+jffs2dump_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS)
-sumtool_SOURCES = jffsX-utils/sumtool.c
+sumtool_SOURCES = jffsX-utils/sumtool.c jffsX-utils/summary.h
sumtool_LDADD = libmtd.a
-JFFSX_BINS = \
- mkfs.jffs2 jffs2dump jffs2reader sumtool
-
-JFFSX_MAN = \
- jffsX-utils/mkfs.jffs2.1
-
-JFFSX_EXTRA = \
- jffsX-utils/device_table.txt jffsX-utils/mkfs.jffs2.1
+if WITH_LZO
+mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c
+endif
-JFFSX_HEADER = \
- jffsX-utils/compr.h jffsX-utils/rbtree.h jffsX-utils/summary.h
+if WITH_ZLIB
+mkfs_jffs2_SOURCES += jffsX-utils/compr_zlib.c
+endif
-EXTRA_DIST += $(JFFSX_HEADER) $(JFFSX_EXTRA)
+EXTRA_DIST += jffsX-utils/device_table.txt jffsX-utils/mkfs.jffs2.1
-dist_man1_MANS += $(JFFSX_MAN)
-sbin_PROGRAMS += $(JFFSX_BINS)
+dist_man1_MANS += jffsX-utils/mkfs.jffs2.1
+sbin_PROGRAMS += mkfs.jffs2 jffs2dump jffs2reader sumtool
diff --git a/jffsX-utils/compr.c b/jffsX-utils/compr.c
index cb4432e..01176eb 100644
--- a/jffsX-utils/compr.c
+++ b/jffsX-utils/compr.c
@@ -511,13 +511,13 @@ reinsert:
int jffs2_compressors_init(void)
{
-#ifdef CONFIG_JFFS2_ZLIB
+#ifdef WITH_ZLIB
jffs2_zlib_init();
#endif
#ifdef CONFIG_JFFS2_RTIME
jffs2_rtime_init();
#endif
-#ifdef CONFIG_JFFS2_LZO
+#ifdef WITH_LZO
jffs2_lzo_init();
#endif
return 0;
@@ -528,10 +528,10 @@ int jffs2_compressors_exit(void)
#ifdef CONFIG_JFFS2_RTIME
jffs2_rtime_exit();
#endif
-#ifdef CONFIG_JFFS2_ZLIB
+#ifdef WITH_ZLIB
jffs2_zlib_exit();
#endif
-#ifdef CONFIG_JFFS2_LZO
+#ifdef WITH_LZO
jffs2_lzo_exit();
#endif
return 0;
diff --git a/jffsX-utils/compr.h b/jffsX-utils/compr.h
index a21e935..f1f5975 100644
--- a/jffsX-utils/compr.h
+++ b/jffsX-utils/compr.h
@@ -16,9 +16,7 @@
#include <stdint.h>
#include "linux/jffs2.h"
-#define CONFIG_JFFS2_ZLIB
#define CONFIG_JFFS2_RTIME
-#define CONFIG_JFFS2_LZO
#define JFFS2_RUBINMIPS_PRIORITY 10
#define JFFS2_DYNRUBIN_PRIORITY 20
@@ -103,7 +101,7 @@ char *jffs2_stats(void);
/* Compressor modules */
/* These functions will be called by jffs2_compressors_init/exit */
-#ifdef CONFIG_JFFS2_ZLIB
+#ifdef WITH_ZLIB
int jffs2_zlib_init(void);
void jffs2_zlib_exit(void);
#endif
@@ -111,7 +109,7 @@ void jffs2_zlib_exit(void);
int jffs2_rtime_init(void);
void jffs2_rtime_exit(void);
#endif
-#ifdef CONFIG_JFFS2_LZO
+#ifdef WITH_LZO
int jffs2_lzo_init(void);
void jffs2_lzo_exit(void);
#endif
diff --git a/jffsX-utils/compr_lzo.c b/jffsX-utils/compr_lzo.c
index 56aa1b4..ddd8d55 100644
--- a/jffsX-utils/compr_lzo.c
+++ b/jffsX-utils/compr_lzo.c
@@ -24,8 +24,6 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-
-#ifndef WITHOUT_LZO
#include <asm/types.h>
#include <linux/jffs2.h>
#include <lzo/lzo1x.h>
@@ -121,16 +119,3 @@ void jffs2_lzo_exit(void)
free(lzo_compress_buf);
free(lzo_mem);
}
-
-#else
-
-int jffs2_lzo_init(void)
-{
- return 0;
-}
-
-void jffs2_lzo_exit(void)
-{
-}
-
-#endif
diff --git a/jffsX-utils/jffs2dump.c b/jffsX-utils/jffs2dump.c
index d30b59f..30455ea 100644
--- a/jffsX-utils/jffs2dump.c
+++ b/jffsX-utils/jffs2dump.c
@@ -757,6 +757,12 @@ int main(int argc, char **argv)
// get image length
imglen = lseek(fd, 0, SEEK_END);
+ if (imglen < 0) {
+ perror(img);
+ close(fd);
+ exit(EXIT_FAILURE);
+ }
+
lseek (fd, 0, SEEK_SET);
data = malloc (imglen);
diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c
index 083500e..87a2167 100644
--- a/jffsX-utils/jffs2reader.c
+++ b/jffsX-utils/jffs2reader.c
@@ -75,7 +75,11 @@ BUGS:
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
+#ifdef WITH_ZLIB
#include <zlib.h>
+#else
+typedef unsigned long uLongf;
+#endif
#include "mtd/jffs2-user.h"
#include "common.h"
@@ -132,12 +136,13 @@ static void putblock(char *b, size_t bsize, size_t * rsize,
bzero(b + *rsize, je32_to_cpu(n->isize) - *rsize);
switch (n->compr) {
+#ifdef WITH_ZLIB
case JFFS2_COMPR_ZLIB:
uncompress((Bytef *) b + je32_to_cpu(n->offset), &dlen,
(Bytef *) ((char *) n) + sizeof(struct jffs2_raw_inode),
(uLongf) je32_to_cpu(n->csize));
break;
-
+#endif
case JFFS2_COMPR_NONE:
memcpy(b + je32_to_cpu(n->offset),
((char *) n) + sizeof(struct jffs2_raw_inode), dlen);
@@ -336,8 +341,9 @@ static void printdir(char *o, size_t size, struct dir *d, const char *path,
d = d->next;
continue;
}
-
- filetime = ctime((const time_t *) &(ri->ctime));
+ time_t _ctime;
+ memcpy(&_ctime, &(ri->ctime), sizeof(time_t));
+ filetime = ctime(&_ctime);
age = time(NULL) - je32_to_cpu(ri->ctime);
mode.v32 = ri->mode.m;
printf("%s %-4d %-8d %-8d ", mode_string(je32_to_cpu(mode)),
diff --git a/jffsX-utils/mkfs.jffs2.1 b/jffsX-utils/mkfs.jffs2.1
index 7c57ddc..75f96f5 100644
--- a/jffsX-utils/mkfs.jffs2.1
+++ b/jffsX-utils/mkfs.jffs2.1
@@ -119,13 +119,13 @@ the kernel can be changed with a #define to accept images of the
non-native endianness. Full bi-endian support in the kernel is not
planned.
-It is unlikely that JFFS2 images are useful except in conjuction
+It is unlikely that JFFS2 images are useful except in conjunction
with the MTD (Memory Technology Device) drivers in the Linux
kernel, since the JFFS2 file system driver in the kernel requires
MTD devices.
.SH OPTIONS
Options that take SIZE arguments can be specified as either
-decimal (e.g., 65536), octal (0200000), or hexidecimal (0x1000).
+decimal (e.g., 65536), octal (0200000), or hexadecimal (0x1000).
.TP
.B -p, --pad[=SIZE]
Pad output to SIZE bytes with 0xFF. If SIZE is not specified,
diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c
index 9cc5eaf..b9dd96b 100644
--- a/jffsX-utils/mkfs.jffs2.c
+++ b/jffsX-utils/mkfs.jffs2.c
@@ -65,7 +65,7 @@
#include <ctype.h>
#include <time.h>
#include <getopt.h>
-#ifndef WITHOUT_XATTR
+#ifdef WITH_XATTR
#include <sys/xattr.h>
#include <sys/acl.h>
#endif
@@ -978,7 +978,7 @@ static void write_special_file(struct filesystem_entry *e)
padword();
}
-#ifndef WITHOUT_XATTR
+#ifdef WITH_XATTR
typedef struct xattr_entry {
struct xattr_entry *next;
uint32_t xid;
@@ -1209,7 +1209,7 @@ static void write_xattr_entry(struct filesystem_entry *e)
}
}
-#else /* WITHOUT_XATTR */
+#else /* WITH_XATTR */
#define write_xattr_entry(x)
#endif
@@ -1380,7 +1380,7 @@ static struct option long_options[] = {
{"test-compression", 0, NULL, 't'},
{"compressor-priority", 1, NULL, 'y'},
{"incremental", 1, NULL, 'i'},
-#ifndef WITHOUT_XATTR
+#ifdef WITH_XATTR
{"with-xattr", 0, NULL, 1000 },
{"with-selinux", 0, NULL, 1001 },
{"with-posix-acl", 0, NULL, 1002 },
@@ -1401,7 +1401,8 @@ static const char helptext[] =
" page size (default: 4KiB)\n"
" -e, --eraseblock=SIZE Use erase block size SIZE (default: 64KiB)\n"
" -c, --cleanmarker=SIZE Size of cleanmarker (default 12)\n"
-" -m, --compr-mode=MODE Select compression mode (default: priority)\n"
+" -m, --compression-mode=MODE\n"
+" Select compression mode (default: priority)\n"
" -x, --disable-compressor=COMPRESSOR_NAME\n"
" Disable a compressor\n"
" -X, --enable-compressor=COMPRESSOR_NAME\n"
@@ -1419,7 +1420,7 @@ static const char helptext[] =
" -q, --squash Squash permissions and owners making all files be owned by root\n"
" -U, --squash-uids Squash owners making all files be owned by root\n"
" -P, --squash-perms Squash permissions on all files\n"
-#ifndef WITHOUT_XATTR
+#ifdef WITH_XATTR
" --with-xattr stuff all xattr entries into image\n"
" --with-selinux stuff only SELinux Labels into jffs2 image\n"
" --with-posix-acl stuff only POSIX ACL entries into jffs2 image\n"
@@ -1744,7 +1745,7 @@ int main(int argc, char **argv)
sys_errmsg_die("cannot open (incremental) file");
}
break;
-#ifndef WITHOUT_XATTR
+#ifdef WITH_XATTR
case 1000: /* --with-xattr */
enable_xattr |= (1 << JFFS2_XPREFIX_USER)
| (1 << JFFS2_XPREFIX_SECURITY)