Reputation: 151
I'm trying to compile modified squashfs tools from source code (GPL source). Installation 'readme' from original pack have notes that it can be built without needing to patch the kernel.(locally)
2. Building squashfs tools The squashfs-tools directory contains the mksquashfs and unsquashfs programs. These can be made by typing make. The source files use a local copy of squashfs_fs.h (included in the kernel patches) allowing the tools to be made without needing to patch the kernel.
Executing make
gives error: Makefile:2: *** Sqlzma is not defined. Stop.
The sqlzma files, iclude sqlzma.h
are located in another folder, 'sqlzma-3.4-457'.
I assume, the problem may be related with links to those external files, but I'm not sure. I'm new to programming in general.
Makefile in 'squashfs-tools' folder:
ifndef Sqlzma
$(error Sqlzma is not defined)
endif
INSTALL_DIR = /usr/local/bin
INCLUDEDIR = .
CFLAGS := -I$(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -O2
ifdef UseDebugFlags
DebugFlags = -g -Wall -Wno-unused-variable -O0 -UNDEBUG
endif
CFLAGS += -I${Sqlzma} -D_REENTRANT -DNDEBUG ${DebugFlags}
LDFLAGS += -L${LzmaAlone} -L${LzmaC}
all: mksquashfs unsquashfs
mksquashfs: mksquashfs.o read_fs.o sort.o
#$(CC) $(LDFLAGS) mksquashfs.o read_fs.o sort.o -lz -lpthread -lm -lunlzma_r -llzma_r -lstdc++ -o $@
g++ $(LDFLAGS) mksquashfs.o read_fs.o sort.o -lz -lpthread -lm -lunlzma_r -llzma_r -lstdc++ -o $@
mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h \
${Sqlzma}/sqlzma.h ${Sqlzma}/sqmagic.h \
${LzmaAlone}/liblzma_r.a ${LzmaC}/libunlzma_r.a
read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h \
${Sqlzma}/sqlzma.h ${Sqlzma}/sqmagic.h
sort.o: sort.c squashfs_fs.h global.h sort.h
unsquashfs: unsquashfs.o
$(CC) $(LDFLAGS) unsquashfs.o -lpthread -lm -lunlzma -lz -o $@
unsquashfs.o: unsquashfs.c squashfs_fs.h read_fs.h global.h \
${Sqlzma}/sqlzma.h ${Sqlzma}/sqmagic.h ${LzmaC}/libunlzma.a
clean:
-rm -f *.o mksquashfs unsquashfs
install: mksquashfs unsquashfs
mkdir -p $(INSTALL_DIR)
cp mksquashfs unsquashfs $(INSTALL_DIR)
Makefile in "sqlzma-3.4-457" folder:
# Copyright (C) 2006-2008 Junjiro Okajima
# Copyright (C) 2006-2008 Tomas Matejicek, slax.org
#
# LICENSE follows the described ones in lzma and squashfs.
# $Id: Makefile,v 1.1.1.1 2010/11/11 13:20:13 nash Exp $
# paths
Sqlzma = ${CURDIR}
LzmaVer = lzma457
Lzma = ${Sqlzma}/${LzmaVer}
SqVer = squashfs3.4
Squashfs = ${Sqlzma}/${SqVer}
KVer = linux-2.6.27.4
SqFs = ${Squashfs}/kernel-patches/${KVer}/fs/squashfs
#KDir = /lib/modules/$(shell uname -r)/build
#KDir = ${SqFs}/../..
ifeq (${LzmaVer}, lzma443)
LzmaC = ${Lzma}/C/7zip/Compress/LZMA_C
LzmaAlone = ${Lzma}/C/7zip/Compress/LZMA_Alone
else
LzmaC = ${Lzma}/C/Compress/Lzma
LzmaAlone = ${Lzma}/CPP/7zip/Compress/LZMA_Alone
endif
SqTools = ${Squashfs}/squashfs-tools
# enable it if you want to add -g option when compiling
#UseDebugFlags = 1
#MyDebugFlags = -DSQUASHFS_TRACE
# disable it if you don't want to compile squashfs kernel module here
#BuildSquashfs = 1
export
all:
${MAKE} -C ${LzmaC} -f sqlzma.mk $@
${MAKE} -C ${LzmaAlone} -f sqlzma.mk $@
#${MAKE} -C ${SqTools} $@
clean:
${MAKE} -C ${LzmaC} -f sqlzma.mk $@
${MAKE} -C ${LzmaAlone} -f sqlzma.mk $@
#${MAKE} -C ${SqTools} $@
${RM} *~
########################################
-include priv.mk
ifdef BuildSquashfs
CONFIG_SQUASHFS = m
CONFIG_SQUASHFS_EMBEDDED =
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE = 3
EXTRA_CFLAGS = -I${Sqlzma} -I${SqFs}/../../include -Wall -Werror
EXTRA_CFLAGS += -DCONFIG_SQUASHFS_MODULE -UCONFIG_SQUASHFS
EXTRA_CFLAGS += -UCONFIG_SQUASHFS_EMBEDDED -DCONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
# if you enabled CONFIG_PREEMPT, but want CPU to try concentrating
# the uncompression, then define UnsquashNoPreempt.
# if you don't define UnsquashNoPreempt, the behaviour follows
# the CONFIG_PREEMPT.
EXTRA_CFLAGS += -DUnsquashNoPreempt
export
# the environment variables are not inherited since 2.6.23
MAKE += SQLZMA_EXTRA_CFLAGS="$(shell echo ${EXTRA_CFLAGS} | sed -e 's/\"/\\\\\\"/g')"
all: all_sq
FORCE:
all_sq:
${MAKE} -C ${KDir} M=${SqFs} modules
clean: clean_sq
clean_sq:
${MAKE} -C ${KDir} M=${SqFs} clean
endif
########################################
load:
for i in ${LzmaC}/kmod/unlzma.ko ${LzmaC}/kmod/sqlzma.ko \
${SqFs}/squashfs.ko; \
do sudo insmod $$i; done
unload:
-sudo rmmod squashfs sqlzma unlzma
Links to squashfs and sqlzma folders.
Upvotes: 0
Views: 895