Skip to content

Commit

Permalink
tools/squashfs4: update to version 4.2 (adds support for xz compression)
Browse files Browse the repository at this point in the history
Based on a patch by Jonas Gorski

SVN-Revision: 26422
  • Loading branch information
Felix Fietkau committed Apr 3, 2011
1 parent b9e759a commit e6aa1ca
Show file tree
Hide file tree
Showing 12 changed files with 1,036 additions and 2,379 deletions.
10 changes: 9 additions & 1 deletion include/image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ ifneq ($(CONFIG_JFFS2_LZMA),y)
JFFS2OPTS += -x lzma
endif

LZMA_XZ_OPTIONS := -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2
ifeq ($(CONFIG_SQUASHFS_LZMA),y)
SQUASHFSCOMP := lzma $(LZMA_XZ_OPTIONS)
endif
ifeq ($(CONFIG_SQUASHFS_XZ),y)
SQUASHFSCOMP := xz $(LZMA_XZ_OPTIONS)
endif

JFFS2_BLOCKSIZE ?= 64k 128k

define add_jffs2_mark
Expand Down Expand Up @@ -86,7 +94,7 @@ else
ifneq ($(CONFIG_TARGET_ROOTFS_SQUASHFS),)
define Image/mkfs/squashfs
@mkdir -p $(TARGET_DIR)/overlay
$(STAGING_DIR_HOST)/bin/mksquashfs4 $(TARGET_DIR) $(KDIR)/root.squashfs -nopad -noappend -root-owned -comp lzma -processors 1
$(STAGING_DIR_HOST)/bin/mksquashfs4 $(TARGET_DIR) $(KDIR)/root.squashfs -nopad -noappend -root-owned -comp $(SQUASHFSCOMP) -processors 1
$(call Image/Build,squashfs)
endef
endif
Expand Down
2 changes: 1 addition & 1 deletion tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $(curdir)/bison/compile := $(curdir)/flex/install
$(curdir)/pkg-config/compile := $(curdir)/sed/install
$(curdir)/libtool/compile := $(curdir)/sed/install
$(curdir)/squashfs/compile := $(curdir)/lzma-old/install
$(curdir)/squashfs4/compile := $(curdir)/lzma/install
$(curdir)/squashfs4/compile := $(curdir)/xz/install
$(curdir)/quilt/compile := $(curdir)/sed/install $(curdir)/autoconf/install
$(curdir)/dtc/compile := $(curdir)/bison/install
$(curdir)/autoconf/compile := $(curdir)/m4/install $(curdir)/libtool/install
Expand Down
4 changes: 1 addition & 3 deletions tools/lzma/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ define Host/Compile
endef

define Host/Install
$(INSTALL_DIR) $(STAGING_DIR_HOST)/lib $(STAGING_DIR_HOST)/include $(STAGING_DIR_HOST)/bin
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
$(INSTALL_BIN) $(HOST_BUILD_DIR)/CPP/7zip/Compress/LZMA_Alone/lzma_alone $(STAGING_DIR_HOST)/bin/lzma
$(CP) $(HOST_BUILD_DIR)/C/*.h $(STAGING_DIR_HOST)/include/
$(CP) $(UTIL_DIR)/liblzma.a $(STAGING_DIR_HOST)/lib/
endef

define Host/Clean
Expand Down
10 changes: 6 additions & 4 deletions tools/squashfs4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=squashfs4
PKG_VERSION:=4.0
PKG_VERSION:=4.2

PKG_SOURCE:=squashfs$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/squashfs
PKG_MD5SUM:=a3c23391da4ebab0ac4a75021ddabf96
PKG_MD5SUM:=1b7a781fb4cf8938842279bd3e8ee852
PKG_CAT:=zcat

HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION)
Expand All @@ -20,9 +20,11 @@ include $(INCLUDE_DIR)/host-build.mk

define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \
USE_LZMA=1 \
LZMA_CFLAGS="-I$(STAGING_DIR_HOST)/include -DUSE_LZMA" \
XZ_SUPPORT=1 \
LZMA_XZ_SUPPORT=1 \
XATTR_SUPPORT= \
LZMA_LIB="$(STAGING_DIR_HOST)/lib/liblzma.a" \
EXTRA_CFLAGS="-I$(STAGING_DIR_HOST)/include" \
mksquashfs unsquashfs
endef

Expand Down
30 changes: 23 additions & 7 deletions tools/squashfs4/patches/100-portability.patch
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
--- a/squashfs-tools/global.h
+++ b/squashfs-tools/global.h
@@ -44,4 +44,8 @@ typedef long long squashfs_fragment_inde
typedef squashfs_inode_t squashfs_inode;
typedef squashfs_block_t squashfs_block;
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -60,6 +60,10 @@
#include <sys/sysinfo.h>
#endif

+#ifndef FNM_EXTMATCH
+#define FNM_EXTMATCH 0
+#endif
+
#endif
#ifdef SQUASHFS_TRACE
#define TRACE(s, args...) \
do { \
--- a/squashfs-tools/unsquashfs.h
+++ b/squashfs-tools/unsquashfs.h
@@ -49,8 +49,10 @@
@@ -49,8 +49,14 @@
#define __BYTE_ORDER BYTE_ORDER
#define __BIG_ENDIAN BIG_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#include <sys/sysctl.h>
#else
#include <endian.h>
+#include <sys/sysinfo.h>
+#endif
+
+#ifndef FNM_EXTMATCH
+#define FNM_EXTMATCH 0
#endif

#include "squashfs_fs.h"
--- a/squashfs-tools/unsquashfs.c
+++ b/squashfs-tools/unsquashfs.c
@@ -29,7 +29,6 @@
#include "compressor.h"
#include "xattr.h"

-#include <sys/sysinfo.h>
#include <sys/types.h>

struct cache *fragment_cache, *data_cache;
30 changes: 30 additions & 0 deletions tools/squashfs4/patches/110-allow_static_liblzma.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--- a/squashfs-tools/Makefile
+++ b/squashfs-tools/Makefile
@@ -129,7 +129,6 @@ ifeq ($(LZMA_XZ_SUPPORT),1)
CFLAGS += -DLZMA_SUPPORT
MKSQUASHFS_OBJS += lzma_xz_wrapper.o
UNSQUASHFS_OBJS += lzma_xz_wrapper.o
-LIBS += -llzma
COMPRESSORS += lzma
endif

@@ -137,10 +136,18 @@ ifeq ($(XZ_SUPPORT),1)
CFLAGS += -DXZ_SUPPORT
MKSQUASHFS_OBJS += xz_wrapper.o
UNSQUASHFS_OBJS += xz_wrapper.o
-LIBS += -llzma
COMPRESSORS += xz
endif

+ifneq ($(LZMA_XZ_SUPPORT)$(XZ_SUPPORT),)
+ifneq ($(LZMA_LIB),)
+MKSQUASHFS_OBJS += $(LZMA_LIB)
+UNSQUASHFS_OBJS += $(LZMA_LIB)
+else
+LIBS += -llzma
+endif
+endif
+
ifeq ($(LZO_SUPPORT),1)
CFLAGS += -DLZO_SUPPORT
ifdef LZO_DIR
Loading

0 comments on commit e6aa1ca

Please sign in to comment.