[PATCH 1/2] tools: add cpio

David Bauer mail at david-bauer.net
Sat Feb 27 13:12:09 EST 2021


meditak-mt7622 as well as mediatek-mt7623 require CPIO to create their
initramfs images. So build CPIO as part of the host toolchain.

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 tools/Makefile                                |  2 +-
 tools/cpio/Makefile                           | 14 +++++++++++++
 .../patches/001-duplicate-program-name.patch  | 20 +++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 tools/cpio/Makefile
 create mode 100644 tools/cpio/patches/001-duplicate-program-name.patch

diff --git a/tools/Makefile b/tools/Makefile
index a2665dbc9a..65e0493e14 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -21,7 +21,7 @@ ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar
   BUILD_B43_TOOLS = y
 endif
 
-tools-y += autoconf autoconf-archive automake bc bison cmake dosfstools
+tools-y += autoconf autoconf-archive automake bc bison cmake cpio dosfstools
 tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
 tools-y += libressl libtool lzma m4 make-ext4fs missing-macros mkimage
 tools-y += mklibs mm-macros mtd-utils mtools padjffs2 patch-image
diff --git a/tools/cpio/Makefile b/tools/cpio/Makefile
new file mode 100644
index 0000000000..2852209847
--- /dev/null
+++ b/tools/cpio/Makefile
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-only
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=cpio
+PKG_CPE_ID:=cpe:/a:gnu:cpio
+PKG_VERSION:=2.13
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNU/cpio
+PKG_HASH:=eab5bdc5ae1df285c59f2a4f140a98fc33678a0bf61bdba67d9436ae26b46f6d
+
+include $(INCLUDE_DIR)/host-build.mk
+
+$(eval $(call HostBuild))
diff --git a/tools/cpio/patches/001-duplicate-program-name.patch b/tools/cpio/patches/001-duplicate-program-name.patch
new file mode 100644
index 0000000000..57ff4c3cad
--- /dev/null
+++ b/tools/cpio/patches/001-duplicate-program-name.patch
@@ -0,0 +1,20 @@
+author	Sergey Poznyakoff <gray at gnu.org>
+
+https://git.savannah.gnu.org/cgit/cpio.git/commit/?id=641d3f489cf6238bb916368d4ba0d9325a235afb
+
+* src/global.c: Remove superfluous declaration of program_name
+
+diff --git a/src/global.c b/src/global.c
+index fb3abe9..acf92bc 100644
+--- a/src/global.c
++++ b/src/global.c
+@@ -184,9 +184,6 @@ unsigned int warn_option = 0;
+ /* Extract to standard output? */
+ bool to_stdout_option = false;
+ 
+-/* The name this program was run with.  */
+-char *program_name;
+-
+ /* A pointer to either lstat or stat, depending on whether
+    dereferencing of symlinks is done for input files.  */
+ int (*xstat) ();
-- 
2.30.1




More information about the openwrt-devel mailing list