All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-initramfs][PATCH 1/2] ubi-utils-klibc_1.5.0: remove recipe and patches
@ 2014-11-13  0:13 Andrea Adami
  2014-11-13  0:13 ` [meta-initramfs][PATCH 2/2] ubi-utils-klibc_1.5.1: initial commit of v. 1.5.1 Andrea Adami
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Adami @ 2014-11-13  0:13 UTC (permalink / raw)
  To: openembedded-devel

Next patch replaces with v. 1.5.1 and new/rebased patchset

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 .../mtd/ubi-utils-klibc/Makefile.patch             | 53 ----------------------
 .../mtd/ubi-utils-klibc/common.mk.patch            |  8 ----
 .../mtd/ubi-utils-klibc/libiniparser.c.patch       | 19 --------
 .../mtd/ubi-utils-klibc/libubi.c.patch             | 28 ------------
 .../mtd/ubi-utils-klibc/ubiformat.c.patch          | 20 --------
 .../recipes-devtools/mtd/ubi-utils-klibc_1.5.0.bb  | 49 --------------------
 6 files changed, 177 deletions(-)
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/common.mk.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libiniparser.c.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libubi.c.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/ubiformat.c.patch
 delete mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.0.bb

diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch
deleted file mode 100644
index b7dad87..0000000
--- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/Makefile	2012-05-01 19:46:47.000000000 +0200
-+++ b/Makefile	2012-05-01 19:48:01.000000000 +0200
-@@ -16,27 +16,13 @@
- 
- 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 mtd_debug flashcp nandwrite nandtest \
--	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
- 
--BINS = $(MTD_BINS)
--BINS += mkfs.ubifs/mkfs.ubifs
--BINS += $(addprefix ubi-utils/,$(UBI_BINS))
--SCRIPTS = flash_eraseall
-+BINS = $(addprefix ubi-utils/,$(UBI_BINS))
- 
- TARGETS = $(BINS)
--TARGETS += lib/libmtd.a
--TARGETS += ubi-utils/libubi.a
- 
- OBJDEPS = $(BUILDDIR)/include/version.h
- 
-@@ -58,12 +44,9 @@
- 	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)
-@@ -88,7 +71,6 @@
- LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
- LDLIBS_jffs2reader  = -lz $(LZOLDLIBS)
- 
--$(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v))))
- 
- #
- # Common libmtd
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/common.mk.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/common.mk.patch
deleted file mode 100644
index 0a48416..0000000
--- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/common.mk.patch
+++ /dev/null
@@ -1,8 +0,0 @@
---- a/common.mk	2012-04-29 18:15:30.000000000 +0200
-+++ b/common.mk	2012-04-29 00:51:53.000000000 +0200
-@@ -1,4 +1,4 @@
--CC := $(CROSS)gcc
-+CC := $(CROSS)klcc
- AR := $(CROSS)ar
- RANLIB := $(CROSS)ranlib
- 
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libiniparser.c.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libiniparser.c.patch
deleted file mode 100644
index 45f2439..0000000
--- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libiniparser.c.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- a/ubi-utils/libiniparser.c	2012-05-29 23:46:08.000000000 +0200
-+++ b/ubi-utils/libiniparser.c	2012-05-29 23:45:01.000000000 +0200
-@@ -327,6 +327,8 @@
-   the notfound value is returned.
-  */
- /*--------------------------------------------------------------------------*/
-+/* Floating-point is not supported in klibc */
-+/*
- double iniparser_getdouble(dictionary * d, char * key, double notfound)
- {
-     char    *   str ;
-@@ -335,6 +337,7 @@
-     if (str==INI_INVALID_KEY) return notfound ;
-     return atof(str);
- }
-+*/
- 
- /*-------------------------------------------------------------------------*/
- /**
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libubi.c.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libubi.c.patch
deleted file mode 100644
index b52e207..0000000
--- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libubi.c.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- a/ubi-utils/libubi.c	2012-05-01 01:57:51.000000000 +0200
-+++ b/ubi-utils/libubi.c	2012-05-01 01:55:14.000000000 +0200
-@@ -686,7 +706,7 @@
-  * success and %-1 in case of failure. @r->ubi_num contains newly created UBI
-  * device number.
-  */
--static int do_attach(const char *node, const struct ubi_attach_req *r)
-+static int do_attach(const char *node, struct ubi_attach_req *r)
- {
- 	int fd, ret;
- 
-@@ -1346,13 +1346,13 @@
- 
- int ubi_set_property(int fd, uint8_t property, uint64_t value)
- {
--	struct ubi_set_prop_req r;
-+	struct ubi_set_vol_prop_req r;
- 
--	memset(&r, 0, sizeof(struct ubi_set_prop_req));
-+	memset(&r, 0, sizeof(struct ubi_set_vol_prop_req));
- 	r.property = property;
- 	r.value = value;
- 
--	return ioctl(fd, UBI_IOCSETPROP, &r);
-+	return ioctl(fd, UBI_IOCSETVOLPROP, &r);
- }
- 
- int ubi_leb_unmap(int fd, int lnum)
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/ubiformat.c.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/ubiformat.c.patch
deleted file mode 100644
index d21ed57..0000000
--- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/ubiformat.c.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/ubi-utils/ubiformat.c	2012-05-03 01:14:39.000000000 +0200
-+++ b/ubi-utils/ubiformat.c	2012-05-20 23:11:57.000000000 +0200
-@@ -246,7 +246,7 @@
- 
- 	while (1) {
- 		normsg_cont("continue? (yes/no)  ");
--		if (scanf("%3s", buf) == EOF) {
-+		if (fgets(buf,4,stdin) == NULL) {
- 			sys_errmsg("scanf returned unexpected EOF, assume \"yes\"");
- 			return 1;
- 		}
-@@ -262,7 +262,7 @@
- 	char buf[4];
- 
- 	while (1) {
--		if (scanf("%3s", buf) == EOF) {
-+		if (fgets(buf,4,stdin) == NULL) {
- 			sys_errmsg("scanf returned unexpected EOF, assume \"no\"");
- 			return 0;
- 		}
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.0.bb b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.0.bb
deleted file mode 100644
index 134dd80..0000000
--- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.0.bb
+++ /dev/null
@@ -1,49 +0,0 @@
-SUMMARY = "UBI utils statically compiled against klibc"
-DESCRIPTION = "Small sized tools from mtd-utils for use with initramfs."
-SECTION = "base"
-DEPENDS = "zlib lzo e2fsprogs util-linux"
-HOMEPAGE = "http://www.linux-mtd.infradead.org/"
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
-                    file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c"
-
-
-inherit klibc
-
-SRC_URI = "git://git.infradead.org/mtd-utils.git;tag=ca39eb1d98e736109c64ff9c1aa2a6ecca222d8f \
-            file://Makefile.patch \
-            file://common.mk.patch \
-            file://libubi.c.patch \
-            file://libiniparser.c.patch \
-            file://ubiformat.c.patch \
-"
-
-S = "${WORKDIR}/git/"
-
-EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}include -DWITHOUT_XATTR' 'BUILDDIR=${S}'"
-
-do_install () {
-
-    install -d ${D}${sbindir}
-    oe_runmake DESTDIR="${D}" install
-
-}
-
-PACKAGES = "ubi-utils-klibc-dbg"
-
-PACKAGES =+ "ubinfo-klibc ubiattach-klibc ubidetach-klibc mtdinfo-klibc ubiupdatevol-klibc \
-             ubimkvol-klibc ubirename-klibc ubirmvol-klibc ubirsvol-klibc \
-             ubinize-klibc ubiformat-klibc ubicrc32-klibc"
-
-FILES_ubinfo-klibc = "${sbindir}/ubinfo"
-FILES_ubiattach-klibc = "${sbindir}/ubiattach"
-FILES_ubidetach-klibc = "${sbindir}/ubidetach"
-FILES_mtdinfo-klibc = "${sbindir}/mtdinfo"
-FILES_ubiupdatevol-klibc = "${sbindir}/ubiupdatevol"
-FILES_ubimkvol-klibc = "${sbindir}/ubimkvol"
-FILES_ubirename-klibc = "${sbindir}/ubirename"
-FILES_ubirmvol-klibc = "${sbindir}/ubirmvol"
-FILES_ubirsvol-klibc = "${sbindir}/ubirsvol"
-FILES_ubinize-klibc = "${sbindir}/ubinize"
-FILES_ubiformat-klibc = "${sbindir}/ubiformat"
-FILES_ubicrc32-klibc = "${sbindir}/ubicrc32"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [meta-initramfs][PATCH 2/2] ubi-utils-klibc_1.5.1: initial commit of v. 1.5.1
  2014-11-13  0:13 [meta-initramfs][PATCH 1/2] ubi-utils-klibc_1.5.0: remove recipe and patches Andrea Adami
@ 2014-11-13  0:13 ` Andrea Adami
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Adami @ 2014-11-13  0:13 UTC (permalink / raw)
  To: openembedded-devel

