From patchwork Thu Apr 19 22:12:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 901537 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hauke-m.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="purxnaTp"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40RtYn02Hkz9s1t for ; Fri, 20 Apr 2018 08:14:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=6omCfCqs3kr1wXz4lYw50bQYVtFj/rgFJM5a26IC1ws=; b=purxnaTppIr+nL lTOt8H0KuhFlz/9HKtd+axmKjt+w6o3vmXTUTJ4RfW9+7y2FC+dPMfQwganxxlFvrYoVD3EV+p4jO rkGkhXhSZN6fJ6Dv1Y1x2dUQ07gKlGDV0FH1FnasgcfbqFuDJ0zo069Uk1i96mlqvoGg65pDcsBih 3KgLSxbDfral/kpG5cl8gDoPNP112jE2B3pXI4rtVLtuj2MKZf+TUHDrAclX7mYfyvbzusuazz0y6 m/povyByB4ufQWNxLgw5JAbwqa05X2krod2qewe6BmCA0m6vPMpsIXn4i34lR4DTAiTsLXFiz0JB1 gZSmNunsgNtR4hBwcQpw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9HoT-000894-TW; Thu, 19 Apr 2018 22:13:57 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Hn4-0007TA-B6 for lede-dev@lists.infradead.org; Thu, 19 Apr 2018 22:12:40 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id A178342FFB; Fri, 20 Apr 2018 00:12:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id gYqtlBSDhJDL; Fri, 20 Apr 2018 00:12:13 +0200 (CEST) From: Hauke Mehrtens To: lede-dev@lists.infradead.org Date: Fri, 20 Apr 2018 00:12:02 +0200 Message-Id: <20180419221206.5124-1-hauke@hauke-m.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180419_151230_740797_7C8017D9 X-CRM114-Status: GOOD ( 18.21 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [80.241.60.212 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Subject: [LEDE-DEV] [PATCH v2 1/5] tools/zlib: move zlib build to tools X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hauke@hauke-m.de, wong.syrone@gmail.com, koen.vandeputte@ncentric.com, luci@createc.ro MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This allows us to link the other tools against our libz and we do not need the system zlib any more. Only the static linked library is copied to the staging directory so we have a statically linked library on all systems and not only on Linux. This also adds the new dependencies of the packages which are depending on zlib. Signed-off-by: Hauke Mehrtens Tested-by: Koen Vandeputte --- changes since v1: * add HOST_CFLAGS +=-fPIC include/prereq-build.mk | 5 --- package/libs/zlib/Makefile | 2 -- tools/Makefile | 14 ++++++--- tools/lzma-old/Makefile | 2 ++ tools/lzma-old/patches/120-add-cflags.patch | 11 +++++++ tools/make-ext4fs/Makefile | 8 +---- tools/make-ext4fs/patches/100-add-ldflags.patch | 11 +++++++ tools/squashfs4/Makefile | 2 +- tools/zlib/Makefile | 41 +++++++++++++++++++++++++ 9 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 tools/lzma-old/patches/120-add-cflags.patch create mode 100644 tools/make-ext4fs/patches/100-add-ldflags.patch create mode 100644 tools/zlib/Makefile diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 6917716342..5b9a7e049d 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -76,11 +76,6 @@ else zlib_link_flags := -lz endif -$(eval $(call TestHostCommand,zlib, \ - Please install a static zlib. (Missing libz.a or zlib.h), \ - echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \ - gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags))) - $(eval $(call TestHostCommand,perl-thread-queue, \ Please install the Perl Thread::Queue module, \ perl -MThread::Queue -e 1)) diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile index a7c61f7dd0..4a2a0e53b0 100644 --- a/package/libs/zlib/Makefile +++ b/package/libs/zlib/Makefile @@ -21,7 +21,6 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib PKG_CONFIG_DEPENDS:= CONFIG_ZLIB_OPTIMIZE_SPEED -include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -95,6 +94,5 @@ define Package/zlib-dev/install $(1)/usr/lib/pkgconfig/ endef -$(eval $(call HostBuild)) $(eval $(call BuildPackage,zlib)) $(eval $(call BuildPackage,zlib-dev)) diff --git a/tools/Makefile b/tools/Makefile index 50bd552d75..8dfab9892b 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -22,7 +22,7 @@ ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar endif tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat -tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs +tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs zlib tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage tools-y += firmware-utils patch-image quilt padjffs2 tools-y += mm-macros missing-macros cmake scons bc findutils gengetopt patchelf @@ -43,16 +43,16 @@ $(curdir)/bison/compile := $(curdir)/flex/compile $(curdir)/flex/compile := $(curdir)/libtool/compile $(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile -$(curdir)/squashfs4/compile := $(curdir)/xz/compile +$(curdir)/squashfs4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile $(curdir)/autoconf/compile := $(curdir)/m4/compile $(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkg-config/compile $(curdir)/xz/compile $(curdir)/gmp/compile := $(curdir)/libtool/compile $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile $(curdir)/mpfr/compile := $(curdir)/gmp/compile -$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile +$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile $(curdir)/mklibs/compile := $(curdir)/libtool/compile -$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile +$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile $(curdir)/upslug2/compile := $(curdir)/libtool/compile $(curdir)/mm-macros/compile := $(curdir)/libtool/compile $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile @@ -69,8 +69,12 @@ $(curdir)/patchelf/compile := $(curdir)/libtool/compile $(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/libressl/compile := $(curdir)/pkg-config/compile $(curdir)/mkimage/compile += $(curdir)/libressl/compile -$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile +$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile $(curdir)/zlib/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile +$(curdir)/zlib/compile := $(curdir)/cmake/compile +$(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile +$(curdir)/lzma-old/compile := $(curdir)/zlib/compile +$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile ifneq ($(HOST_OS),Linux) tools-y += coreutils diff --git a/tools/lzma-old/Makefile b/tools/lzma-old/Makefile index 5982eab5db..5204127a80 100644 --- a/tools/lzma-old/Makefile +++ b/tools/lzma-old/Makefile @@ -21,7 +21,9 @@ LIB_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Lib ALONE_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Alone define Host/Compile + +$(HOST_MAKE_VARS) \ $(MAKE) -C $(LIB_DIR) + +$(HOST_MAKE_VARS) \ $(MAKE) -f makefile.gcc -C $(ALONE_DIR) endef diff --git a/tools/lzma-old/patches/120-add-cflags.patch b/tools/lzma-old/patches/120-add-cflags.patch new file mode 100644 index 0000000000..9022e7cd27 --- /dev/null +++ b/tools/lzma-old/patches/120-add-cflags.patch @@ -0,0 +1,11 @@ +--- a/C/7zip/Compress/LZMA_Lib/makefile ++++ b/C/7zip/Compress/LZMA_Lib/makefile +@@ -2,7 +2,7 @@ PROG = liblzma.a + CXX = g++ -O3 -Wall + AR = ar + RM = rm -f +-CFLAGS = -c -I ../../../ ++CFLAGS += -c -I ../../../ + + OBJS = \ + ZLib.o \ diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile index f140101c8e..97f9e6369c 100644 --- a/tools/make-ext4fs/Makefile +++ b/tools/make-ext4fs/Makefile @@ -17,13 +17,7 @@ PKG_MIRROR_HASH:=d7ccd5e426b1d15331ff000a37dc15161f6eef594453e970fd584fcde5a2507 include $(INCLUDE_DIR)/host-build.mk -ifeq ($(HOST_OS),Linux) - MAKE_STATIC := STATIC=1 -endif - -define Host/Compile - $(MAKE) -C $(HOST_BUILD_DIR) make_ext4fs $(MAKE_STATIC) -endef +HOST_MAKE_FLAGS += STATIC=1 define Host/Install $(INSTALL_BIN) $(HOST_BUILD_DIR)/make_ext4fs $(STAGING_DIR_HOST)/bin/ diff --git a/tools/make-ext4fs/patches/100-add-ldflags.patch b/tools/make-ext4fs/patches/100-add-ldflags.patch new file mode 100644 index 0000000000..d9ce47bb80 --- /dev/null +++ b/tools/make-ext4fs/patches/100-add-ldflags.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -27,7 +27,7 @@ OBJ := \ + $(CC) $(CFLAGS) -c -o $@ $^ + + make_ext4fs: $(OBJ) libsparse/libsparse.a +- $(CC) -o $@ $^ $(ZLIB) ++ $(CC) $(LDFLAGS)-o $@ $^ $(ZLIB) + + libsparse/libsparse.a: + $(MAKE) -C libsparse/ libsparse.a diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile index e9e2b7ca9a..409b1b5a23 100644 --- a/tools/squashfs4/Makefile +++ b/tools/squashfs4/Makefile @@ -20,8 +20,8 @@ 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 \ - CC="$(HOSTCC)" \ XZ_SUPPORT=1 \ LZMA_XZ_SUPPORT=1 \ XATTR_SUPPORT= \ diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile new file mode 100644 index 0000000000..279851f758 --- /dev/null +++ b/tools/zlib/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (C) 2006-2013 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:=zlib +PKG_VERSION:=1.2.11 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net +PKG_HASH:=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066 + +PKG_LICENSE:=Zlib +PKG_LICENSE_FILES:=README +PKG_CPE_ID:=cpe:/a:gnu:zlib + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +HOST_CFLAGS +=-fPIC + +define Host/Install + $(CP) $(HOST_BUILD_DIR)/libz.a $(STAGING_DIR_HOST)/lib/ + $(CP) $(HOST_BUILD_DIR)/zconf.h $(STAGING_DIR_HOST)/include/ + $(CP) $(HOST_BUILD_DIR)/zlib.h $(STAGING_DIR_HOST)/include/ + $(CP) $(HOST_BUILD_DIR)/zlib.pc $(STAGING_DIR_HOST)/lib/pkgconfig/ +endef + +define Host/Clean + rm -f $(STAGING_DIR_HOST)/lib/libz.a + rm -f $(STAGING_DIR_HOST)/include/zconf.h + rm -f $(STAGING_DIR_HOST)/include/zlib.h + rm -f $(STAGING_DIR_HOST)/lib/pkgconfig//zlib.pc +endef + +$(eval $(call HostBuild)) From patchwork Thu Apr 19 22:12:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 901538 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hauke-m.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OkMfw3ty"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40RtZV48yjz9s1t for ; Fri, 20 Apr 2018 08:14:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CHuLJZsEQEdmmP5MLvuJBknAFVwryU9+kowLP430ZOU=; b=OkMfw3tyEJ9iU8 fkn8uEzDZ2ovoKDItx7Sa9Ci7eYcPvYOWAxRPj9Nq9/tYsHTeBNaJv8gMRacMSY+fhHb2EFrC40s0 SWO7dYTKFP7V9GtOPG7rXWlvgBltBXgsOoq79UeRflzyrlwYBrNwNPAslqMmYU8r51WR2UFAylSwt 9b+slui1RVMmJ42OAWgt24Y9OIYui90UDOMoqb/9sUrl8jV9DKb+KcVVQzKtAomKCnnXDl17F0nxi ajOs7bsP540yPtf/gW/PZAesJAEhUIxgOLDfWK00DFfbuSpDtleaB3NLu/X0w358ZoQq3Ry/0qZeB 1tWmZNK5+X7qNOZlFJqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Hp6-00009T-Nd; Thu, 19 Apr 2018 22:14:36 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Hn4-0007P2-Gc for lede-dev@lists.infradead.org; Thu, 19 Apr 2018 22:12:42 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 9755B42FF0; Fri, 20 Apr 2018 00:12:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id KZLyks5jSW5Z; Fri, 20 Apr 2018 00:12:14 +0200 (CEST) From: Hauke Mehrtens To: lede-dev@lists.infradead.org Date: Fri, 20 Apr 2018 00:12:03 +0200 Message-Id: <20180419221206.5124-2-hauke@hauke-m.de> In-Reply-To: <20180419221206.5124-1-hauke@hauke-m.de> References: <20180419221206.5124-1-hauke@hauke-m.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180419_151230_899653_A5DC3928 X-CRM114-Status: GOOD ( 19.12 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [80.241.60.212 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Subject: [LEDE-DEV] [PATCH v2 2/5] tools/mtd-utils: Mark some lzma functions as static X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hauke@hauke-m.de, wong.syrone@gmail.com, koen.vandeputte@ncentric.com, luci@createc.ro MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org These functions are not declared in any header file and only used in same compile unit, mark them as static to remove one gcc warning and make it easier for the compiler to optimize them out. This also fixes some style problems to make this patch match the version in the packages folder. This is copied from this commit to the mtd-utils we pack into the image: 56d0dd56e9c6efa79 ("mtd-utils: Mark some lzma functions as static") Signed-off-by: Hauke Mehrtens Tested-by: Koen Vandeputte --- tools/mtd-utils/patches/130-lzma_jffs2.patch | 74 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/tools/mtd-utils/patches/130-lzma_jffs2.patch b/tools/mtd-utils/patches/130-lzma_jffs2.patch index b04f019922..05ced4f42c 100644 --- a/tools/mtd-utils/patches/130-lzma_jffs2.patch +++ b/tools/mtd-utils/patches/130-lzma_jffs2.patch @@ -26,7 +26,7 @@ jffs2_lzo_init(); #endif +#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_init(); ++ jffs2_lzma_init(); +#endif return 0; } @@ -36,7 +36,7 @@ jffs2_lzo_exit(); #endif +#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_exit(); ++ jffs2_lzma_exit(); +#endif return 0; } @@ -119,7 +119,7 @@ + return -1; + } + -+ return 0; ++ return 0; +} + +STATIC int jffs2_lzma_compress(unsigned char *data_in, unsigned char *cpage_out, @@ -175,26 +175,26 @@ + +int INIT jffs2_lzma_init(void) +{ -+ int ret; ++ int ret; + CLzmaEncProps props; + LzmaEncProps_Init(&props); + -+ props.dictSize = LZMA_BEST_DICT(0x2000); -+ props.level = LZMA_BEST_LEVEL; -+ props.lc = LZMA_BEST_LC; -+ props.lp = LZMA_BEST_LP; -+ props.pb = LZMA_BEST_PB; -+ props.fb = LZMA_BEST_FB; ++ props.dictSize = LZMA_BEST_DICT(0x2000); ++ props.level = LZMA_BEST_LEVEL; ++ props.lc = LZMA_BEST_LC; ++ props.lp = LZMA_BEST_LP; ++ props.pb = LZMA_BEST_PB; ++ props.fb = LZMA_BEST_FB; + + ret = lzma_alloc_workspace(&props); -+ if (ret < 0) -+ return ret; ++ if (ret < 0) ++ return ret; + + ret = jffs2_register_compressor(&jffs2_lzma_comp); + if (ret) + lzma_free_workspace(); + -+ return ret; ++ return ret; +} + +void jffs2_lzma_exit(void) @@ -245,7 +245,7 @@ + #define LZMA_FREE free + #define PRINT_ERROR(msg) fprintf(stderr, msg) + #define INIT -+ #define STATIC ++ #define STATIC static +#endif + +#include "lzma/LzmaDec.h" @@ -261,16 +261,16 @@ + +static void *p_lzma_malloc(void *p, size_t size) +{ -+ if (size == 0) -+ return NULL; ++ if (size == 0) ++ return NULL; + -+ return LZMA_MALLOC(size); ++ return LZMA_MALLOC(size); +} + +static void p_lzma_free(void *p, void *address) +{ -+ if (address != NULL) -+ LZMA_FREE(address); ++ if (address != NULL) ++ LZMA_FREE(address); +} + +static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free}; @@ -949,9 +949,9 @@ +} + +Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } ++static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } + -+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } ++static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } + +void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) +{ @@ -2357,7 +2357,7 @@ + p->needFlush = 0; +} + -+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) ++static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) +{ + p->needFlush = 1; + p->remainLen = 0; @@ -2777,7 +2777,7 @@ +#define kNumLogBits (9 + (int)sizeof(size_t) / 2) +#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) + -+void LzmaEnc_FastPosInit(Byte *g_FastPos) ++static void LzmaEnc_FastPosInit(Byte *g_FastPos) +{ + int c = 2, slotFast; + g_FastPos[0] = 0; @@ -3031,7 +3031,7 @@ + CSaveState saveState; +} CLzmaEnc; + -+void LzmaEnc_SaveState(CLzmaEncHandle pp) ++static void LzmaEnc_SaveState(CLzmaEncHandle pp) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + CSaveState *dest = &p->saveState; @@ -3057,7 +3057,7 @@ + memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); +} + -+void LzmaEnc_RestoreState(CLzmaEncHandle pp) ++static void LzmaEnc_RestoreState(CLzmaEncHandle pp) +{ + CLzmaEnc *dest = (CLzmaEnc *)pp; + const CSaveState *p = &dest->saveState; @@ -3300,7 +3300,7 @@ + while (symbol < 0x10000); +} + -+void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) ++static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) +{ + UInt32 i; + for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) @@ -4426,7 +4426,7 @@ + p->matchPriceCount = 0; +} + -+void LzmaEnc_Construct(CLzmaEnc *p) ++static void LzmaEnc_Construct(CLzmaEnc *p) +{ + RangeEnc_Construct(&p->rc); + MatchFinder_Construct(&p->matchFinderBase); @@ -4459,7 +4459,7 @@ + return p; +} + -+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) ++static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->litProbs); + alloc->Free(alloc, p->saveState.litProbs); @@ -4467,7 +4467,7 @@ + p->saveState.litProbs = 0; +} + -+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) ++static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + #ifdef COMPRESS_MF_MT + MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); @@ -4698,7 +4698,7 @@ + return SZ_OK; +} + -+void LzmaEnc_Init(CLzmaEnc *p) ++static void LzmaEnc_Init(CLzmaEnc *p) +{ + UInt32 i; + p->state = 0; @@ -4757,7 +4757,7 @@ + p->lpMask = (1 << p->lp) - 1; +} + -+void LzmaEnc_InitPrices(CLzmaEnc *p) ++static void LzmaEnc_InitPrices(CLzmaEnc *p) +{ + if (!p->fastMode) + { @@ -4798,7 +4798,7 @@ + return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); +} + -+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ++static SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, + ISeqInStream *inStream, UInt32 keepWindowSize, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ @@ -4814,7 +4814,7 @@ + p->seqBufInStream.rem = srcLen; +} + -+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, ++static SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, + UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; @@ -4823,7 +4823,7 @@ + return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); +} + -+void LzmaEnc_Finish(CLzmaEncHandle pp) ++static void LzmaEnc_Finish(CLzmaEncHandle pp) +{ + #ifdef COMPRESS_MF_MT + CLzmaEnc *p = (CLzmaEnc *)pp; @@ -4855,19 +4855,19 @@ +} + + -+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) ++static UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) +{ + const CLzmaEnc *p = (CLzmaEnc *)pp; + return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); +} + -+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) ++static const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) +{ + const CLzmaEnc *p = (CLzmaEnc *)pp; + return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; +} + -+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, ++static SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, + Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; From patchwork Thu Apr 19 22:12:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 901543 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hauke-m.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l8hLzM/s"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40RtbJ0NWZz9s1t for ; Fri, 20 Apr 2018 08:15:24 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mtImAKu24dKVoEhBhE/8U4N0lOtUUGOz/PL7686+tGQ=; b=l8hLzM/sLmqabr RDFgGdjUugjPGxB8U9NAP4/V06u4Xu1cgf9vkNOqlthCopg7rzOsN4FOqLXMJUv9iS/GTeBwBCN9n ruhi4aHb/1mPj+2zQ8Ws3J9Ut3v8XqjXoQORqiKpD9JN/a19TTtsrmh7smhPRfIvYu6TnB8tCMNhR jeQDJ9j8Kh2Dzoa79isgVzRJynBvNmu2VhbrtdxlmVPNQ185QOWJ9PzWDrw0Vh59maL/PFdu9ozoi sz2CEh4tdyFxXuDAWBUeezkzuK0YHkp0yoRbWhF9IZStc3M7em6polZa2CbbWTmUn+VmuJ3knQqd8 jGx4TbvxVayeyPDiw5Ug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Hpk-0000nR-FA; Thu, 19 Apr 2018 22:15:16 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Hn4-0007PX-Cd for lede-dev@lists.infradead.org; Thu, 19 Apr 2018 22:12:50 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 28BB642FDB; Fri, 20 Apr 2018 00:12:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id xsf585HQGPgT; Fri, 20 Apr 2018 00:12:15 +0200 (CEST) From: Hauke Mehrtens To: lede-dev@lists.infradead.org Date: Fri, 20 Apr 2018 00:12:04 +0200 Message-Id: <20180419221206.5124-3-hauke@hauke-m.de> In-Reply-To: <20180419221206.5124-1-hauke@hauke-m.de> References: <20180419221206.5124-1-hauke@hauke-m.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180419_151230_854388_B28BFB49 X-CRM114-Status: GOOD ( 22.81 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [80.241.60.212 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Subject: [LEDE-DEV] [PATCH v2 3/5] tools/mtd-utils: update to version 2.0.2 X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hauke@hauke-m.de, wong.syrone@gmail.com, koen.vandeputte@ncentric.com, luci@createc.ro MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This version now uses autotools to configure the build system. They are also using the newly added zlib package. Signed-off-by: Hauke Mehrtens Tested-by: Koen Vandeputte --- changes since v1: * Update to version 2.0.2 * use ftp to download the tar tools/Makefile | 2 +- tools/mtd-utils/Makefile | 46 +++----- tools/mtd-utils/patches/100-sscanf_fix.patch | 6 +- tools/mtd-utils/patches/110-portability.patch | 51 +++++---- .../mtd-utils/patches/120-include_sysmacros.patch | 25 ----- tools/mtd-utils/patches/130-lzma_jffs2.patch | 65 +++++------ .../patches/135-mkubifs_optional_lzo.patch | 119 --------------------- ...igen-add-ubigen_write_terminator-function.patch | 8 +- .../201-ubinize-add-terminator-support.patch | 23 ++-- .../patches/310-add-static-linking-option.patch | 43 -------- .../patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch | 16 +-- 11 files changed, 101 insertions(+), 303 deletions(-) delete mode 100644 tools/mtd-utils/patches/120-include_sysmacros.patch delete mode 100644 tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch delete mode 100644 tools/mtd-utils/patches/310-add-static-linking-option.patch diff --git a/tools/Makefile b/tools/Makefile index 8dfab9892b..d2b5daf18c 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -50,7 +50,7 @@ $(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $( $(curdir)/gmp/compile := $(curdir)/libtool/compile $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile $(curdir)/mpfr/compile := $(curdir)/gmp/compile -$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile +$(curdir)/mtd-utils/compile := $(curdir)/libtool/compile $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile $(curdir)/mklibs/compile := $(curdir)/libtool/compile $(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile $(curdir)/upslug2/compile := $(curdir)/libtool/compile diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile index 7b4a91a73d..1527d10579 100644 --- a/tools/mtd-utils/Makefile +++ b/tools/mtd-utils/Makefile @@ -7,44 +7,30 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_VERSION:=1.5.2 +PKG_VERSION:=2.0.2 -PKG_SOURCE_VERSION:=aea36417067dade75192bafa03af70b6eb2677b1 -PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git -PKG_SOURCE_PROTO:=git -PKG_MIRROR_HASH:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/mtd-utils/ +PKG_HASH:=fb3de61be8e932abb424e8ea3c30298f553d5f970ad158a737bb303bbf9660b8 + +PKG_FIXUP:=autoreconf include $(INCLUDE_DIR)/host-build.mk -HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs -CFLAGS := $(HOST_CFLAGS) -I$(HOST_BUILD_DIR)/include -L$(HOST_BUILD_DIR) -L$(STAGING_DIR_HOST)/lib -DNO_NATIVE_SUPPORT -ifneq ($(HOST_OS),Linux) -CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include endian.h -I$(CURDIR)/include -include fls.h -MTD_STATIC := 0 -else -MTD_STATIC := 1 -endif - -MTD_MAKEOPTS = \ - CFLAGS="$(CFLAGS)" \ - LDFLAGS="$(HOST_LDFLAGS)" \ - WITHOUT_LZO=1 WITHOUT_XATTR=1 \ - SUBDIRS="" \ - BUILDDIR="$(HOST_BUILD_DIR)" \ - STATIC=$(MTD_STATIC) \ - V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1) - -define Host/Compile - $(MAKE) -C $(HOST_BUILD_DIR) \ - $(MTD_MAKEOPTS) \ - TARGETS="mkfs.jffs2 ubi-utils/ubinize mkfs.ubifs/mkfs.ubifs" -endef + +HOST_CONFIGURE_VARS+= \ + UUID_CFLAGS="-I$(STAGING_DIR_HOST)/include/e2fsprogs/uuid" + +HOST_CONFIGURE_ARGS+= \ + --disable-tests \ + --without-xattr \ + --without-lzo define Host/Install $(CP) \ $(HOST_BUILD_DIR)/mkfs.jffs2 \ - $(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \ - $(HOST_BUILD_DIR)/ubi-utils/ubinize \ + $(HOST_BUILD_DIR)/mkfs.ubifs \ + $(HOST_BUILD_DIR)/ubinize \ $(STAGING_DIR_HOST)/bin/ endef diff --git a/tools/mtd-utils/patches/100-sscanf_fix.patch b/tools/mtd-utils/patches/100-sscanf_fix.patch index 0af583f4cb..ae6f86722b 100644 --- a/tools/mtd-utils/patches/100-sscanf_fix.patch +++ b/tools/mtd-utils/patches/100-sscanf_fix.patch @@ -1,6 +1,6 @@ ---- a/mkfs.jffs2.c -+++ b/mkfs.jffs2.c -@@ -422,7 +422,7 @@ static int interpret_table_entry(struct +--- a/jffsX-utils/mkfs.jffs2.c ++++ b/jffsX-utils/mkfs.jffs2.c +@@ -427,7 +427,7 @@ static int interpret_table_entry(struct if (sscanf (line, "%" SCANF_PREFIX "s %c %lo %lu %lu %lu %lu %lu %lu %lu", SCANF_STRING(name), &type, &mode, &uid, &gid, &major, &minor, diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch index c4cdab928a..a2942270d7 100644 --- a/tools/mtd-utils/patches/110-portability.patch +++ b/tools/mtd-utils/patches/110-portability.patch @@ -1,5 +1,5 @@ ---- a/compr_lzo.c -+++ b/compr_lzo.c +--- a/jffsX-utils/compr_lzo.c ++++ b/jffsX-utils/compr_lzo.c @@ -26,7 +26,6 @@ #include @@ -8,8 +8,8 @@ #include #include #include "compr.h" ---- a/compr_zlib.c -+++ b/compr_zlib.c +--- a/jffsX-utils/compr_zlib.c ++++ b/jffsX-utils/compr_zlib.c @@ -39,7 +39,6 @@ #include #undef crc32 @@ -18,8 +18,8 @@ #include #include "common.h" #include "compr.h" ---- a/rbtree.h -+++ b/rbtree.h +--- a/jffsX-utils/rbtree.h ++++ b/jffsX-utils/rbtree.h @@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa #ifndef _LINUX_RBTREE_H #define _LINUX_RBTREE_H @@ -48,8 +48,8 @@ /* The version of UBI images supported by this implementation */ #define UBI_VERSION 1 ---- a/mkfs.ubifs/mkfs.ubifs.h -+++ b/mkfs.ubifs/mkfs.ubifs.h +--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h ++++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h @@ -32,7 +32,17 @@ #include #include @@ -68,9 +68,9 @@ #include #include ---- a/mkfs.ubifs/mkfs.ubifs.c -+++ b/mkfs.ubifs/mkfs.ubifs.c -@@ -1010,6 +1010,7 @@ static int add_inode_with_data(struct st +--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c ++++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +@@ -1219,6 +1219,7 @@ static int add_inode(struct stat *st, in if (c->default_compr != UBIFS_COMPR_NONE) use_flags |= UBIFS_COMPR_FL; @@ -78,7 +78,7 @@ if (flags & FS_COMPR_FL) use_flags |= UBIFS_COMPR_FL; if (flags & FS_SYNC_FL) -@@ -1020,6 +1021,7 @@ static int add_inode_with_data(struct st +@@ -1229,6 +1230,7 @@ static int add_inode(struct stat *st, in use_flags |= UBIFS_APPEND_FL; if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode)) use_flags |= UBIFS_DIRSYNC_FL; @@ -86,7 +86,7 @@ memset(ino, 0, UBIFS_INO_NODE_SZ); -@@ -1089,7 +1091,9 @@ static int add_dir_inode(DIR *dir, ino_t +@@ -1293,7 +1295,9 @@ static int add_dir_inode(const char *pat fd = dirfd(dir); if (fd == -1) return sys_err_msg("dirfd failed"); @@ -96,20 +96,23 @@ flags = 0; } -@@ -1274,10 +1278,12 @@ static int add_file(const char *path_nam +@@ -1476,6 +1480,7 @@ static int add_file(const char *path_nam key_write(&key, &dn->key); dn->size = cpu_to_le32(bytes_read); out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ; +#ifndef NO_NATIVE_SUPPORT if (c->default_compr == UBIFS_COMPR_NONE && (flags & FS_COMPR_FL)) + #ifdef WITHOUT_LZO +@@ -1484,6 +1489,7 @@ static int add_file(const char *path_nam use_compr = UBIFS_COMPR_LZO; + #endif else +#endif use_compr = c->default_compr; compr_type = compress_data(buf, bytes_read, &dn->data, &out_len, use_compr); -@@ -1319,7 +1325,9 @@ static int add_non_dir(const char *path_ +@@ -1527,7 +1533,9 @@ static int add_non_dir(const char *path_ if (fd == -1) return sys_err_msg("failed to open file '%s'", path_name); @@ -119,9 +122,9 @@ flags = 0; if (close(fd) == -1) return sys_err_msg("failed to close file '%s'", ---- a/mkfs.ubifs/devtable.c -+++ b/mkfs.ubifs/devtable.c -@@ -134,6 +134,7 @@ static int interpret_table_entry(const c +--- a/ubifs-utils/mkfs.ubifs/devtable.c ++++ b/ubifs-utils/mkfs.ubifs/devtable.c +@@ -135,6 +135,7 @@ static int interpret_table_entry(const c unsigned int mode = 0755, uid = 0, gid = 0, major = 0, minor = 0; unsigned int start = 0, increment = 0, count = 0; @@ -129,17 +132,19 @@ if (sscanf(line, "%1023s %c %o %u %u %u %u %u %u %u", buf, &type, &mode, &uid, &gid, &major, &minor, &start, &increment, &count) < 0) -@@ -144,8 +145,8 @@ static int interpret_table_entry(const c +@@ -145,10 +146,10 @@ static int interpret_table_entry(const c buf, type, mode, uid, gid, major, minor, start, increment, count); - len = strnlen(buf, 1024); -- if (len == 1024) + len = strlen(buf); + if (len == 0) + return err_msg("empty path"); +- if (len == 1024) + if (len == 1023) return err_msg("too long path"); - if (!strcmp(buf, "/")) + if (buf[0] != '/') --- a/include/common.h +++ b/include/common.h @@ -26,7 +26,6 @@ @@ -148,8 +153,8 @@ #include -#include #include - #include "version.h" - + #include + #include --- a/include/mtd/ubifs-media.h +++ b/include/mtd/ubifs-media.h @@ -33,7 +33,15 @@ diff --git a/tools/mtd-utils/patches/120-include_sysmacros.patch b/tools/mtd-utils/patches/120-include_sysmacros.patch deleted file mode 100644 index 81ba1cfb2b..0000000000 --- a/tools/mtd-utils/patches/120-include_sysmacros.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 9a06f45ec71116d76ee4b268ebe1b33d45b06fc0 Mon Sep 17 00:00:00 2001 -From: Mike Frysinger -Date: Sat, 16 Apr 2016 22:10:43 -0400 -Subject: [PATCH mtd-utils] include sys/sysmacros.h for major/minor/makedev - -These functions have always been defined in sys/sysmacros.h under -Linux C libraries. For some, including sys/types.h implicitly -includes that as well, but glibc wants to deprecate that, and some -others already have. Include the header explicitly for the funcs. - -Signed-off-by: Mike Frysinger ---- - include/common.h | 1 + - 1 file changed, 1 insertion(+) - ---- a/include/common.h -+++ b/include/common.h -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - #include "version.h" - - #ifndef PROGRAM_NAME diff --git a/tools/mtd-utils/patches/130-lzma_jffs2.patch b/tools/mtd-utils/patches/130-lzma_jffs2.patch index 05ced4f42c..d9cbfeebec 100644 --- a/tools/mtd-utils/patches/130-lzma_jffs2.patch +++ b/tools/mtd-utils/patches/130-lzma_jffs2.patch @@ -1,26 +1,29 @@ ---- a/Makefile -+++ b/Makefile -@@ -4,6 +4,7 @@ - VERSION = 1.5.2 +--- a/jffsX-utils/Makemodule.am ++++ b/jffsX-utils/Makemodule.am +@@ -4,11 +4,19 @@ mkfs_jffs2_SOURCES = \ + jffsX-utils/compr_zlib.c \ + jffsX-utils/compr.h \ + jffsX-utils/rbtree.c \ +- jffsX-utils/compr_lzo.c \ ++ jffsX-utils/compr_lzma.c \ ++ jffsX-utils/lzma/LzFind.c \ ++ jffsX-utils/lzma/LzmaEnc.c \ ++ jffsX-utils/lzma/LzmaDec.c \ + jffsX-utils/compr.c \ + jffsX-utils/compr_rtime.c ++ ++if !WITHOUT_LZO ++mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c ++endif ++ + mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +-mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) ++mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) -I./include/linux/lzma - CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS) -+CPPFLAGS += -I./include/linux/lzma - - ifeq ($(WITHOUT_XATTR), 1) - CPPFLAGS += -DWITHOUT_XATTR -@@ -84,7 +85,9 @@ $(BUILDDIR)/include/version.h.tmp: - # - # Utils in top level - # --obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o -+obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o $(if $(WITHOUT_LZO),,compr_lzo.o)\ -+ compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o \ -+ compr.o rbtree.o - LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) - LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) - ---- a/compr.c -+++ b/compr.c + jffs2reader_SOURCES = jffsX-utils/jffs2reader.c + jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +--- a/jffsX-utils/compr.c ++++ b/jffsX-utils/compr.c @@ -520,6 +520,9 @@ int jffs2_compressors_init(void) #ifdef CONFIG_JFFS2_LZO jffs2_lzo_init(); @@ -40,8 +43,8 @@ +#endif return 0; } ---- a/compr.h -+++ b/compr.h +--- a/jffsX-utils/compr.h ++++ b/jffsX-utils/compr.h @@ -18,13 +18,14 @@ #define CONFIG_JFFS2_ZLIB @@ -72,7 +75,7 @@ #endif /* __JFFS2_COMPR_H__ */ --- /dev/null -+++ b/compr_lzma.c ++++ b/jffsX-utils/compr_lzma.c @@ -0,0 +1,128 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. @@ -900,7 +903,7 @@ + +#endif --- /dev/null -+++ b/lzma/LzFind.c ++++ b/jffsX-utils/lzma/LzFind.c @@ -0,0 +1,753 @@ +/* LzFind.c -- Match finder for LZ algorithms +2008-04-04 @@ -1656,7 +1659,7 @@ + } +} --- /dev/null -+++ b/lzma/LzmaDec.c ++++ b/jffsX-utils/lzma/LzmaDec.c @@ -0,0 +1,1014 @@ +/* LzmaDec.c -- LZMA Decoder +2008-04-29 @@ -2673,7 +2676,7 @@ + return res; +} --- /dev/null -+++ b/lzma/LzmaEnc.c ++++ b/jffsX-utils/lzma/LzmaEnc.c @@ -0,0 +1,2335 @@ +/* LzmaEnc.c -- LZMA Encoder +2008-04-28 @@ -5010,9 +5013,9 @@ + LzmaEnc_Destroy(p, alloc, allocBig); + return res; +} ---- a/mkfs.jffs2.c -+++ b/mkfs.jffs2.c -@@ -1659,11 +1659,11 @@ int main(int argc, char **argv) +--- a/jffsX-utils/mkfs.jffs2.c ++++ b/jffsX-utils/mkfs.jffs2.c +@@ -1666,11 +1666,11 @@ int main(int argc, char **argv) } erase_block_size *= units; diff --git a/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch b/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch deleted file mode 100644 index 90d4ef4c36..0000000000 --- a/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch +++ /dev/null @@ -1,119 +0,0 @@ ---- a/mkfs.ubifs/compr.c -+++ b/mkfs.ubifs/compr.c -@@ -24,7 +24,6 @@ - #include - #include - #include --#include - #include - - #define crc32 __zlib_crc32 -@@ -34,7 +33,6 @@ - #include "compr.h" - #include "mkfs.ubifs.h" - --static void *lzo_mem; - static unsigned long long errcnt = 0; - static struct ubifs_info *c = &info_; - -@@ -85,6 +83,25 @@ static int zlib_deflate(void *in_buf, si - return 0; - } - -+#ifndef WITHOUT_LZO -+#include -+ -+static void *lzo_mem; -+ -+static int lzo_init(void) -+{ -+ lzo_mem = malloc(LZO1X_999_MEM_COMPRESS); -+ if (!lzo_mem) -+ return -1; -+ -+ return 0; -+} -+ -+static void lzo_fini(void) -+{ -+ free(lzo_mem); -+} -+ - static int lzo_compress(void *in_buf, size_t in_len, void *out_buf, - size_t *out_len) - { -@@ -102,6 +119,12 @@ static int lzo_compress(void *in_buf, si - - return 0; - } -+#else -+static inline int lzo_compress(void *in_buf, size_t in_len, void *out_buf, -+ size_t *out_len) { return -1; } -+static inline int lzo_init(void) { return 0; } -+static inline void lzo_fini(void) { } -+#endif - - static int no_compress(void *in_buf, size_t in_len, void *out_buf, - size_t *out_len) -@@ -122,7 +145,6 @@ static int favor_lzo_compress(void *in_b - lzo_len = zlib_len = *out_len; - lzo_ret = lzo_compress(in_buf, in_len, out_buf, &lzo_len); - zlib_ret = zlib_deflate(in_buf, in_len, zlib_buf, &zlib_len); -- - if (lzo_ret && zlib_ret) - /* Both compressors failed */ - return -1; -@@ -197,23 +219,28 @@ int compress_data(void *in_buf, size_t i - - int init_compression(void) - { -- lzo_mem = malloc(LZO1X_999_MEM_COMPRESS); -- if (!lzo_mem) -- return -1; -+ int ret; -+ -+ ret = lzo_init(); -+ if (ret) -+ goto err; - - zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR); -- if (!zlib_buf) { -- free(lzo_mem); -- return -1; -- } -+ if (!zlib_buf) -+ goto err_lzo; - - return 0; -+ -+err_lzo: -+ lzo_fini(); -+err: -+ return ret; - } - - void destroy_compression(void) - { - free(zlib_buf); -- free(lzo_mem); -+ lzo_fini(); - if (errcnt) - fprintf(stderr, "%llu compression errors occurred\n", errcnt); - } ---- a/Makefile -+++ b/Makefile -@@ -108,7 +108,13 @@ $(call _mkdep,lib/,libmtd.a) - obj-mkfs.ubifs = crc16.o lpt.o compr.o devtable.o \ - hashtable/hashtable.o hashtable/hashtable_itr.o - LDFLAGS_mkfs.ubifs = $(ZLIBLDFLAGS) $(LZOLDFLAGS) $(UUIDLDFLAGS) --LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -+ifeq ($(WITHOUT_LZO), 1) -+ CPPFLAGS += -DWITHOUT_LZO -+else -+ LZOLDLIBS = -llzo2 -+endif -+ -+LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid - $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a) - - # diff --git a/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch b/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch index 95ce1e9137..d95ece184c 100644 --- a/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch +++ b/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch @@ -1,5 +1,5 @@ ---- a/ubi-utils/libubigen.c -+++ b/ubi-utils/libubigen.c +--- a/lib/libubigen.c ++++ b/lib/libubigen.c @@ -122,8 +122,9 @@ int ubigen_add_volume(const struct ubige return 0; } @@ -75,8 +75,8 @@ return 0; out_free: ---- a/ubi-utils/include/libubigen.h -+++ b/ubi-utils/include/libubigen.h +--- a/include/libubigen.h ++++ b/include/libubigen.h @@ -188,6 +188,9 @@ int ubigen_write_layout_vol(const struct long long ec1, long long ec2, struct ubi_vtbl_record *vtbl, int fd); diff --git a/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch b/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch index cbb2802c5a..0da28b71f2 100644 --- a/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch +++ b/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch @@ -1,6 +1,6 @@ --- a/ubi-utils/ubinize.c +++ b/ubi-utils/ubinize.c -@@ -70,6 +70,8 @@ static const char optionsstr[] = +@@ -60,6 +60,8 @@ static const char optionsstr[] = " (default is 1)\n" "-Q, --image-seq= 32-bit UBI image sequence number to use\n" " (by default a random number is picked)\n" @@ -8,17 +8,8 @@ +" output image\n" "-v, --verbose be verbose\n" "-h, --help print help message\n" - "-V, --version print program version"; -@@ -79,7 +81,7 @@ static const char usage[] = - "\t\t[-x ] [-Q ] [-v] [-h] [-V] [--output=] [--peb-size=]\n" - "\t\t[--min-io-size=] [--sub-page-size=] [--vid-hdr-offset=]\n" - "\t\t[--erase-counter=] [--ubi-ver=] [--image-seq=] [--verbose] [--help]\n" --"\t\t[--version] ini-file\n" -+"\t\t[--eof-markers=] [--version] ini-file\n" - "Example: " PROGRAM_NAME " -o ubi.img -p 16KiB -m 512 -s 256 cfg.ini - create UBI image\n" - " 'ubi.img' as described by configuration file 'cfg.ini'"; - -@@ -125,6 +127,7 @@ static const struct option long_options[ + "-V, --version print program version\n\n"; +@@ -79,6 +81,7 @@ static const struct option long_options[ { .name = "erase-counter", .has_arg = 1, .flag = NULL, .val = 'e' }, { .name = "ubi-ver", .has_arg = 1, .flag = NULL, .val = 'x' }, { .name = "image-seq", .has_arg = 1, .flag = NULL, .val = 'Q' }, @@ -26,7 +17,7 @@ { .name = "verbose", .has_arg = 0, .flag = NULL, .val = 'v' }, { .name = "help", .has_arg = 0, .flag = NULL, .val = 'h' }, { .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' }, -@@ -144,6 +147,7 @@ struct args { +@@ -98,6 +101,7 @@ struct args { uint32_t image_seq; int verbose; dictionary *dict; @@ -34,7 +25,7 @@ }; static struct args args = { -@@ -162,7 +166,7 @@ static int parse_opt(int argc, char * co +@@ -116,7 +120,7 @@ static int parse_opt(int argc, char * co int key, error = 0; unsigned long int image_seq; @@ -43,7 +34,7 @@ if (key == -1) break; -@@ -222,6 +226,12 @@ static int parse_opt(int argc, char * co +@@ -176,6 +180,12 @@ static int parse_opt(int argc, char * co args.image_seq = image_seq; break; @@ -56,7 +47,7 @@ case 'v': args.verbose = 1; break; -@@ -599,6 +609,18 @@ int main(int argc, char * const argv[]) +@@ -559,6 +569,18 @@ int main(int argc, char * const argv[]) printf("\n"); } diff --git a/tools/mtd-utils/patches/310-add-static-linking-option.patch b/tools/mtd-utils/patches/310-add-static-linking-option.patch deleted file mode 100644 index 828d7751e5..0000000000 --- a/tools/mtd-utils/patches/310-add-static-linking-option.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/common.mk -+++ b/common.mk -@@ -2,6 +2,16 @@ CC := $(CROSS)gcc - AR := $(CROSS)ar - RANLIB := $(CROSS)ranlib - -+ifeq ($(STATIC),1) -+ define static_link -+ -Wl,-Bstatic $(1) -Wl,-Bdynamic -+ endef -+else -+ define static_link -+ $(1) -+ endef -+endif -+ - # Stolen from Linux build system - comma = , - try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)") ---- a/Makefile -+++ b/Makefile -@@ -89,10 +89,10 @@ obj-mkfs.jffs2 = compr_rtime.o compr_zli - compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o \ - compr.o rbtree.o - LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) --LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) -+LDLIBS_mkfs.jffs2 = $(call static_link,-lz $(LZOLDLIBS)) - - LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS) --LDLIBS_jffs2reader = -lz $(LZOLDLIBS) -+LDLIBS_jffs2reader = $(call static_link,-lz $(LZOLDLIBS)) - - $(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v)))) - -@@ -114,7 +114,7 @@ else - LZOLDLIBS = -llzo2 - endif - --LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid -+LDLIBS_mkfs.ubifs = $(call static_link,-lz $(LZOLDLIBS)) -lm $(call static_link,-luuid) - $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a) - - # diff --git a/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch b/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch index 70e6a7e360..8e58059576 100644 --- a/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch +++ b/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch @@ -1,6 +1,6 @@ ---- a/mkfs.jffs2.c -+++ b/mkfs.jffs2.c -@@ -108,7 +108,7 @@ static char *rootdir = default_rootdir; +--- a/jffsX-utils/mkfs.jffs2.c ++++ b/jffsX-utils/mkfs.jffs2.c +@@ -109,7 +109,7 @@ static char *rootdir = default_rootdir; static int verbose = 0; static int squash_uids = 0; static int squash_perms = 0; @@ -8,8 +8,8 @@ +static time_t fixed_timestamp = -1; int target_endian = __BYTE_ORDER; - uint32_t find_hardlink(struct filesystem_entry *e) -@@ -249,8 +249,8 @@ static struct filesystem_entry *add_host + static uint32_t find_hardlink(struct filesystem_entry *e) +@@ -250,8 +250,8 @@ static struct filesystem_entry *add_host mode &= ~(S_ISUID | S_ISGID); } } @@ -20,7 +20,7 @@ } entry = xcalloc(1, sizeof(struct filesystem_entry)); -@@ -1554,6 +1554,20 @@ void parse_image(){ +@@ -1557,6 +1557,20 @@ static void parse_image(void){ close(in_fd); } @@ -41,7 +41,7 @@ int main(int argc, char **argv) { int c, opt; -@@ -1572,6 +1586,7 @@ int main(int argc, char **argv) +@@ -1575,6 +1589,7 @@ int main(int argc, char **argv) warn_page_size = 1; /* warn user if page size not 4096 */ jffs2_compressors_init(); @@ -49,7 +49,7 @@ while ((opt = getopt_long(argc, argv, "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) -@@ -1622,7 +1637,7 @@ int main(int argc, char **argv) +@@ -1625,7 +1640,7 @@ int main(int argc, char **argv) break; case 'f': From patchwork Thu Apr 19 22:12:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 901536 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hauke-m.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EbTsQIYZ"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40RtY51Gr9z9s3F for ; Fri, 20 Apr 2018 08:13:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OSMNs4z8A/pvMDEB4re7iKyv5d/qqzy6fEYmUB2oCKw=; b=EbTsQIYZQiEvLI qoXvqOJgn8iKDoRSW8Q8zkZPlutHM3vSBm+QsGwEqkwYqk9WgGqla0p4LVs7A1fbkQ/HA8yZGnOQH k1Z9htiDIMFzSxHdnHXyEGY399lFjX7fvkVbUa9OlCM9984hGWFL2V92hC9OF2z7gCBOl/WaCj1TM +KHem7tx89pH2uLj9T8K5F6YyHq9sQcGbDvFZ5v8izHWh+8bCDrE2rj7FCCsX1dhVXIx/cCO2VHbY yJ3AuPqzfYebgWjQJL15/618fIon8xpUNWap1mg9By05fbmisqg0nXGnUAnug6rqI/ioA5353CE9N X5PMnQe79+pHr/qxAcnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Hnt-0007tt-57; Thu, 19 Apr 2018 22:13:21 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Hn4-0007PY-B5 for lede-dev@lists.infradead.org; Thu, 19 Apr 2018 22:12:37 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 37E8342FF7; Fri, 20 Apr 2018 00:12:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id L6MSOG0gqKdx; Fri, 20 Apr 2018 00:12:15 +0200 (CEST) From: Hauke Mehrtens To: lede-dev@lists.infradead.org Date: Fri, 20 Apr 2018 00:12:05 +0200 Message-Id: <20180419221206.5124-4-hauke@hauke-m.de> In-Reply-To: <20180419221206.5124-1-hauke@hauke-m.de> References: <20180419221206.5124-1-hauke@hauke-m.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180419_151230_712409_CC4454AB X-CRM114-Status: GOOD ( 19.29 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [80.241.60.212 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Subject: [LEDE-DEV] [PATCH v2 4/5] mtd-utils: update to 2.0.2 X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hauke@hauke-m.de, wong.syrone@gmail.com, koen.vandeputte@ncentric.com, luci@createc.ro MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Syrone Wong 010-fix-rpmatch.patch is upstream, removed from our patchset The file structure is changed, modify patch accordingly use CONFIGURE_ARGS to disable tests, xattr and lzo Compile and run tested on mvebu and x86_64 Signed-off-by: Syrone Wong Tested-by: Koen Vandeputte --- changes since v1: * Update to version 2.0.2 * use ftp to download the tar package/utils/mtd-utils/Makefile | 22 ++++---- .../utils/mtd-utils/patches/010-fix-rpmatch.patch | 19 ------- .../utils/mtd-utils/patches/100-fix_includes.patch | 2 +- .../utils/mtd-utils/patches/130-lzma_jffs2.patch | 66 ++++++++++++---------- 4 files changed, 47 insertions(+), 62 deletions(-) delete mode 100644 package/utils/mtd-utils/patches/010-fix-rpmatch.patch diff --git a/package/utils/mtd-utils/Makefile b/package/utils/mtd-utils/Makefile index 1e3c281156..2ce7d671fe 100644 --- a/package/utils/mtd-utils/Makefile +++ b/package/utils/mtd-utils/Makefile @@ -8,15 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_VERSION:=1.5.2 +PKG_VERSION:=2.0.2 PKG_RELEASE:=1 -PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git -PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=aea36417067dade75192bafa03af70b6eb2677b1 -PKG_MIRROR_HASH:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/mtd-utils/ +PKG_HASH:=fb3de61be8e932abb424e8ea3c30298f553d5f970ad158a737bb303bbf9660b8 PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared @@ -54,12 +54,12 @@ define Package/nand-utils/description Utilities for NAND devices. endef -MAKE_FLAGS += \ - DESTDIR="$(PKG_INSTALL_DIR)" \ - BUILDDIR="$(PKG_BUILD_DIR)" \ - LDLIBS+="$(LIBGCC_S)" \ - WITHOUT_XATTR=1 \ - WITHOUT_LZO=1 +MAKE_FLAGS += LDLIBS+="$(LIBGCC_S)" + +CONFIGURE_ARGS += \ + --disable-tests \ + --without-xattr \ + --without-lzo define Package/ubi-utils/install $(INSTALL_DIR) $(1)/usr/sbin diff --git a/package/utils/mtd-utils/patches/010-fix-rpmatch.patch b/package/utils/mtd-utils/patches/010-fix-rpmatch.patch deleted file mode 100644 index 8374a26e9b..0000000000 --- a/package/utils/mtd-utils/patches/010-fix-rpmatch.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/include/common.h -+++ b/include/common.h -@@ -152,10 +152,12 @@ static inline bool prompt(const char *ms - } - - if (strcmp("\n", line) != 0) { -- switch (rpmatch(line)) { -- case 0: ret = false; break; -- case 1: ret = true; break; -- case -1: -+ switch (line[0]) { -+ case 'N': -+ case 'n': ret = false; break; -+ case 'Y': -+ case 'y': ret = true; break; -+ default: - puts("unknown response; please try again"); - continue; - } diff --git a/package/utils/mtd-utils/patches/100-fix_includes.patch b/package/utils/mtd-utils/patches/100-fix_includes.patch index 7dad28b472..cc75052c5e 100644 --- a/package/utils/mtd-utils/patches/100-fix_includes.patch +++ b/package/utils/mtd-utils/patches/100-fix_includes.patch @@ -5,6 +5,6 @@ #include #include +#include + #include "libfec.h" /* - * stuff used for testing purposes only diff --git a/package/utils/mtd-utils/patches/130-lzma_jffs2.patch b/package/utils/mtd-utils/patches/130-lzma_jffs2.patch index c6454fed57..d9cbfeebec 100644 --- a/package/utils/mtd-utils/patches/130-lzma_jffs2.patch +++ b/package/utils/mtd-utils/patches/130-lzma_jffs2.patch @@ -1,25 +1,29 @@ ---- a/Makefile -+++ b/Makefile -@@ -3,7 +3,7 @@ +--- a/jffsX-utils/Makemodule.am ++++ b/jffsX-utils/Makemodule.am +@@ -4,11 +4,19 @@ mkfs_jffs2_SOURCES = \ + jffsX-utils/compr_zlib.c \ + jffsX-utils/compr.h \ + jffsX-utils/rbtree.c \ +- jffsX-utils/compr_lzo.c \ ++ jffsX-utils/compr_lzma.c \ ++ jffsX-utils/lzma/LzFind.c \ ++ jffsX-utils/lzma/LzmaEnc.c \ ++ jffsX-utils/lzma/LzmaDec.c \ + jffsX-utils/compr.c \ + jffsX-utils/compr_rtime.c ++ ++if !WITHOUT_LZO ++mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c ++endif ++ + mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +-mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) ++mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) -I./include/linux/lzma - VERSION = 1.5.2 - --CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS) -+CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS) -I./include/linux/lzma - - ifeq ($(WITHOUT_XATTR), 1) - CPPFLAGS += -DWITHOUT_XATTR -@@ -84,7 +84,7 @@ $(BUILDDIR)/include/version.h.tmp: - # - # Utils in top level - # --obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o -+obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o $(if $(WITHOUT_LZO),,compr_lzo.o) compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o compr.o rbtree.o - LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) - LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) - ---- a/compr.c -+++ b/compr.c + jffs2reader_SOURCES = jffsX-utils/jffs2reader.c + jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +--- a/jffsX-utils/compr.c ++++ b/jffsX-utils/compr.c @@ -520,6 +520,9 @@ int jffs2_compressors_init(void) #ifdef CONFIG_JFFS2_LZO jffs2_lzo_init(); @@ -39,8 +43,8 @@ +#endif return 0; } ---- a/compr.h -+++ b/compr.h +--- a/jffsX-utils/compr.h ++++ b/jffsX-utils/compr.h @@ -18,13 +18,14 @@ #define CONFIG_JFFS2_ZLIB @@ -71,7 +75,7 @@ #endif /* __JFFS2_COMPR_H__ */ --- /dev/null -+++ b/compr_lzma.c ++++ b/jffsX-utils/compr_lzma.c @@ -0,0 +1,128 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. @@ -187,7 +191,7 @@ + + ret = lzma_alloc_workspace(&props); + if (ret < 0) -+ return ret; ++ return ret; + + ret = jffs2_register_compressor(&jffs2_lzma_comp); + if (ret) @@ -899,7 +903,7 @@ + +#endif --- /dev/null -+++ b/lzma/LzFind.c ++++ b/jffsX-utils/lzma/LzFind.c @@ -0,0 +1,753 @@ +/* LzFind.c -- Match finder for LZ algorithms +2008-04-04 @@ -1655,7 +1659,7 @@ + } +} --- /dev/null -+++ b/lzma/LzmaDec.c ++++ b/jffsX-utils/lzma/LzmaDec.c @@ -0,0 +1,1014 @@ +/* LzmaDec.c -- LZMA Decoder +2008-04-29 @@ -2672,7 +2676,7 @@ + return res; +} --- /dev/null -+++ b/lzma/LzmaEnc.c ++++ b/jffsX-utils/lzma/LzmaEnc.c @@ -0,0 +1,2335 @@ +/* LzmaEnc.c -- LZMA Encoder +2008-04-28 @@ -5009,9 +5013,9 @@ + LzmaEnc_Destroy(p, alloc, allocBig); + return res; +} ---- a/mkfs.jffs2.c -+++ b/mkfs.jffs2.c -@@ -1659,11 +1659,11 @@ int main(int argc, char **argv) +--- a/jffsX-utils/mkfs.jffs2.c ++++ b/jffsX-utils/mkfs.jffs2.c +@@ -1666,11 +1666,11 @@ int main(int argc, char **argv) } erase_block_size *= units; From patchwork Thu Apr 19 22:12:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 901535 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hauke-m.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MKtDaYI5"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40RtXM42d5z9s1t for ; Fri, 20 Apr 2018 08:12:51 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=o7iY4qkrldf0cXK9K/LY3c9utOoHwV9PkpyA+TNTv3s=; b=MKtDaYI5VKYJ4A HzNC+A+vf8k724+MppORc1iiA6LVtiOBvH1/9N614yB8lCdHis6NMggRNfQpNlKGvBW7PyvwUqdQ9 KMYhGApFDPWwzLS08JY2U0rCeG7ocqyAt1m68HdZMrVUuwo0pYIF8xuLzfEXhnuDxO8yb2R8bNFTy STo/iq/6J9oQm6TUVAIvuxqYzsAdwO5TeljPCHDjlIWKjqTFCdpgkKzA6uyjvTqA7QSPR2bZ8xnPn oR3O4527+4VrZAia/PGxUf6JN2BlkjeOdXw4tKcN3pKjQmahyxN1t6ctxo6zJ6sKgfsuGX2i3O2K8 /emAbvcccjJerRTcBEug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9HnG-0007bE-Sf; Thu, 19 Apr 2018 22:12:42 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Hn4-0007Pn-E9 for lede-dev@lists.infradead.org; Thu, 19 Apr 2018 22:12:35 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id C207C40F6C; Fri, 20 Apr 2018 00:12:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id Pr2cZ_R-NFKq; Fri, 20 Apr 2018 00:12:16 +0200 (CEST) From: Hauke Mehrtens To: lede-dev@lists.infradead.org Date: Fri, 20 Apr 2018 00:12:06 +0200 Message-Id: <20180419221206.5124-5-hauke@hauke-m.de> In-Reply-To: <20180419221206.5124-1-hauke@hauke-m.de> References: <20180419221206.5124-1-hauke@hauke-m.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180419_151230_671373_E0F3D03F X-CRM114-Status: GOOD ( 10.28 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [80.241.60.215 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Subject: [LEDE-DEV] [PATCH v2 5/5] mtd-utils: activate --gc-sections X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hauke@hauke-m.de, wong.syrone@gmail.com, koen.vandeputte@ncentric.com, luci@createc.ro MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This reduces the size of the binary a bit: old: 37556 bin/targets/lantiq/xrx200/packages/nand-utils_2.0.1-1_mips_24kc.ipk 81697 bin/targets/lantiq/xrx200/packages/ubi-utils_2.0.1-1_mips_24kc.ipk new: 27450 bin/targets/lantiq/xrx200/packages/nand-utils_2.0.1-1_mips_24kc.ipk 71796 bin/targets/lantiq/xrx200/packages/ubi-utils_2.0.1-1_mips_24kc.ipk Signed-off-by: Hauke Mehrtens Tested-by: Koen Vandeputte --- package/utils/mtd-utils/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/utils/mtd-utils/Makefile b/package/utils/mtd-utils/Makefile index 2ce7d671fe..ca60726d81 100644 --- a/package/utils/mtd-utils/Makefile +++ b/package/utils/mtd-utils/Makefile @@ -61,6 +61,9 @@ CONFIGURE_ARGS += \ --without-xattr \ --without-lzo +TARGET_CFLAGS += -ffunction-sections -fdata-sections +TARGET_LDFLAGS += -Wl,--gc-sections + define Package/ubi-utils/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) \