diff options
Diffstat (limited to 'tools/squashfs4')
7 files changed, 173 insertions, 9 deletions
diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile index 04a5456f6c2..409b1b5a238 100644 --- a/tools/squashfs4/Makefile +++ b/tools/squashfs4/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 OpenWrt.org +# Copyright (C) 2009-2012 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -7,11 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=squashfs4 +PKG_CPE_ID:=cpe:/a:phillip_lougher:squashfs PKG_VERSION:=4.2 PKG_SOURCE:=squashfs$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/squashfs -PKG_MD5SUM:=1b7a781fb4cf8938842279bd3e8ee852 +PKG_HASH:=d9e0195aa922dbb665ed322b9aaa96e04a476ee650f39bbeadb0d00b24022e96 PKG_CAT:=zcat HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION) @@ -19,6 +20,7 @@ HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION) include $(INCLUDE_DIR)/host-build.mk define Host/Compile + +$(HOST_MAKE_VARS) \ $(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \ XZ_SUPPORT=1 \ LZMA_XZ_SUPPORT=1 \ diff --git a/tools/squashfs4/patches/130-include_sysmacros.patch b/tools/squashfs4/patches/130-include_sysmacros.patch new file mode 100644 index 00000000000..e8845130ef7 --- /dev/null +++ b/tools/squashfs4/patches/130-include_sysmacros.patch @@ -0,0 +1,20 @@ +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -33,6 +33,7 @@ + #include <stddef.h> + #include <sys/time.h> + #include <sys/types.h> ++#include <sys/sysmacros.h> + #include <sys/stat.h> + #include <fcntl.h> + #include <errno.h> +--- a/squashfs-tools/unsquashfs.c ++++ b/squashfs-tools/unsquashfs.c +@@ -30,6 +30,7 @@ + #include "xattr.h" + + #include <sys/types.h> ++#include <sys/sysmacros.h> + + struct cache *fragment_cache, *data_cache; + struct queue *to_reader, *to_deflate, *to_writer, *from_writer; diff --git a/tools/squashfs4/patches/160-expose_lzma_xz_options.patch b/tools/squashfs4/patches/160-expose_lzma_xz_options.patch index d6063969d27..9e1c1fbb1ea 100644 --- a/tools/squashfs4/patches/160-expose_lzma_xz_options.patch +++ b/tools/squashfs4/patches/160-expose_lzma_xz_options.patch @@ -40,6 +40,7 @@ + + +struct lzma_opts { ++ uint32_t dict_size; + uint32_t flags; +#define LZMA_OPT_FLT_MASK 0xffff +#define LZMA_OPT_PRE_OFF 16 @@ -53,7 +54,6 @@ +#define LZMA_OPT_PB_OFF 6 +#define LZMA_OPT_PB_MASK (0x7 << LZMA_OPT_PB_OFF) + uint16_t fb; -+ uint32_t dict_size; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN @@ -637,7 +637,7 @@ } name = argv[1]; -@@ -76,190 +73,50 @@ static int xz_options(char *argv[], int +@@ -76,190 +73,50 @@ static int xz_options(char *argv[], int } if(bcj[i].name == NULL) { fprintf(stderr, "xz: -Xbcj unrecognised " @@ -864,7 +864,7 @@ SQUASHFS_METADATA_SIZE; filter[0].filter[0].id = LZMA_FILTER_LZMA2; -@@ -323,14 +181,25 @@ static int xz_compress(void *strm, void +@@ -323,14 +181,25 @@ static int xz_compress(void *strm, void lzma_ret res = 0; struct xz_stream *stream = strm; struct filter *selected = NULL; diff --git a/tools/squashfs4/patches/170-add_support_for_LZMA_MAGIC_to_unsqashfs.patch b/tools/squashfs4/patches/170-add_support_for_LZMA_MAGIC_to_unsqashfs.patch index ad69b190ea9..bc7d6c7a4a0 100644 --- a/tools/squashfs4/patches/170-add_support_for_LZMA_MAGIC_to_unsqashfs.patch +++ b/tools/squashfs4/patches/170-add_support_for_LZMA_MAGIC_to_unsqashfs.patch @@ -16,7 +16,7 @@ #define SQUASHFS_METADATA_LOG 13 --- a/squashfs-tools/unsquashfs.c +++ b/squashfs-tools/unsquashfs.c -@@ -1463,10 +1463,12 @@ int read_super(char *source) +@@ -1464,10 +1464,12 @@ int read_super(char *source) */ read_fs_bytes(fd, SQUASHFS_START, sizeof(struct squashfs_super_block), &sBlk_4); @@ -31,7 +31,7 @@ sBlk_4.s_minor == 0) { s_ops.squashfs_opendir = squashfs_opendir_4; s_ops.read_fragment = read_fragment_4; -@@ -1479,7 +1481,11 @@ int read_super(char *source) +@@ -1480,7 +1482,11 @@ int read_super(char *source) /* * Check the compression type */ @@ -44,7 +44,7 @@ return TRUE; } -@@ -1494,8 +1500,10 @@ int read_super(char *source) +@@ -1495,8 +1501,10 @@ int read_super(char *source) * Check it is a SQUASHFS superblock */ swap = 0; @@ -57,7 +57,7 @@ squashfs_super_block_3 sblk; ERROR("Reading a different endian SQUASHFS filesystem " "on %s\n", source); -@@ -1573,7 +1581,11 @@ int read_super(char *source) +@@ -1574,7 +1582,11 @@ int read_super(char *source) /* * 1.x, 2.x and 3.x filesystems use gzip compression. */ diff --git a/tools/squashfs4/patches/180-openbsd_compat.patch b/tools/squashfs4/patches/180-openbsd_compat.patch new file mode 100644 index 00000000000..4f7afd89cc9 --- /dev/null +++ b/tools/squashfs4/patches/180-openbsd_compat.patch @@ -0,0 +1,24 @@ +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -32,6 +32,9 @@ + #include <stdio.h> + #include <stddef.h> + #include <sys/time.h> ++#if defined(__OpenBSD__) ++#include <sys/param.h> ++#endif + #include <sys/types.h> + #include <sys/sysmacros.h> + #include <sys/stat.h> +--- a/squashfs-tools/unsquashfs.h ++++ b/squashfs-tools/unsquashfs.h +@@ -25,6 +25,9 @@ + #define TRUE 1 + #define FALSE 0 + #include <stdio.h> ++#if defined(__OpenBSD__) ++#include <sys/param.h> ++#endif + #include <sys/types.h> + #include <unistd.h> + #include <stdlib.h> diff --git a/tools/squashfs4/patches/190-no_nonstatic_inline.patch b/tools/squashfs4/patches/190-no_nonstatic_inline.patch new file mode 100644 index 00000000000..8cab1208325 --- /dev/null +++ b/tools/squashfs4/patches/190-no_nonstatic_inline.patch @@ -0,0 +1,36 @@ +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -736,13 +736,13 @@ void cache_block_put(struct file_buffer + + (((char *)A) - data_cache))) + + +-inline void inc_progress_bar() ++static inline void inc_progress_bar() + { + cur_uncompressed ++; + } + + +-inline void update_progress_bar() ++static inline void update_progress_bar() + { + pthread_mutex_lock(&progress_mutex); + pthread_cond_signal(&progress_wait); +@@ -750,7 +750,7 @@ inline void update_progress_bar() + } + + +-inline void waitforthread(int i) ++static inline void waitforthread(int i) + { + TRACE("Waiting for thread %d\n", i); + while(thread[i] != 0) +@@ -3359,7 +3359,7 @@ struct inode_info *lookup_inode(struct s + } + + +-inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, ++static inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, + struct inode_info *inode_info, struct dir_info *dir) + { + if((dir->count % DIR_ENTRIES) == 0) { diff --git a/tools/squashfs4/patches/200-add-fixed-timestamp-option.patch b/tools/squashfs4/patches/200-add-fixed-timestamp-option.patch new file mode 100644 index 00000000000..7411b978449 --- /dev/null +++ b/tools/squashfs4/patches/200-add-fixed-timestamp-option.patch @@ -0,0 +1,82 @@ +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -176,6 +176,9 @@ unsigned int cache_bytes = 0, cache_size + /* inode lookup table */ + squashfs_inode *inode_lookup_table = NULL; + ++/* override all timestamps */ ++time_t fixed_time = -1; ++ + /* in memory directory data */ + #define I_COUNT_SIZE 128 + #define DIR_ENTRIES 32 +@@ -2453,6 +2456,8 @@ again: + restat: + fstat(file, &buf2); + close(file); ++ if (fixed_time != -1) ++ buf2.st_mtime = fixed_time; + if(read_size != buf2.st_size) { + memcpy(buf, &buf2, sizeof(struct stat)); + file_buffer->error = 2; +@@ -3613,7 +3618,7 @@ void dir_scan(squashfs_inode *inode, cha + buf.st_mode = S_IRWXU | S_IRWXG | S_IRWXO | S_IFDIR; + buf.st_uid = getuid(); + buf.st_gid = getgid(); +- buf.st_mtime = time(NULL); ++ buf.st_mtime = fixed_time != -1 ? fixed_time : time(NULL); + buf.st_dev = 0; + buf.st_ino = 0; + dir_ent->inode = lookup_inode(&buf); +@@ -3624,6 +3629,8 @@ void dir_scan(squashfs_inode *inode, cha + pathname, strerror(errno)); + return; + } ++ if(fixed_time != -1) ++ buf.st_mtime = fixed_time; + dir_ent->inode = lookup_inode(&buf); + } + +@@ -3678,6 +3685,8 @@ struct dir_info *dir_scan1(char *pathnam + filename, strerror(errno)); + continue; + } ++ if(fixed_time != -1) ++ buf.st_mtime = fixed_time; + + if((buf.st_mode & S_IFMT) != S_IFREG && + (buf.st_mode & S_IFMT) != S_IFDIR && +@@ -3796,7 +3805,7 @@ struct dir_info *dir_scan2(struct dir_in + buf.st_gid = pseudo_ent->dev->gid; + buf.st_rdev = makedev(pseudo_ent->dev->major, + pseudo_ent->dev->minor); +- buf.st_mtime = time(NULL); ++ buf.st_mtime = fixed_time != -1 ? fixed_time : time(NULL); + buf.st_ino = pseudo_ino ++; + + if(pseudo_ent->dev->type == 'f') { +@@ -4675,6 +4684,15 @@ int main(int argc, char *argv[]) + progress = FALSE; + else if(strcmp(argv[i], "-no-exports") == 0) + exportable = FALSE; ++ else if(strcmp(argv[i], "-fixed-time") == 0) { ++ if((++i == argc) || (fixed_time = ++ strtoll(argv[i], &b, 10), *b != '\0')) { ++ ERROR("%s: -fixed-time missing or invalid " ++ "timestamp\n", argv[0]); ++ ++ exit(1); ++ } ++ } + else if(strcmp(argv[i], "-processors") == 0) { + if((++i == argc) || (processors = + strtol(argv[i], &b, 10), *b != '\0')) { +@@ -5315,7 +5333,7 @@ printOptions: + sBlk.flags = SQUASHFS_MKFLAGS(noI, noD, noF, noX, no_fragments, + always_use_fragments, duplicate_checking, exportable, + no_xattrs, comp_opts); +- sBlk.mkfs_time = time(NULL); ++ sBlk.mkfs_time = fixed_time != -1 ? fixed_time : time(NULL); + + restore_filesystem: + if(progress && estimated_uncompressed) { |
