0

我正在尝试从源代码(GPL 源)编译修改后的 squashfs 工具。原始包中的安装“自述文件”有注释,它可以在不需要修补内核的情况下构建。(本地)

2. 构建 squashfs 工具
squashfs-tools 目录包含 mksquashfs 和 unsquashfs 程序。这些可以通过键入 make 来完成。源文件使用 squashfs_fs.h 的本地副本(包含在内核补丁中),无需修补内核即可制作工具。

执行make给出错误:Makefile:2: *** Sqlzma is not defined. Stop.sqlzma 文件 icludesqlzma.h位于另一个文件夹“sqlzma-3.4-457”中。我认为,问题可能与这些外部文件的链接有关,但我不确定。我一般是编程新手。

'squashfs-tools' 文件夹中的Makefile :

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)

“sqlzma-3.4-457”文件夹中的Makefile :


# 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

指向squashfssqlzma文件夹的链接。

4

0 回答 0