Skip to contentSkip to conversation

ubi-utils-klibc: update from v. 1.5.2 to 2.0.2

PATCH New Andrea Adami 1 participant 1 message May 23, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ubi-utils-klibc: update from v. 1.5.2 to 2.0.2

Update to new version and drop accepted patches.
Use autotools and packageconfig (for xattrs).

---
 .../0001-Makefile-build-ubi-utils-only.patch       |  87 ------
 .../0002-common.mk-for-klibc-CC-is-klcc.patch      |  27 --
 ...bubi.c-add-klibc-specific-fixes-for-ioctl.patch |  76 -----
 ...patibility-to-dietlibc-klibc-musl-libc-af.patch |  88 ------
 ...-more-workarounds-for-klibc-compatibility.patch |  52 ----
 ...rser-remove-unused-function-needing-float.patch |  85 ------
 ...ls-common.c-convert-to-integer-arithmetic.patch |  64 ----
 ...ubiformat.c-convert-to-integer-arithmetic.patch |  44 ---
 ...arnings-about-implicit-non-const-casting-.patch |  48 ---
 ...h-fix-klibc-build-when-using-glibc-toolch.patch |  40 +++
 ...doing-preprocessor-magic-just-output-off_.patch | 326 +++++++++++++++++++++
 .../0003-Makefile.am-only-build-ubi-utils.patch    |  34 +++
 ...s-common.h-no-features.h-for-klibc-builds.patch |  38 +++
 .../0005-common.h-replace-getline-with-fgets.patch |  56 ++++
 ...ils-klibc_1.5.2.bb => ubi-utils-klibc_2.0.2.bb} |  27 +-
 15 files changed, 508 insertions(+), 584 deletions(-)
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0001-libmissing.h-fix-klibc-build-when-using-glibc-toolch.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0002-Instead-of-doing-preprocessor-magic-just-output-off_.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0003-Makefile.am-only-build-ubi-utils.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0004-mtd-utils-common.h-no-features.h-for-klibc-builds.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0005-common.h-replace-getline-with-fgets.patch
 rename meta-initramfs/recipes-devtools/mtd/{ubi-utils-klibc_1.5.2.bb => ubi-utils-klibc_2.0.2.bb} (64%)
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch deleted +0 -87
deleted file mode 100644
index 6ac2cca..0000000
@@ -1,87 +0,0 @@
-From 1c989e4c36d0bf76ab444f984bc73b98eeacd03f Mon Sep 17 00:00:00 2001
-From: Andrea Adami <[email protected]>
-Date: Sun, 29 Jun 2014 00:32:29 +0200
-Subject: [PATCH 1/9] Makefile: build ubi-utils only
-
-We build all the static ubi-utils but actually only ubiattach is needed in
-a minimalistic initramfs for the mount of ubi volumes.
-
-More fixes are needed in order to build the full mtd-utils.
-The first issue is:
-
-| mkfs.jffs2.c:64:20: fatal error: libgen.h: No such file or directory
-|  #include <libgen.h>
-
-Removing the include then the second error is:
-
-| mkfs.jffs2.c:1570:22: error: '_SC_PAGESIZE' undeclared
-| (first use in this function)
-|   page_size = sysconf(_SC_PAGESIZE);
-
-Upstream-Status: Inappropriate [embedded specific]
-
-Signed-off-by: Andrea Adami <[email protected]>
----
- Makefile | 26 ++------------------------
- 1 file changed, 2 insertions(+), 24 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 3ce8587..8b79f71 100644
---- a/Makefile
-+++ b/Makefile
-@@ -16,28 +16,11 @@ endif
- 
- TESTS = tests
- 
--MTD_BINS = \
--	ftl_format flash_erase nanddump doc_loadbios \
--	ftl_check mkfs.jffs2 flash_lock flash_unlock \
--	flash_otp_info flash_otp_dump flash_otp_lock flash_otp_write \
--	mtd_debug flashcp nandwrite nandtest mtdpart \
--	jffs2dump \
--	nftldump nftl_format docfdisk \
--	rfddump rfdformat \
--	serve_image recv_image \
--	sumtool jffs2reader
- UBI_BINS = \
- 	ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \
- 	ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ubiblock
- 
--BINS = $(MTD_BINS)
--BINS += mkfs.ubifs/mkfs.ubifs
--BINS += $(addprefix ubi-utils/,$(UBI_BINS))
--SCRIPTS = flash_eraseall
--
--TARGETS = $(BINS)
--TARGETS += lib/libmtd.a
--TARGETS += ubi-utils/libubi.a
-+BINS = $(addprefix ubi-utils/,$(UBI_BINS))
- 
- OBJDEPS = $(BUILDDIR)/include/version.h
- 
-@@ -61,12 +44,9 @@ endif
- 	rm -f $(BUILDDIR)/include/version.h
- 	$(MAKE) -C $(TESTS) clean
- 
--install:: $(addprefix $(BUILDDIR)/,${BINS}) ${SCRIPTS}
-+install:: $(addprefix $(BUILDDIR)/,${BINS})
- 	mkdir -p ${DESTDIR}/${SBINDIR}
- 	install -m 0755 $^ ${DESTDIR}/${SBINDIR}/
--	mkdir -p ${DESTDIR}/${MANDIR}/man1
--	install -m 0644 mkfs.jffs2.1 ${DESTDIR}/${MANDIR}/man1/
--	-gzip -9f ${DESTDIR}/${MANDIR}/man1/*.1
- 
- tests::
- 	$(MAKE) -C $(TESTS)
-@@ -91,8 +71,6 @@ LDLIBS_mkfs.jffs2  = -lz $(LZOLDLIBS)
- LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
- LDLIBS_jffs2reader  = -lz $(LZOLDLIBS)
- 
--$(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v))))
--
- #
- # Common libmtd
- #
--- 
-2.7.4
-
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch deleted +0 -27
deleted file mode 100644
index c23d11f..0000000
@@ -1,27 +0,0 @@
-From 89c76bbe82a2029a25b0654eb0a1d0b22d6e6877 Mon Sep 17 00:00:00 2001
-From: Andrea Adami <[email protected]>
-Date: Sun, 29 Jun 2014 00:37:28 +0200
-Subject: [PATCH 2/9] common.mk: for klibc $(CC) is klcc
-
-Do not hardcode: assign the value to the variable if it is not already defined.
-
-Upstream-Status: Submitted
-
-Signed-off-by: Andrea Adami <[email protected]>
----
- common.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/common.mk b/common.mk
-index ba87377..126d11a 100644
---- a/common.mk
-+++ b/common.mk
-@@ -1,4 +1,4 @@
--CC := $(CROSS)gcc
-+CC ?= $(CROSS)gcc
- AR := $(CROSS)ar
- RANLIB := $(CROSS)ranlib
- 
--- 
-2.7.4
-
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch deleted +0 -76

76 lines not on this page · raw message

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch deleted +0 -88

88 lines not on this page · raw message

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch deleted +0 -52

52 lines not on this page · raw message

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch deleted +0 -85

85 lines not on this page · raw message

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch deleted +0 -64

64 lines not on this page · raw message

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch deleted +0 -44

44 lines not on this page · raw message

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch deleted +0 -48

48 lines not on this page · raw message

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0001-libmissing.h-fix-klibc-build-when-using-glibc-toolch.patch new file +40 -0
new file mode 100644
index 0000000..6ed167f
@@ -0,0 +1,40 @@
+From e596ae99059c28fa9bb3461e03e7ecaacbf41727 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <[email protected]>
+Date: Wed, 23 May 2018 15:34:59 +0200
+Subject: [PATCH] libmissing.h: fix klibc build when using glibc toolchain
+
+klibc lacks execinfo.h so adda guard around it.
+Note: build with musl toolchain is ok even without this patch.
+
+Fix build error:
+
+| In file included from ../git/lib/execinfo.c:1:0:
+| ../git/include/libmissing.h:7:10: fatal error: execinfo.h: 
+ No such file or directory
+
+Status: Inappropriate [klibc specific]
+
+Signed-off-by: Andrea Adami <[email protected]>
+---
+ include/libmissing.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/libmissing.h b/include/libmissing.h
+index 0196033..832c372 100644
+--- a/include/libmissing.h
++++ b/include/libmissing.h
+@@ -3,9 +3,11 @@
+ 
+ #include "config.h"
+ 
++#ifndef __KLIBC__
+ #ifdef HAVE_EXECINFO_H
+ #include <execinfo.h>
+ #endif
++#endif
+ 
+ #ifndef HAVE_EXECINFO_H
+ int backtrace(void **buffer, int size);
+-- 
+2.7.4
+
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0002-Instead-of-doing-preprocessor-magic-just-output-off_.patch new file +326 -0

326 lines not on this page · raw message

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0003-Makefile.am-only-build-ubi-utils.patch new file +34 -0
new file mode 100644
index 0000000..08c53d1
@@ -0,0 +1,34 @@
+From 139d93bc405272a3261d57be26da842e737fe4d0 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <[email protected]>
+Date: Sun, 28 Jan 2018 23:10:34 +0100
+Subject: [PATCH 3/4] Makefile.am: only build ubi-utils
+
+We only target the ubi-utils, static, small.
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Andrea Adami <[email protected]>
+---
+ Makefile.am | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 5a6e77c..98715dd 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -34,9 +34,9 @@ EXTRA_DIST += $(GLOBAL_HEADER) $(GLOBAL_EXTRA)
+ 
+ include lib/Makemodule.am
+ include ubi-utils/Makemodule.am
+-include misc-utils/Makemodule.am
+-include nand-utils/Makemodule.am
+-include nor-utils/Makemodule.am
++#include misc-utils/Makemodule.am
++#include nand-utils/Makemodule.am
++#include nor-utils/Makemodule.am
+ 
+ if BUILD_UBIFS
+ include ubifs-utils/Makemodule.am
+-- 
+2.7.4
+
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0004-mtd-utils-common.h-no-features.h-for-klibc-builds.patch new file +38 -0
new file mode 100644
index 0000000..5da05fa
@@ -0,0 +1,38 @@
+From ae1cf6d0eb1833e46549328a4473222c259723d7 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <[email protected]>
+Date: Thu, 1 Feb 2018 00:25:00 +0100
+Subject: [PATCH 4/4] mtd-utils: common.h: no features.h for klibc builds
+
+Add guard around features.h to fix missing include (here first error):
+
+ ../git/include/common.h:29:10:
+ fatal error: features.h: No such file or directory
+  #include <features.h>
+           ^~~~~~~~~~~~
+ compilation terminated
+
+Upstream-Status: Submitted
+
+Signed-off-by: Andrea Adami <[email protected]>
+---
+ include/common.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/include/common.h b/include/common.h
+index 642c212..f7c71fe 100644
+--- a/include/common.h
++++ b/include/common.h
+@@ -26,7 +26,10 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <errno.h>
++#if defined(__KLIBC__)
++#else
+ #include <features.h>
++#endif
+ #include <inttypes.h>
+ #include <unistd.h>
+ #include <sys/sysmacros.h>
+-- 
+2.7.4
+
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0005-common.h-replace-getline-with-fgets.patch new file +56 -0

56 lines not on this page · raw message

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_2.0.2.bb renamed from meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb +14 -13
similarity index 64%
rename from meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb
rename to meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_2.0.2.bb
index abb0d4b..8b00981 100644
@@ -7,30 +7,31 @@ LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
                     file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c"
 
-inherit klibc
+inherit autotools pkgconfig klibc
 
-SRCREV = "aea36417067dade75192bafa03af70b6eb2677b1"
+SRCREV = "bc63d36e39f389c8c17f6a8e9db47f2acc884659"
 SRC_URI = "git://git.infradead.org/mtd-utils.git \
-             file://0001-Makefile-build-ubi-utils-only.patch \
-             file://0002-common.mk-for-klibc-CC-is-klcc.patch \
-             file://0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch \
-             file://0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch \
-             file://0005-common.h-more-workarounds-for-klibc-compatibility.patch \
-             file://0006-libiniparser-remove-unused-function-needing-float.patch \
-             file://0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch \
-             file://0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch \
-             file://0009-Eliminate-warnings-about-implicit-non-const-casting-.patch \
+             file://0001-libmissing.h-fix-klibc-build-when-using-glibc-toolch.patch \
+             file://0002-Instead-of-doing-preprocessor-magic-just-output-off_.patch \
+             file://0003-Makefile.am-only-build-ubi-utils.patch \
+             file://0004-mtd-utils-common.h-no-features.h-for-klibc-builds.patch \
+             file://0005-common.h-replace-getline-with-fgets.patch \
              "
 
 S = "${WORKDIR}/git/"
 
-EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}include -DWITHOUT_XATTR' 'BUILDDIR=${S}'"
+EXTRA_OECONF += "--disable-tests --without-jffs --without-ubifs"
+
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'xattr', d)}"
+PACKAGECONFIG[xattr] = ",,acl,"
+
+EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} ${@bb.utils.contains('PACKAGECONFIG', 'xattr', '', '-DWITHOUT_XATTR', d)} -I${S}/include' 'BUILDDIR=${S}'"
 
 do_install () {
 	oe_runmake install DESTDIR=${D} SBINDIR=${sbindir} MANDIR=${mandir} INCLUDEDIR=${includedir}
 }
 
-PACKAGES = "ubi-utils-klibc-dbg"
+PACKAGES = "ubi-utils-klibc-dbg ubi-utils-klibc-doc"
 
 PACKAGES =+ "mtdinfo-klibc ubiattach-klibc ubiblock-klibc ubicrc32-klibc ubidetach-klibc \
              ubiformat-klibc ubimkvol-klibc ubinfo-klibc ubinize-klibc ubirename-klibc \
Signature · 1 line
2.7.4