NOTE: we track master upstream so we are some commits ahead v 1.5.1.

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 .../0001-Makefile-only-build-ubi-utils.patch       | 87 ++++++++++++++++++++++
 .../0002-common.mk-for-klibc-CC-is-klcc.patch      | 27 +++++++
 .../0003-libubi.c-add-klibc-specific-fixes.patch   | 76 +++++++++++++++++++
 .../0004-common.h-klibc-fixes-1.patch              | 84 +++++++++++++++++++++
 .../0005-common.h-klibc-fixes-2.patch              | 61 +++++++++++++++
 ...rser-remove-unused-function-needing-float.patch | 85 +++++++++++++++++++++
 .../recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb  | 50 +++++++++++++
 7 files changed, 470 insertions(+)
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch
 create mode 100644 meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb

diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch
new file mode 100644
index 0000000..9d5e4eb
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch
@@ -0,0 +1,87 @@
+From c4e6bd9378645d577e9d9f85da85f1438afe7c50 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Sun, 29 Jun 2014 00:32:29 +0200
+Subject: [PATCH 1/6] 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 <andrea.adami@gmail.com>
+---
+ Makefile | 24 ++----------------------
+ 1 file changed, 2 insertions(+), 22 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index eade234..2275865 100644
+--- a/Makefile
++++ b/Makefile
+@@ -16,28 +16,13 @@ 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 \
+-	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
++BINS = $(addprefix ubi-utils/,$(UBI_BINS))
+ 
+ TARGETS = $(BINS)
+-TARGETS += lib/libmtd.a
+-TARGETS += ubi-utils/libubi.a
+ 
+ OBJDEPS = $(BUILDDIR)/include/version.h
+ 
+@@ -61,12 +46,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 +73,6 @@ LDLIBS_mkfs.jffs2  = -lz $(LZOLDLIBS)
+ LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
+ LDLIBS_jffs2reader  = -lz $(LZOLDLIBS)
+ 
+-$(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v))))
+-
+ #
+ # Common libmtd
+ #
+-- 
+1.9.1
+
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch
new file mode 100644
index 0000000..89c494e
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch
@@ -0,0 +1,27 @@
+From f3609c7c0450b4c31e1d4603fcf2cfb1ba46f994 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Sun, 29 Jun 2014 00:37:28 +0200
+Subject: [PATCH 2/6] common.mk: for klibc $(CC) is klcc
+
+Do not hardcode: assign the value to the variable if it is not already defined.
+
+Upstream-Status: Pending
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ common.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/common.mk b/common.mk
+index ba87377..59c56df 100644
+--- a/common.mk
++++ b/common.mk
+@@ -1,4 +1,4 @@
+-CC := $(CROSS)gcc
++CC ?= $(CROSS)gcc
+ AR := $(CROSS)ar
+ RANLIB := $(CROSS)ranlib
+ 
+-- 
+1.9.1
+
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch
new file mode 100644
index 0000000..440e864
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch
@@ -0,0 +1,76 @@
+From 72a39bb3290a79e76b0dbf59eef83ea2d9b577a1 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Sun, 29 Jun 2014 00:40:15 +0200
+Subject: [PATCH 3/6] libubi.c: add klibc specific fixes for ioctl
+
+First issue is that ioctl() in klibc doesn't expect a constant as arg3.
+Second issue is that arg3 in klibc ioctl() implementation is not optional.
+
+Fixes:
+
+| ubi-utils/libubi.c: In function 'do_attach':
+| ubi-utils/libubi.c:698:8: warning: passing argument 3 of 'ioctl' discards
+| 'const' qualifier from pointer target type
+|   ret = ioctl(fd, UBI_IOCATT, r);
+|         ^
+| In file included from ubi-utils/libubi.c:32:0:
+| .../lib/klibc/include/sys/ioctl.h:15:14: note: expected 'void *' but argument
+| is of type 'const struct ubi_attach_req *'
+|  __extern int ioctl(int, int, void *);
+|               ^
+
+| ubi-utils/libubi.c: In function 'ubi_vol_block_create':
+| ubi-utils/libubi.c:1118:9: error: too few arguments to function 'ioctl'
+|   return ioctl(fd, UBI_IOCVOLCRBLK);
+|          ^
+| In file included from ubi-utils/libubi.c:32:0:
+| .../lib/klibc/include/sys/ioctl.h:15:14: note: declared here
+|  __extern int ioctl(int, int, void *);
+|               ^
+| ubi-utils/libubi.c: In function 'ubi_vol_block_remove':
+| ubi-utils/libubi.c:1123:9: error: too few arguments to function 'ioctl'
+|   return ioctl(fd, UBI_IOCVOLRMBLK);
+|          ^
+| In file included from ubi-utils/libubi.c:32:0:
+| .../usr/lib/klibc/include/sys/ioctl.h:15:14: note: declared here
+|  __extern int ioctl(int, int, void *);
+|               ^
+
+Upstream-Status: Inappropriate [klibc specific]
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ ubi-utils/libubi.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/ubi-utils/libubi.c b/ubi-utils/libubi.c
+index 1e08b7d..491e525 100644
+--- a/ubi-utils/libubi.c
++++ b/ubi-utils/libubi.c
+@@ -687,7 +687,7 @@ void libubi_close(libubi_t desc)
+  * success and %-1 in case of failure. @r->ubi_num contains newly created UBI
+  * device number.
+  */
+-static int do_attach(const char *node, const struct ubi_attach_req *r)
++static int do_attach(const char *node, struct ubi_attach_req *r)
+ {
+ 	int fd, ret;
+ 
+@@ -1115,12 +1115,12 @@ int ubi_rsvol(libubi_t desc, const char *node, int vol_id, long long bytes)
+ 
+ int ubi_vol_block_create(int fd)
+ {
+-	return ioctl(fd, UBI_IOCVOLCRBLK);
++	return ioctl(fd, UBI_IOCVOLCRBLK, NULL);
+ }
+ 
+ int ubi_vol_block_remove(int fd)
+ {
+-	return ioctl(fd, UBI_IOCVOLRMBLK);
++	return ioctl(fd, UBI_IOCVOLRMBLK, NULL);
+ }
+ 
+ int ubi_update_start(libubi_t desc, int fd, long long bytes)
+-- 
+1.9.1
+
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch
new file mode 100644
index 0000000..fee1cbc
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch
@@ -0,0 +1,84 @@
+From e56767b9caa02e7c41803499c77dc939d5a7f64a Mon Sep 17 00:00:00 2001
+From: Thorsten Glaser <tg@mirbsd.org>
+Date: Fri, 20 Jun 2014 10:56:27 +0000
+Subject: [PATCH 4/6] Restore compatibility to dietlibc, klibc, musl libc after commit 4f1b108
+
+Each C library has their own way to define off_t, and the <features.h>
+header is nonstandard and specific to the GNU libc and those that clone
+it (uClibc). Fefe’s dietlibc uses different flags, and klibc always uses
+a 64-bit off_t (like the BSDs); musl libc cannot be recognised using cpp
+instructions, so we assume 64 bit there (and on unknown C libraries) and
+leave it to the user to submit a follow-up fix if we guess wrong. I also
+added a static assertion to verify the 64 bit guess is correct.
+
+It would be really better using a configure script for this instead.
+
+Fixes:
+|   CC      lib/libmtd.o
+| In file included from ubi-utils/ubiutils-common.c:35:0:
+| ./include/common.h:29:22: fatal error: features.h: No such file or directory
+|  #include <features.h>
+|                       ^
+| compilation terminated.
+
+Upstream-Status: Pending
+
+Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ include/common.h | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/include/common.h b/include/common.h
+index 6895e5c..77f3f7d 100644
+--- a/include/common.h
++++ b/include/common.h
+@@ -26,7 +26,9 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <errno.h>
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ #include <features.h>
++#endif
+ #include <inttypes.h>
+ #include "version.h"
+ 
+@@ -52,6 +54,21 @@ extern "C" {
+ #endif
+ 
+ /* define a print format specifier for off_t */
++#if defined(__KLIBC__)
++/* always 64 bit on klibc */
++#define PRIxoff_t PRIx64
++#define PRIdoff_t PRId64
++#elif defined(__dietlibc__)
++/* depends on compiler flags on dietlibc */
++#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
++#define PRIxoff_t PRIx64
++#define PRIdoff_t PRId64
++#else
++#define PRIxoff_t "l"PRIx32
++#define PRIdoff_t "l"PRId32
++#endif
++#elif defined(__GLIBC__) || defined(__UCLIBC__)
++/* depends on compiler flags on glibc and uClibc */
+ #ifdef __USE_FILE_OFFSET64
+ #define PRIxoff_t PRIx64
+ #define PRIdoff_t PRId64
+@@ -59,6 +76,13 @@ extern "C" {
+ #define PRIxoff_t "l"PRIx32
+ #define PRIdoff_t "l"PRId32
+ #endif
++#else
++/* unknown libc or musl */
++#define PRIxoff_t PRIx64
++#define PRIdoff_t PRId64
++/* verify our guess of 64 bit is correct */
++static char __PRIxoff_t_static_assert[sizeof(off_t) == 8 ? 1 : -1];
++#endif
+ 
+ /* Verbose messages */
+ #define bareverbose(verbose, fmt, ...) do {                        \
+-- 
+1.9.1
+
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch
new file mode 100644
index 0000000..2e43d5d
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch
@@ -0,0 +1,61 @@
+From 8318852ef4f768bed31072aa7b57e11adc1f639c Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Sun, 29 Jun 2014 00:44:03 +0200
+Subject: [PATCH 5/6] common.h: more workarounds for klibc compatibility
+
+Patch is addressing two issues:
+* First,  Klibc doesn't have rpmatch().
+* Second, Klibc lacks getline()
+
+Fixes:
+|   LD      ubi-utils/ubiformat
+| .../git/ubi-utils/ubiformat.o: In function `prompt':
+| .../git/./include/common.h:157: undefined reference to `getline'
+| .../git/./include/common.h:164: undefined reference to `rpmatch'
+| .../git/./include/common.h:157: undefined reference to `getline'
+| .../git/./include/common.h:164: undefined reference to `rpmatch'
+
+Upstream-Status: Pending
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ include/common.h | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/include/common.h b/include/common.h
+index 77f3f7d..2cbee0f 100644
+--- a/include/common.h
++++ b/include/common.h
+@@ -126,7 +126,7 @@ static char __PRIxoff_t_static_assert[sizeof(off_t) == 8 ? 1 : -1];
+ 	fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \
+ } while(0)
+ 
+-#if defined(__UCLIBC__)
++#if defined(__UCLIBC__) || defined(__KLIBC__)
+ /* uClibc versions before 0.9.34 don't have rpmatch() */
+ #if __UCLIBC_MAJOR__ == 0 && \
+ 		(__UCLIBC_MINOR__ < 9 || \
+@@ -146,15 +146,17 @@ static inline int __rpmatch(const char *resp)
+  */
+ static inline bool prompt(const char *msg, bool def)
+ {
+-	char *line = NULL;
+-	size_t len;
++	char *line;
+ 	bool ret = def;
+ 
++	const int sizeof_line = 2;
++	line = malloc(sizeof_line);
++
+ 	do {
+ 		normsg_cont("%s (%c/%c) ", msg, def ? 'Y' : 'y', def ? 'n' : 'N');
+ 		fflush(stdout);
+ 
+-		while (getline(&line, &len, stdin) == -1) {
++		while (fgets(line, sizeof_line, stdin) == NULL) {
+ 			printf("failed to read prompt; assuming '%s'\n",
+ 				def ? "yes" : "no");
+ 			break;
+-- 
+1.9.1
+
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch
new file mode 100644
index 0000000..043a89d
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch
@@ -0,0 +1,85 @@
+From 72a04a9b9ed33c889d2e2b86f306c5be9f6cde35 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Sun, 29 Jun 2014 00:44:57 +0200
+Subject: [PATCH 6/6] libiniparser: remove unused function needing float
+
+Fixes:
+|   LD      ubi-utils/ubiformat
+| .../git/ubi-utils/libiniparser.a(libiniparser.o): In function
+| `  LD      ubi-utils/ubirename
+| iniparser_getdouble':
+| .../git/ubi-utils/libiniparser.c:336: undefined reference to `atof'
+
+Grep doesn't reveal any occurrence of iniparser_getdouble(), using atof() so
+remove it: floating-point is not supported in klibc
+
+Upstream-Status: Pending
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ ubi-utils/include/libiniparser.h | 15 ---------------
+ ubi-utils/libiniparser.c         | 22 ----------------------
+ 2 files changed, 37 deletions(-)
+
+diff --git a/ubi-utils/include/libiniparser.h b/ubi-utils/include/libiniparser.h
+index be3c667..abd77aa 100644
+--- a/ubi-utils/include/libiniparser.h
++++ b/ubi-utils/include/libiniparser.h
+@@ -158,21 +158,6 @@ int iniparser_getint(dictionary * d, const char * key, int notfound);
+ 
+ /*-------------------------------------------------------------------------*/
+ /**
+-  @brief    Get the string associated to a key, convert to a double
+-  @param    d Dictionary to search
+-  @param    key Key string to look for
+-  @param    notfound Value to return in case of error
+-  @return   double
+-
+-  This function queries a dictionary for a key. A key as read from an
+-  ini file is given as "section:key". If the key cannot be found,
+-  the notfound value is returned.
+- */
+-/*--------------------------------------------------------------------------*/
+-double iniparser_getdouble(dictionary * d, char * key, double notfound);
+-
+-/*-------------------------------------------------------------------------*/
+-/**
+   @brief    Get the string associated to a key, convert to a boolean
+   @param    d Dictionary to search
+   @param    key Key string to look for
+diff --git a/ubi-utils/libiniparser.c b/ubi-utils/libiniparser.c
+index 898f57f..ba70c08 100644
+--- a/ubi-utils/libiniparser.c
++++ b/ubi-utils/libiniparser.c
+@@ -316,28 +316,6 @@ int iniparser_getint(dictionary * d, const char * key, int notfound)
+ 
+ /*-------------------------------------------------------------------------*/
+ /**
+-  @brief    Get the string associated to a key, convert to a double
+-  @param    d Dictionary to search
+-  @param    key Key string to look for
+-  @param    notfound Value to return in case of error
+-  @return   double
+-
+-  This function queries a dictionary for a key. A key as read from an
+-  ini file is given as "section:key". If the key cannot be found,
+-  the notfound value is returned.
+- */
+-/*--------------------------------------------------------------------------*/
+-double iniparser_getdouble(dictionary * d, char * key, double notfound)
+-{
+-    char    *   str ;
+-
+-    str = iniparser_getstring(d, key, INI_INVALID_KEY);
+-    if (str==INI_INVALID_KEY) return notfound ;
+-    return atof(str);
+-}
+-
+-/*-------------------------------------------------------------------------*/
+-/**
+   @brief    Get the string associated to a key, convert to a boolean
+   @param    d Dictionary to search
+   @param    key Key string to look for
+-- 
+1.9.1
+
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb
new file mode 100644
index 0000000..8ca1ca7
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb
@@ -0,0 +1,50 @@
+SUMMARY = "UBI utils statically compiled against klibc"
+DESCRIPTION = "Small sized tools from mtd-utils for use with initramfs."
+SECTION = "base"
+DEPENDS = "zlib lzo e2fsprogs util-linux"
+HOMEPAGE = "http://www.linux-mtd.infradead.org/"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
+                    file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c"
+
+inherit klibc
+
+SRC_URI = "git://git.infradead.org/mtd-utils.git;tag=b7455d847ab4f9eeeb6a729efc306bfda7bddc99 \
+             file://0001-Makefile-only-build-ubi-utils.patch \
+             file://0002-common.mk-for-klibc-CC-is-klcc.patch \
+             file://0003-libubi.c-add-klibc-specific-fixes.patch \
+             file://0004-common.h-klibc-fixes-1.patch \
+             file://0005-common.h-klibc-fixes-2.patch \
+             file://0006-libiniparser-remove-unused-function-needing-float.patch \
+             "
+
+S = "${WORKDIR}/git/"
+
+EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}include -DWITHOUT_XATTR' 'BUILDDIR=${S}'"
+
+do_install () {
+
+    install -d ${D}${sbindir}
+    oe_runmake DESTDIR="${D}" install
+
+}
+
+PACKAGES = "ubi-utils-klibc-dbg"
+
+PACKAGES =+ "mtdinfo-klibc ubiattach-klibc ubiblock-klibc ubicrc32-klibc ubidetach-klibc \
+             ubiformat-klibc ubimkvol-klibc ubinfo-klibc ubinize-klibc ubirename-klibc \
+             ubirmvol-klibc ubirsvol-klibc ubiupdatevol-klibc"
+
+FILES_mtdinfo-klibc = "${sbindir}/mtdinfo"
+FILES_ubiattach-klibc = "${sbindir}/ubiattach"
+FILES_ubiblock-klibc = "${sbindir}/ubiblock"
+FILES_ubicrc32-klibc = "${sbindir}/ubicrc32"
+FILES_ubidetach-klibc = "${sbindir}/ubidetach"
+FILES_ubiformat-klibc = "${sbindir}/ubiformat"
+FILES_ubimkvol-klibc = "${sbindir}/ubimkvol"
+FILES_ubinfo-klibc = "${sbindir}/ubinfo"
+FILES_ubinize-klibc = "${sbindir}/ubinize"
+FILES_ubirename-klibc = "${sbindir}/ubirename"
+FILES_ubirmvol-klibc = "${sbindir}/ubirmvol"
+FILES_ubirsvol-klibc = "${sbindir}/ubirsvol"
+FILES_ubiupdatevol-klibc = "${sbindir}/ubiupdatevol"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-13  0:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-13  0:13 [meta-initramfs][PATCH 1/2] ubi-utils-klibc_1.5.0: remove recipe and patches Andrea Adami
2014-11-13  0:13 ` [meta-initramfs][PATCH 2/2] ubi-utils-klibc_1.5.1: initial commit of v. 1.5.1 Andrea Adami

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.