From: Christian Marangi Date: Mon, 6 Feb 2023 22:07:24 +0000 (+0100) Subject: tools/squashfs: rename to squashfs3-lzma X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=01262c921c7cbafc9a32b912e42c58982f47725c;p=openwrt%2Fstaging%2Fdangole.git tools/squashfs: rename to squashfs3-lzma The name of squashfs is confusing since in reality it's a really old version using an old lzma library. This tools is used for old ath79 netgear target and to produde a fake squasfs3 image needed for some specific bootloader from some OEM (AVM for example) Rename squashfs tool to squasfs3-lzma to better describe it. Rename the installed bin from mksquashfs-lzma to mksquashfs3-lzma. Use tar transform to migrate the root directory in tar to the new naming. Drop redundant PKG_CAT variable not needed anymore. Also update any user of this tool. Signed-off-by: Christian Marangi --- diff --git a/include/image-commands.mk b/include/image-commands.mk index 70055cc576..47d9d1ab88 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -106,7 +106,7 @@ endef define Build/append-squashfs-fakeroot-be rm -rf $@.fakefs $@.fakesquashfs mkdir $@.fakefs - $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \ + $(STAGING_DIR_HOST)/bin/mksquashfs3-lzma \ $@.fakefs $@.fakesquashfs \ -noappend -root-owned -be -nopad -b 65536 \ $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH)) diff --git a/target/linux/ath79/image/common-netgear.mk b/target/linux/ath79/image/common-netgear.mk index 5a61caf1f6..c3b20cf1dc 100644 --- a/target/linux/ath79/image/common-netgear.mk +++ b/target/linux/ath79/image/common-netgear.mk @@ -12,7 +12,7 @@ define Build/netgear-squashfs rm -rf $@.fs $@.squashfs mkdir -p $@.fs/image cp $@ $@.fs/image/uImage - $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \ + $(STAGING_DIR_HOST)/bin/mksquashfs3-lzma \ $@.fs $@.squashfs -be \ -noappend -root-owned -b 65536 \ $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH)) diff --git a/tools/Makefile b/tools/Makefile index 7b3a8eb142..aa80ee4ba6 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -71,7 +71,7 @@ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_LZ4_TOOLS),y) += lz4 tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_LZO_TOOLS),y) += lzop tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_TOOLCHAIN),y) += gmp mpc mpfr tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini),y) += genext2fs -tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_ath79),y) += lzma-old squashfs +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_ath79),y) += lzma-old squashfs3-lzma tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_mxs),y) += elftosb sdimage tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_realtek),y) += 7z tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_tegra),y) += cbootimage cbootimage-configs @@ -116,7 +116,7 @@ $(curdir)/patchelf/compile := $(curdir)/libtool/compile $(curdir)/pkgconf/compile := $(curdir)/meson/compile $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile $(curdir)/sdcc/compile := $(curdir)/bison/compile -$(curdir)/squashfs/compile := $(curdir)/lzma-old/compile +$(curdir)/squashfs3-lzma/compile := $(curdir)/lzma-old/compile $(curdir)/squashfskit4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zstd/compile := $(curdir)/meson/compile diff --git a/tools/squashfs/Makefile b/tools/squashfs/Makefile deleted file mode 100644 index 385cf69d9d..0000000000 --- a/tools/squashfs/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (C) 2006-2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -PKG_NAME:=squashfs -PKG_CPE_ID:=cpe:/a:phillip_lougher:squashfs -PKG_VERSION:=3.0 - -PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=@SF/squashfs -PKG_HASH:=39dbda43cf118536deb746c7730b468702d514a19f4cfab73b710e32908ddf20 -PKG_CAT:=zcat - -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)$(PKG_VERSION) - -include $(INCLUDE_DIR)/host-build.mk - -define Host/Compile - $(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \ - CC="$(HOSTCC)" \ - CFLAGS="$(HOST_CFLAGS) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I." \ - CXX="$(CXX)" \ - LZMAPATH=$(STAGING_DIR_HOST)/lib \ - mksquashfs-lzma unsquashfs-lzma -endef - -define Host/Install - $(INSTALL_BIN) $(HOST_BUILD_DIR)/squashfs-tools/mksquashfs-lzma $(STAGING_DIR_HOST)/bin/ - $(INSTALL_BIN) $(HOST_BUILD_DIR)/squashfs-tools/unsquashfs-lzma $(STAGING_DIR_HOST)/bin/ -endef - -define Host/Clean - rm -f $(STAGING_DIR_HOST)/bin/mksquashfs-lzma - rm -f $(STAGING_DIR_HOST)/bin/unsquashfs-lzma -endef - -$(eval $(call HostBuild)) diff --git a/tools/squashfs/patches/100-lzma.patch b/tools/squashfs/patches/100-lzma.patch deleted file mode 100644 index 73f6a4e055..0000000000 --- a/tools/squashfs/patches/100-lzma.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/squashfs-tools/Makefile -+++ b/squashfs-tools/Makefile -@@ -7,6 +7,9 @@ all: mksquashfs unsquashfs - mksquashfs: mksquashfs.o read_fs.o sort.o - $(CC) mksquashfs.o read_fs.o sort.o -lz -o $@ - -+mksquashfs-lzma: mksquashfs.o read_fs.o sort.o -+ $(CXX) mksquashfs.o read_fs.o sort.o -L$(LZMAPATH) -llzma-old -o $@ -+ - mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h - - read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h -@@ -16,4 +19,9 @@ sort.o: sort.c squashfs_fs.h global.h so - unsquashfs: unsquashfs.o - $(CC) unsquashfs.o -lz -o $@ - -+unsquashfs-lzma: unsquashfs.o -+ $(CXX) unsquashfs.o -L$(LZMAPATH) -llzma-old -o $@ -+ - unsquashfs.o: unsquashfs.c squashfs_fs.h read_fs.h global.h -+ -+clean: diff --git a/tools/squashfs/patches/110-no_nonstatic_inline.patch b/tools/squashfs/patches/110-no_nonstatic_inline.patch deleted file mode 100644 index 8e288f336e..0000000000 --- a/tools/squashfs/patches/110-no_nonstatic_inline.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/squashfs-tools/mksquashfs.c -+++ b/squashfs-tools/mksquashfs.c -@@ -1347,7 +1347,7 @@ struct inode_info *lookup_inode(struct s - } - - --inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, struct inode_info *inode_info, void *data, struct dir_info *dir) -+static inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, struct inode_info *inode_info, void *data, struct dir_info *dir) - { - if((dir->count % DIR_ENTRIES) == 0) - if((dir->list = realloc(dir->list, (dir->count + DIR_ENTRIES) * sizeof(struct dir_ent *))) == NULL) diff --git a/tools/squashfs/patches/120-add-fixed-timestamp-support.patch b/tools/squashfs/patches/120-add-fixed-timestamp-support.patch deleted file mode 100644 index e2f4bb2e04..0000000000 --- a/tools/squashfs/patches/120-add-fixed-timestamp-support.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- a/squashfs-tools/mksquashfs.c -+++ b/squashfs-tools/mksquashfs.c -@@ -117,6 +117,9 @@ unsigned int inode_bytes = 0, inode_size - char *data_cache = NULL; - unsigned int cache_bytes = 0, cache_size = 0, inode_count = 0; - -+/* override all timestamps */ -+time_t fixed_time = -1; -+ - /* in memory directory data */ - #define I_COUNT_SIZE 128 - #define DIR_ENTRIES 32 -@@ -1554,6 +1557,11 @@ void dir_scan(squashfs_inode *inode, cha - perror(buffer); - return; - } -+ -+ /* override timestamp of lstat if fixed_time is given */ -+ if(fixed_time != -1) -+ inode_info->buf.st_mtime = fixed_time; -+ - if(sorted) - sort_files_and_write(dir_info); - dir_scan2(inode, dir_info); -@@ -1582,6 +1590,10 @@ struct dir_info *dir_scan1(char *pathnam - perror(buffer); - continue; - } -+ -+ if(fixed_time != -1) -+ buf.st_mtime = fixed_time; -+ - if(excluded(filename, &buf)) - continue; - -@@ -1621,6 +1633,9 @@ int dir_scan2(squashfs_inode *inode, str - char *dir_name = dir_ent->name; - unsigned int inode_number = ((buf->st_mode & S_IFMT) == S_IFDIR) ? dir_ent->inode->inode_number : dir_ent->inode->inode_number + dir_inode_no; - -+ if(fixed_time != -1) -+ buf->st_mtime = fixed_time; -+ - if(dir_ent->inode->inode == SQUASHFS_INVALID_BLK) { - switch(buf->st_mode & S_IFMT) { - case S_IFREG: -@@ -1898,6 +1913,16 @@ int main(int argc, char *argv[]) - exit(1); - } - } -+ } else if(strcmp(argv[i], "-fixed-time") == 0) { -+ if(++i == argc) { -+ ERROR("%s: -fixed-time missing a timestamp\n", argv[0]); -+ exit(1); -+ } -+ fixed_time = strtoll(argv[i], &b, 10); -+ if(*b != '\0') { -+ ERROR("%s: -fixed-time has an invalid number\n", argv[0]); -+ exit(1); -+ } - } else if(strcmp(argv[i], "-noI") == 0 || - strcmp(argv[i], "-noInodeCompression") == 0) - noI = TRUE; -@@ -1967,6 +1992,7 @@ printOptions: - ERROR("-all-root\t\tmake all files owned by root\n"); - ERROR("-force-uid uid\t\tset all file uids to uid\n"); - ERROR("-force-gid gid\t\tset all file gids to gid\n"); -+ ERROR("-fixed-time timestamp\tset all timestamps to timestamp\n"); - ERROR("-le\t\t\tcreate a little endian filesystem\n"); - ERROR("-be\t\t\tcreate a big endian filesystem\n"); - ERROR("-nopad\t\t\tdo not pad filesystem to a multiple of 4K\n"); -@@ -2190,7 +2216,7 @@ printOptions: - sBlk.block_size = block_size; - sBlk.block_log = block_log; - sBlk.flags = SQUASHFS_MKFLAGS(noI, noD, check_data, noF, no_fragments, always_use_fragments, duplicate_checking); -- sBlk.mkfs_time = time(NULL); -+ sBlk.mkfs_time = fixed_time != -1 ? fixed_time : time(NULL); - - restore_filesystem: - write_fragment(); diff --git a/tools/squashfs/patches/130-include_sysmacros.patch b/tools/squashfs/patches/130-include_sysmacros.patch deleted file mode 100644 index f0149d6f65..0000000000 --- a/tools/squashfs/patches/130-include_sysmacros.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/squashfs-tools/mksquashfs.c -+++ b/squashfs-tools/mksquashfs.c -@@ -30,6 +30,7 @@ - #include - #include - #include -+#include - #include - #include - #include ---- a/squashfs-tools/unsquashfs.c -+++ b/squashfs-tools/unsquashfs.c -@@ -25,6 +25,7 @@ - #define FALSE 0 - #include - #include -+#include - #include - #include - #include diff --git a/tools/squashfs/patches/140-gcc-10-fix.patch b/tools/squashfs/patches/140-gcc-10-fix.patch deleted file mode 100644 index a02641f307..0000000000 --- a/tools/squashfs/patches/140-gcc-10-fix.patch +++ /dev/null @@ -1,25 +0,0 @@ -Fixes the following build error with GCC 10: - /usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap'; mksquashfs.o:(.bss+0x1b2a88): first defined here -And a compile warning. - ---- a/squashfs-tools/read_fs.c -+++ b/squashfs-tools/read_fs.c -@@ -61,7 +61,7 @@ extern int add_file(long long, long long - fprintf(stderr, s, ## args); \ - } while(0) - --int swap; -+static int swap; - - int read_block(int fd, long long start, long long *next, unsigned char *block, squashfs_super_block *sBlk) - { ---- a/squashfs-tools/mksquashfs.c -+++ b/squashfs-tools/mksquashfs.c -@@ -258,6 +258,7 @@ int read_sort_file(char *filename, int s - void sort_files_and_write(struct dir_info *dir); - struct file_info *duplicate(char *(get_next_file_block)(struct duplicate_buffer_handle *, unsigned int), struct duplicate_buffer_handle *file_start, long long bytes, unsigned int **block_list, long long *start, int blocks, struct fragment **fragment, char *frag_data, int frag_bytes); - struct dir_info *dir_scan1(char *, int (_readdir)(char *, char *, struct dir_info *)); -+int dir_scan2(squashfs_inode *inode, struct dir_info *dir_info); - - #define MKINODE(A) ((squashfs_inode)(((squashfs_inode) inode_bytes << 16) + (((char *)A) - data_cache))) - diff --git a/tools/squashfs3-lzma/Makefile b/tools/squashfs3-lzma/Makefile new file mode 100644 index 0000000000..b02018629e --- /dev/null +++ b/tools/squashfs3-lzma/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2006-2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=squashfs3-lzma +PKG_CPE_ID:=cpe:/a:phillip_lougher:squashfs +PKG_VERSION:=3.0 + +PKG_SOURCE:=squashfs$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/squashfs +PKG_HASH:=39dbda43cf118536deb746c7730b468702d514a19f4cfab73b710e32908ddf20 + +# Tar directory is squashfs3.0 that conflict with any pattern +# currently using for host tools. (PKG_NAME-PKG_VERSION) +# Also this got renamed to a more correct name +# from squashfs to squashfs3-lzma. +# Use tar transform to rename the root directory to this new +# name. +TAR_OPTIONS+=--transform=s/^squashfs/$(PKG_NAME)-/ + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Compile + $(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \ + CC="$(HOSTCC)" \ + CFLAGS="$(HOST_CFLAGS) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I." \ + CXX="$(CXX)" \ + LZMAPATH=$(STAGING_DIR_HOST)/lib \ + mksquashfs-lzma unsquashfs-lzma +endef + +define Host/Install + $(INSTALL_BIN) $(HOST_BUILD_DIR)/squashfs-tools/mksquashfs-lzma $(STAGING_DIR_HOST)/bin/mksquashfs3-lzma + $(INSTALL_BIN) $(HOST_BUILD_DIR)/squashfs-tools/unsquashfs-lzma $(STAGING_DIR_HOST)/bin/unsquashfs3-lzma +endef + +define Host/Clean + rm -f $(STAGING_DIR_HOST)/bin/mksquashfs3-lzma + rm -f $(STAGING_DIR_HOST)/bin/unsquashfs3-lzma +endef + +$(eval $(call HostBuild)) diff --git a/tools/squashfs3-lzma/patches/100-lzma.patch b/tools/squashfs3-lzma/patches/100-lzma.patch new file mode 100644 index 0000000000..73f6a4e055 --- /dev/null +++ b/tools/squashfs3-lzma/patches/100-lzma.patch @@ -0,0 +1,22 @@ +--- a/squashfs-tools/Makefile ++++ b/squashfs-tools/Makefile +@@ -7,6 +7,9 @@ all: mksquashfs unsquashfs + mksquashfs: mksquashfs.o read_fs.o sort.o + $(CC) mksquashfs.o read_fs.o sort.o -lz -o $@ + ++mksquashfs-lzma: mksquashfs.o read_fs.o sort.o ++ $(CXX) mksquashfs.o read_fs.o sort.o -L$(LZMAPATH) -llzma-old -o $@ ++ + mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h + + read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h +@@ -16,4 +19,9 @@ sort.o: sort.c squashfs_fs.h global.h so + unsquashfs: unsquashfs.o + $(CC) unsquashfs.o -lz -o $@ + ++unsquashfs-lzma: unsquashfs.o ++ $(CXX) unsquashfs.o -L$(LZMAPATH) -llzma-old -o $@ ++ + unsquashfs.o: unsquashfs.c squashfs_fs.h read_fs.h global.h ++ ++clean: diff --git a/tools/squashfs3-lzma/patches/110-no_nonstatic_inline.patch b/tools/squashfs3-lzma/patches/110-no_nonstatic_inline.patch new file mode 100644 index 0000000000..8e288f336e --- /dev/null +++ b/tools/squashfs3-lzma/patches/110-no_nonstatic_inline.patch @@ -0,0 +1,11 @@ +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -1347,7 +1347,7 @@ struct inode_info *lookup_inode(struct s + } + + +-inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, struct inode_info *inode_info, void *data, struct dir_info *dir) ++static inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, struct inode_info *inode_info, void *data, struct dir_info *dir) + { + if((dir->count % DIR_ENTRIES) == 0) + if((dir->list = realloc(dir->list, (dir->count + DIR_ENTRIES) * sizeof(struct dir_ent *))) == NULL) diff --git a/tools/squashfs3-lzma/patches/120-add-fixed-timestamp-support.patch b/tools/squashfs3-lzma/patches/120-add-fixed-timestamp-support.patch new file mode 100644 index 0000000000..e2f4bb2e04 --- /dev/null +++ b/tools/squashfs3-lzma/patches/120-add-fixed-timestamp-support.patch @@ -0,0 +1,79 @@ +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -117,6 +117,9 @@ unsigned int inode_bytes = 0, inode_size + char *data_cache = NULL; + unsigned int cache_bytes = 0, cache_size = 0, inode_count = 0; + ++/* override all timestamps */ ++time_t fixed_time = -1; ++ + /* in memory directory data */ + #define I_COUNT_SIZE 128 + #define DIR_ENTRIES 32 +@@ -1554,6 +1557,11 @@ void dir_scan(squashfs_inode *inode, cha + perror(buffer); + return; + } ++ ++ /* override timestamp of lstat if fixed_time is given */ ++ if(fixed_time != -1) ++ inode_info->buf.st_mtime = fixed_time; ++ + if(sorted) + sort_files_and_write(dir_info); + dir_scan2(inode, dir_info); +@@ -1582,6 +1590,10 @@ struct dir_info *dir_scan1(char *pathnam + perror(buffer); + continue; + } ++ ++ if(fixed_time != -1) ++ buf.st_mtime = fixed_time; ++ + if(excluded(filename, &buf)) + continue; + +@@ -1621,6 +1633,9 @@ int dir_scan2(squashfs_inode *inode, str + char *dir_name = dir_ent->name; + unsigned int inode_number = ((buf->st_mode & S_IFMT) == S_IFDIR) ? dir_ent->inode->inode_number : dir_ent->inode->inode_number + dir_inode_no; + ++ if(fixed_time != -1) ++ buf->st_mtime = fixed_time; ++ + if(dir_ent->inode->inode == SQUASHFS_INVALID_BLK) { + switch(buf->st_mode & S_IFMT) { + case S_IFREG: +@@ -1898,6 +1913,16 @@ int main(int argc, char *argv[]) + exit(1); + } + } ++ } else if(strcmp(argv[i], "-fixed-time") == 0) { ++ if(++i == argc) { ++ ERROR("%s: -fixed-time missing a timestamp\n", argv[0]); ++ exit(1); ++ } ++ fixed_time = strtoll(argv[i], &b, 10); ++ if(*b != '\0') { ++ ERROR("%s: -fixed-time has an invalid number\n", argv[0]); ++ exit(1); ++ } + } else if(strcmp(argv[i], "-noI") == 0 || + strcmp(argv[i], "-noInodeCompression") == 0) + noI = TRUE; +@@ -1967,6 +1992,7 @@ printOptions: + ERROR("-all-root\t\tmake all files owned by root\n"); + ERROR("-force-uid uid\t\tset all file uids to uid\n"); + ERROR("-force-gid gid\t\tset all file gids to gid\n"); ++ ERROR("-fixed-time timestamp\tset all timestamps to timestamp\n"); + ERROR("-le\t\t\tcreate a little endian filesystem\n"); + ERROR("-be\t\t\tcreate a big endian filesystem\n"); + ERROR("-nopad\t\t\tdo not pad filesystem to a multiple of 4K\n"); +@@ -2190,7 +2216,7 @@ printOptions: + sBlk.block_size = block_size; + sBlk.block_log = block_log; + sBlk.flags = SQUASHFS_MKFLAGS(noI, noD, check_data, noF, no_fragments, always_use_fragments, duplicate_checking); +- sBlk.mkfs_time = time(NULL); ++ sBlk.mkfs_time = fixed_time != -1 ? fixed_time : time(NULL); + + restore_filesystem: + write_fragment(); diff --git a/tools/squashfs3-lzma/patches/130-include_sysmacros.patch b/tools/squashfs3-lzma/patches/130-include_sysmacros.patch new file mode 100644 index 0000000000..f0149d6f65 --- /dev/null +++ b/tools/squashfs3-lzma/patches/130-include_sysmacros.patch @@ -0,0 +1,20 @@ +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/squashfs-tools/unsquashfs.c ++++ b/squashfs-tools/unsquashfs.c +@@ -25,6 +25,7 @@ + #define FALSE 0 + #include + #include ++#include + #include + #include + #include diff --git a/tools/squashfs3-lzma/patches/140-gcc-10-fix.patch b/tools/squashfs3-lzma/patches/140-gcc-10-fix.patch new file mode 100644 index 0000000000..a02641f307 --- /dev/null +++ b/tools/squashfs3-lzma/patches/140-gcc-10-fix.patch @@ -0,0 +1,25 @@ +Fixes the following build error with GCC 10: + /usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap'; mksquashfs.o:(.bss+0x1b2a88): first defined here +And a compile warning. + +--- a/squashfs-tools/read_fs.c ++++ b/squashfs-tools/read_fs.c +@@ -61,7 +61,7 @@ extern int add_file(long long, long long + fprintf(stderr, s, ## args); \ + } while(0) + +-int swap; ++static int swap; + + int read_block(int fd, long long start, long long *next, unsigned char *block, squashfs_super_block *sBlk) + { +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -258,6 +258,7 @@ int read_sort_file(char *filename, int s + void sort_files_and_write(struct dir_info *dir); + struct file_info *duplicate(char *(get_next_file_block)(struct duplicate_buffer_handle *, unsigned int), struct duplicate_buffer_handle *file_start, long long bytes, unsigned int **block_list, long long *start, int blocks, struct fragment **fragment, char *frag_data, int frag_bytes); + struct dir_info *dir_scan1(char *, int (_readdir)(char *, char *, struct dir_info *)); ++int dir_scan2(squashfs_inode *inode, struct dir_info *dir_info); + + #define MKINODE(A) ((squashfs_inode)(((squashfs_inode) inode_bytes << 16) + (((char *)A) - data_cache))) +