Yocto 2.5

Move OpenBMC to Yocto 2.5(sumo)

Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I5c5ad6904a16e14c1c397f0baf10c9d465594a78
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut_git.bb b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
index e18409d..ccf9f6a 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
@@ -6,10 +6,10 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
 PE = "1"
-PV = "045+git${SRCREV}"
+PV = "046+git${SRCREV}"
 
-# v045 tag
-SRCREV = "39c9b67f86145953aa30def9d77c68597a4ccfe8"
+# v046 tag
+SRCREV = "a0799ffb554487a370c2a1adafaedd2021b6dc8c"
 SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http \
            file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \
            "
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_8.40.bb b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_8.40.bb
index 5a99824..dc3a70b 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_8.40.bb
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_8.40.bb
@@ -4,6 +4,7 @@
 zipl (s390) boot loaders. It is primarily designed to be used from scripts which install \
 new kernels and need to find information about the current boot environment. \
 "
+HOMEPAGE = "https://github.com/rhboot/grubby"
 LICENSE = "GPLv2+"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a"
@@ -11,18 +12,15 @@
 DEPENDS = "popt util-linux"
 DEPENDS_append_libc-musl = " libexecinfo"
 
-SRC_URI = "https://github.com/rhinstaller/${BPN}/archive/${PV}-1.tar.gz;downloadfilename=${BPN}-${PV}-1.tar.gz \
+S = "${WORKDIR}/git"
+SRCREV = "79c5cfa02c567efdc5bb18cdd584789e2e35aa23"
+SRC_URI = "git://github.com/rhboot/grubby.git;protocol=https; \
            file://grubby-rename-grub2-editenv-to-grub-editenv.patch \
            file://run-ptest \
            file://0001-Add-another-variable-LIBS-to-provides-libraries-from.patch \
            file://0002-include-paths.h-for-_PATH_MOUNTED.patch \
            "
 
-SRC_URI[md5sum] = "1005907b275d6d93368d045274537d86"
-SRC_URI[sha256sum] = "85f1c678484f74c8978e8643451594967defce463a86c35cb1ee56d12767a9df"
-
-S = "${WORKDIR}/${BPN}-${PV}-1"
-
 RDEPENDS_${PN} += "dracut"
 
 inherit autotools-brokensep ptest
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-in_-structs-for-non-glibc-system-libs.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-in_-structs-for-non-glibc-system-libs.patch
index 8d1ec69..e7a0cce 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-in_-structs-for-non-glibc-system-libs.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-in_-structs-for-non-glibc-system-libs.patch
@@ -1,4 +1,4 @@
-From f414dea1316a48aba3e8e293201ebd51652d3ef4 Mon Sep 17 00:00:00 2001
+From 57e3a60b23891905733bfea7a1cb78c2377cc524 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sun, 9 Jul 2017 15:17:29 -0700
 Subject: [PATCH] Define in_* structs for non-glibc system libs
@@ -10,14 +10,38 @@
 to infer that these structs should be defined in linux/in.h
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- usr/include/netinet/in.h | 33 +++++++++++++++++++++++++++++++++
- 1 file changed, 33 insertions(+)
 
-Index: git/usr/include/netinet/in.h
-===================================================================
---- git.orig/usr/include/netinet/in.h
-+++ git/usr/include/netinet/in.h
+---
+ usr/include/net/if.h     | 11 +++++++++++
+ usr/include/netinet/in.h | 36 ++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+)
+
+diff --git a/usr/include/net/if.h b/usr/include/net/if.h
+index 116a176..6246b12 100644
+--- a/usr/include/net/if.h
++++ b/usr/include/net/if.h
+@@ -1,6 +1,17 @@
+ #ifndef _NET_IF_H
+ #define _NET_IF_H
+ 
++#ifndef __GLIBC__
++#include <linux/libc-compat.h>
++#undef __UAPI_DEF_IF_IFREQ
++#define __UAPI_DEF_IF_IFREQ            1
++#undef __UAPI_DEF_IF_IFNAMSIZ
++#define __UAPI_DEF_IF_IFNAMSIZ         1
++#undef __UAPI_DEF_IF_IFMAP
++#define __UAPI_DEF_IF_IFMAP            1
++#undef __UAPI_DEF_IF_NET_DEVICE_FLAGS
++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
++#endif
+ #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <linux/if.h>
+diff --git a/usr/include/netinet/in.h b/usr/include/netinet/in.h
+index 2952bb2..0c95bc9 100644
+--- a/usr/include/netinet/in.h
++++ b/usr/include/netinet/in.h
 @@ -5,6 +5,42 @@
  #ifndef _NETINET_IN_H
  #define _NETINET_IN_H
@@ -61,25 +85,3 @@
  #include <klibc/extern.h>
  #include <stdint.h>
  #include <endian.h>		/* Must be included *before* <linux/in.h> */
-Index: git/usr/include/net/if.h
-===================================================================
---- git.orig/usr/include/net/if.h
-+++ git/usr/include/net/if.h
-@@ -1,6 +1,17 @@
- #ifndef _NET_IF_H
- #define _NET_IF_H
- 
-+#ifndef __GLIBC__
-+#include <linux/libc-compat.h>
-+#undef __UAPI_DEF_IF_IFREQ
-+#define __UAPI_DEF_IF_IFREQ            1
-+#undef __UAPI_DEF_IF_IFNAMSIZ
-+#define __UAPI_DEF_IF_IFNAMSIZ         1
-+#undef __UAPI_DEF_IF_IFMAP
-+#define __UAPI_DEF_IF_IFMAP            1
-+#undef __UAPI_DEF_IF_NET_DEVICE_FLAGS
-+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
-+#endif
- #include <sys/socket.h>
- #include <sys/types.h>
- #include <linux/if.h>
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch
index 7cd4c0e..181dcfb 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch
@@ -1,4 +1,4 @@
-From 10fb440795a7796140bd657ee028847ec7c34447 Mon Sep 17 00:00:00 2001
+From 4b4147b76518d31a88fb2c58cdbf2236e159a25c Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 8 Sep 2017 23:10:54 -0700
 Subject: [PATCH] Kbuild.klibc: Add path to compiler headers via -isystem
@@ -7,12 +7,13 @@
 stdarg.h which is called from wrapper stdarg.h using include_next
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
 ---
- scripts/Kbuild.klibc | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
+ scripts/Kbuild.klibc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
-index f500d535..1d5cdc43 100644
+index 101f86f..1d5cdc4 100644
 --- a/scripts/Kbuild.klibc
 +++ b/scripts/Kbuild.klibc
 @@ -105,7 +105,8 @@ KLIBCOBJCOPY     := $(OBJCOPY)
@@ -25,6 +26,3 @@
  		    -I$(KLIBCINC)/arch/$(KLIBCARCHDIR)	\
                      -I$(KLIBCINC)/bits$(KLIBCBITSIZE)	\
  		    -I$(KLIBCOBJ)/../include		\
--- 
-2.14.1
-
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch
index 41cc142..1ba05a8 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch
@@ -1,19 +1,20 @@
-From f66edde8a704131d98e8783ea8d4c848e8119b20 Mon Sep 17 00:00:00 2001
+From b6185401fc3daa7fa8ba2b84db3e4da3b94a9867 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 26 Jul 2017 16:13:16 -0700
-Subject: [PATCH 1/3] Kbuild.klibc: Use -print-libgcc-file-name instead of
+Subject: [PATCH] Kbuild.klibc: Use -print-libgcc-file-name instead of
  --print-libgcc
 
 -print-libgcc-file-name works with clang and gcc unlike --print-libgcc
 which is gcc specific
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
 ---
  scripts/Kbuild.klibc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
-index f500d535..101f86f5 100644
+index f500d53..101f86f 100644
 --- a/scripts/Kbuild.klibc
 +++ b/scripts/Kbuild.klibc
 @@ -128,7 +128,7 @@ KLIBCCFLAGS      += $(KLIBCCPPFLAGS) $(KLIBCREQFLAGS) $(KLIBCARCHREQFLAGS)  \
@@ -25,6 +26,3 @@
  KLIBCLIBGCC	 ?= $(KLIBCLIBGCC_DEF)
  KLIBCCRT0        := $(KLIBCOBJ)/arch/$(KLIBCARCHDIR)/crt0.o
  KLIBCLIBC        := $(KLIBCOBJ)/libc.a
--- 
-2.13.3
-
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-always-use-bfd-linker.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-always-use-bfd-linker.patch
index 41a6b9e..de04d69 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-always-use-bfd-linker.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-always-use-bfd-linker.patch
@@ -1,4 +1,4 @@
-From 9ea19bd9636806a73bcf29cfcee40a268f91eb4c Mon Sep 17 00:00:00 2001
+From 63ab5102d6ef362a597941e62470bf19e6f1652b Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Tue, 11 Jul 2017 08:09:52 -0700
 Subject: [PATCH] always use bfd linker
@@ -8,12 +8,13 @@
 linking issues on such distros
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
 ---
  Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/Makefile b/Makefile
-index dc10fc5d..40647be4 100644
+index dc10fc5..40647be 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -20,7 +20,7 @@ include $(srctree)/scripts/Kbuild.include
@@ -25,6 +26,3 @@
  export AR	:= $(KLIBCROSS)ar
  export RANLIB	:= $(KLIBCROSS)ranlib
  export STRIP	:= $(KLIBCROSS)strip
--- 
-2.13.2
-
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch
index 9c0ea63..fcf4f89 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch
@@ -1,4 +1,4 @@
-From a46a144ac883898d9cedf7a0b13aec6d10116125 Mon Sep 17 00:00:00 2001
+From ebd2b0e414c98467156b961abb470b5d07f37ea8 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 29 Sep 2017 23:11:53 -0700
 Subject: [PATCH] arm: Do not set a fallback march and mtune
@@ -9,14 +9,13 @@
 which is a bit harder in OE
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
 
+---
  usr/klibc/arch/arm/MCONFIG | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/usr/klibc/arch/arm/MCONFIG b/usr/klibc/arch/arm/MCONFIG
-index 53bc1dc3..857e2f2d 100644
+index 303c6ac..48d2685 100644
 --- a/usr/klibc/arch/arm/MCONFIG
 +++ b/usr/klibc/arch/arm/MCONFIG
 @@ -10,7 +10,7 @@
@@ -28,6 +27,3 @@
  KLIBCBITSIZE  = 32
  KLIBCREQFLAGS += -fno-exceptions
  KLIBCSTRIPFLAGS += -R .ARM.exidx
--- 
-2.14.2
-
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-dash-Specify-format-string-in-fmtstr.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-dash-Specify-format-string-in-fmtstr.patch
index ae8c1f1..46a2398 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-dash-Specify-format-string-in-fmtstr.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-dash-Specify-format-string-in-fmtstr.patch
@@ -1,4 +1,4 @@
-From 2fff607fd0b5550e5072a6fffcbb01c29d5207d2 Mon Sep 17 00:00:00 2001
+From 8beffe501c1ac5b35d62004735c4157c74183901 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sun, 9 Jul 2017 13:51:25 -0700
 Subject: [PATCH] dash: Specify format string in fmtstr()
@@ -9,12 +9,13 @@
    col = fmtstr(s, 32, strsignal(st));
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
 ---
  usr/dash/jobs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/usr/dash/jobs.c b/usr/dash/jobs.c
-index 009bbfee..299bcacc 100644
+index 009bbfe..299bcac 100644
 --- a/usr/dash/jobs.c
 +++ b/usr/dash/jobs.c
 @@ -426,7 +426,7 @@ sprint_status(char *s, int status, int sigonly)
@@ -26,6 +27,3 @@
  #ifdef WCOREDUMP
  		if (WCOREDUMP(status)) {
  			col += fmtstr(s + col, 16, " (core dumped)");
--- 
-2.13.2
-
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-include-linux-sysinfo.h-directly.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-include-linux-sysinfo.h-directly.patch
index 1b033ac..04c97fc 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-include-linux-sysinfo.h-directly.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-include-linux-sysinfo.h-directly.patch
@@ -1,4 +1,4 @@
-From ab060a57b41f989665ade20e813bbcb67f91f1f2 Mon Sep 17 00:00:00 2001
+From d966d52d1e569cbc2293d841285e2b8941f28c61 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sun, 9 Jul 2017 15:56:28 -0700
 Subject: [PATCH] include linux/sysinfo.h directly
@@ -10,12 +10,13 @@
 override to avoid this assumption
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
 ---
  usr/include/sys/sysinfo.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/usr/include/sys/sysinfo.h b/usr/include/sys/sysinfo.h
-index dba68dc6..d145c0b1 100644
+index dba68dc..d145c0b 100644
 --- a/usr/include/sys/sysinfo.h
 +++ b/usr/include/sys/sysinfo.h
 @@ -5,7 +5,7 @@
@@ -27,6 +28,3 @@
  
  extern int sysinfo(struct sysinfo *info);
  
--- 
-2.13.2
-
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-mkfifo-Implement-mkfifo.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-mkfifo-Implement-mkfifo.patch
index 9791412..3bc081d 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-mkfifo-Implement-mkfifo.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-mkfifo-Implement-mkfifo.patch
@@ -1,15 +1,16 @@
-From b4e120f5edf06e6df138b1804a8b5180584cea6b Mon Sep 17 00:00:00 2001
+From cf97079009ba48d10e52052b2eab7461ea4dd09b Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 10 Jul 2017 20:42:50 -0700
 Subject: [PATCH] mkfifo: Implement mkfifo
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
 ---
  usr/utils/mkfifo.c | 5 +++++
  1 file changed, 5 insertions(+)
 
 diff --git a/usr/utils/mkfifo.c b/usr/utils/mkfifo.c
-index 5a758b2a..f1f577e6 100644
+index 5a758b2..f1f577e 100644
 --- a/usr/utils/mkfifo.c
 +++ b/usr/utils/mkfifo.c
 @@ -26,6 +26,11 @@ static int make_fifo(char *dir)
@@ -24,6 +25,3 @@
  int main(int argc, char *argv[])
  {
  	int c, ret = 0;
--- 
-2.13.2
-
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/armv4-fix-v4bx.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/armv4-fix-v4bx.patch
index 6bb384b..e842353 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/armv4-fix-v4bx.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/armv4-fix-v4bx.patch
@@ -1,11 +1,22 @@
+From d2fb484d995221277cce7abddcd7dfa0e8bceec3 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Fri, 11 Jan 2013 17:26:40 +0000
+Subject: [PATCH] klibc_2.0.2: apply FIX_V4BX patch for armv4 targets only
+
 Status: not applicable upstream, in OE/Yocto we use $(FIX_V4BX)
 which is "" in case of armv5 or thumbs.
 
 Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
 
---- a/usr/klibc/arch/arm/MCONFIG	2013-01-09 01:12:02.000000000 +0100
-+++ b/usr/klibc/arch/arm/MCONFIG	2013-01-08 23:45:59.000000000 +0100
-@@ -29,6 +29,7 @@
+---
+ usr/klibc/arch/arm/MCONFIG | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/usr/klibc/arch/arm/MCONFIG b/usr/klibc/arch/arm/MCONFIG
+index 53bc1dc..303c6ac 100644
+--- a/usr/klibc/arch/arm/MCONFIG
++++ b/usr/klibc/arch/arm/MCONFIG
+@@ -29,6 +29,7 @@ else
  KLIBCSHAREDFLAGS = -Ttext 0x01800200
  ifeq ($(CONFIG_AEABI),y)
  KLIBCREQFLAGS += -mabi=aapcs-linux -mno-thumb-interwork
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
index 9bc4835..5f47d3f 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
@@ -1,3 +1,11 @@
+From 0cb26cf2d25d36c1fdcc4f1635e4329436ed866a Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Fri, 19 Sep 2014 23:09:29 +0200
+
+---
+ klcc/klcc.in | 3 +++
+ 1 file changed, 3 insertions(+)
+
 diff --git a/klcc/klcc.in b/klcc/klcc.in
 index 43d0984..61e9385 100644
 --- a/klcc/klcc.in
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-config-eabi.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-config-eabi.patch
index 316c80a..f28cd54 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-config-eabi.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-config-eabi.patch
@@ -1,12 +1,22 @@
+From 1118cc971917abe19ddb029aa80417f6fd6bb343 Mon Sep 17 00:00:00 2001
+From: Thomas Kunze <thommycheck@gmx.de>
+Date: Sat, 6 Aug 2011 05:30:14 +0000
+Subject: [PATCH] klibc: initial commit of version 1.5.24
+
 Patch was imported from the OpenEmbedded git server
 (git://git.openembedded.org/openembedded)
 as of commit id b6764cf32ec93547531130dca364fb95e1c495f4
 Signed-off-by: Thomas Kunze <thommycheck@gmx.de>
 
-diff -Nur klibc-1.5/defconfig klibc-1.5p/defconfig
---- klibc-1.5/defconfig	2007-03-04 02:52:10.000000000 +0100
-+++ klibc-1.5p/defconfig	2008-02-08 19:24:22.337127756 +0100
-@@ -5,4 +5,4 @@
+---
+ defconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/defconfig b/defconfig
+index 04b98e9..0cb23d0 100644
+--- a/defconfig
++++ b/defconfig
+@@ -6,4 +6,4 @@ CONFIG_KLIBC_ZLIB=y
  CONFIG_REGPARM=y
  # ARM options
  # CONFIG_KLIBC_THUMB is not set
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-linux-libc-dev.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-linux-libc-dev.patch
index 2043064..a5563b7 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-linux-libc-dev.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-linux-libc-dev.patch
@@ -1,15 +1,22 @@
+From 1be2bc41f915922102a3ba671b54c2df6f0052e6 Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Sun, 14 Mar 2010 18:41:56 +0000
+Subject: [PATCH] klibc_1.5.26: now build against linux-libc-headers
+
 commit 43adf69062254fb4f8d4d11fb5fe36a60ae25d5a
-Author: Ben Hutchings <ben@decadent.org.uk>
-Date:   Sun Mar 14 18:41:56 2010 +0000
 
     Taken from debian "Fix klibc Debian specific build trouble"
     Adapted for klibc_2.0.2
 
-Index: klibc-2.0~rc2/scripts/Kbuild.install
-===================================================================
---- klibc-2.0~rc2.orig/scripts/Kbuild.install	2012-02-11 18:50:21.000000000 +0000
-+++ klibc-2.0~rc2/scripts/Kbuild.install	2012-02-11 19:04:52.000000000 +0000
-@@ -95,7 +95,9 @@
+---
+ scripts/Kbuild.install | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/Kbuild.install b/scripts/Kbuild.install
+index 8af5697..d32a8a5 100644
+--- a/scripts/Kbuild.install
++++ b/scripts/Kbuild.install
+@@ -95,7 +95,9 @@ header:
  	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
  	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
  	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
@@ -18,5 +25,5 @@
 +		ln -sf $${x} $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/ || exit; \
 +	done
  	$(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
- 	$(Q)chmod -R a+rX $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
+ 	$(Q)chmod -R a+rX,go-w $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
  	$(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/staging.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/staging.patch
index c01c712..5c7a662 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/staging.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/staging.patch
@@ -1,3 +1,8 @@
+From 1892079b827cf8f8316305b6d6e0985db82441a2 Mon Sep 17 00:00:00 2001
+From: Thomas Kunze <thommycheck@gmx.de>
+Date: Sat, 6 Aug 2011 05:30:14 +0000
+Subject: [PATCH] klibc: initial commit of version 1.5.24
+
 Patch was imported from the OpenEmbedded git server
 (git://git.openembedded.org/openembedded)
 as of commit id eefb99a313bbcc8f34c8b32bf0c5aa2dd2580735
@@ -6,11 +11,25 @@
 Minor edits following upstream changes
 Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
 
-Index: klibc-1.5.24/scripts/Kbuild.install
-===================================================================
---- a/scripts/Kbuild.install	2011-07-27 15:50:53.000000000 +0200
-+++ b/scripts/Kbuild.install	2011-08-01 00:03:03.000000000 +0200
-@@ -88,13 +88,10 @@
+---
+ scripts/Kbuild.install    | 4 ----
+ usr/dash/Kbuild           | 2 --
+ usr/gzip/Kbuild           | 2 --
+ usr/kinit/Kbuild          | 2 --
+ usr/kinit/fstype/Kbuild   | 2 --
+ usr/kinit/ipconfig/Kbuild | 2 --
+ usr/kinit/nfsmount/Kbuild | 2 --
+ usr/kinit/resume/Kbuild   | 2 --
+ usr/kinit/run-init/Kbuild | 2 --
+ usr/klibc/Kbuild          | 2 --
+ usr/utils/Kbuild          | 2 --
+ 11 files changed, 24 deletions(-)
+
+diff --git a/scripts/Kbuild.install b/scripts/Kbuild.install
+index d32a8a5..fda699d 100644
+--- a/scripts/Kbuild.install
++++ b/scripts/Kbuild.install
+@@ -88,19 +88,15 @@ else
  header:
  	$(Q)echo "  INSTALL headers + man pages to $(INSTALLROOT)$(INSTALLDIR)"
  	$(Q)mkdir -p $(INSTALLROOT)$(bindir)
@@ -24,119 +43,107 @@
  	$(Q)for x in ../../../include/asm ../../../include/asm-generic ../../../include/linux ../../../include/mtd; do \
  		ln -sf $${x} $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/ || exit; \
  	done
-@@ -103,7 +100,6 @@
- 	done
  	$(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
  	$(Q)chmod -R a+rX,go-w $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
 -	$(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
  	$(Q)$(install-bin) $(objtree)/klcc/$(KCROSS)klcc $(INSTALLROOT)$(bindir)
  
  footer: header
-
-Index: klibc-1.5.24/usr/dash/Kbuild
-===================================================================
---- a/usr/dash/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/dash/Kbuild	2011-08-01 00:07:56.000000000 +0200
-@@ -92,5 +92,3 @@
+diff --git a/usr/dash/Kbuild b/usr/dash/Kbuild
+index 3a98c1f..1a6920a 100644
+--- a/usr/dash/Kbuild
++++ b/usr/dash/Kbuild
+@@ -92,5 +92,3 @@ $(obj)/syntax.c: $(obj)/mksyntax
  $(obj)/syntax.h: $(obj)/syntax.c
  	$(Q):
  
 -# Targets to install
 -install-y := sh.shared
-
-Index: klibc-1.5.24/usr/gzip/Kbuild
-===================================================================
---- a/usr/gzip/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/gzip/Kbuild	2011-08-01 00:06:39.000000000 +0200
-@@ -21,5 +21,3 @@
+diff --git a/usr/gzip/Kbuild b/usr/gzip/Kbuild
+index 9bbf0a4..c497d02 100644
+--- a/usr/gzip/Kbuild
++++ b/usr/gzip/Kbuild
+@@ -21,5 +21,3 @@ $(obj)/gunzip $(obj)/zcat: $(obj)/gzip
  # Cleaning
  targets := gzip gzip.g gunzip zcat
  
 -# Targets to install
 -install-y := gzip gunzip zcat
-
-Index: klibc-1.5.24/usr/kinit/fstype/Kbuild
-===================================================================
---- a/usr/kinit/fstype/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/kinit/fstype/Kbuild	2011-08-01 00:09:12.000000000 +0200
-@@ -21,5 +21,3 @@
- # Cleaning
- clean-dirs := static shared
- 
--# install binary
--install-y := $(shared-y)
-
-Index: klibc-1.5.24/usr/kinit/ipconfig/Kbuild
-===================================================================
---- a/usr/kinit/ipconfig/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/kinit/ipconfig/Kbuild	2011-08-01 00:10:52.000000000 +0200
-@@ -27,5 +27,3 @@
- # Cleaning
- clean-dirs := static shared
- 
--# install binary
--install-y := $(shared-y)
-
-Index: klibc-1.5.24/usr/kinit/Kbuild
-===================================================================
---- a/usr/kinit/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/kinit/Kbuild	2011-08-01 00:20:18.000000000 +0200
-@@ -33,5 +33,3 @@
+diff --git a/usr/kinit/Kbuild b/usr/kinit/Kbuild
+index 5320127..f7fdccd 100644
+--- a/usr/kinit/Kbuild
++++ b/usr/kinit/Kbuild
+@@ -33,5 +33,3 @@ targets += kinit kinit.g kinit.shared kinit.shared.g
  subdir- := fstype ipconfig nfsmount resume run-init
  
  
 -# install binary
 -install-y := kinit kinit.shared
-
-Index: klibc-1.5.24/usr/kinit/nfsmount/Kbuild
-===================================================================
---- a/usr/kinit/nfsmount/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/kinit/nfsmount/Kbuild	2011-08-01 00:12:52.000000000 +0200
-@@ -23,5 +23,3 @@
+diff --git a/usr/kinit/fstype/Kbuild b/usr/kinit/fstype/Kbuild
+index 9b20db1..367611d 100644
+--- a/usr/kinit/fstype/Kbuild
++++ b/usr/kinit/fstype/Kbuild
+@@ -21,5 +21,3 @@ shared/fstype-y := $(objs)
+ # Cleaning
+ clean-dirs := static shared
+ 
+-# install binary
+-install-y := $(shared-y)
+diff --git a/usr/kinit/ipconfig/Kbuild b/usr/kinit/ipconfig/Kbuild
+index 7f8d181..eb1d472 100644
+--- a/usr/kinit/ipconfig/Kbuild
++++ b/usr/kinit/ipconfig/Kbuild
+@@ -27,5 +27,3 @@ shared/ipconfig-y := $(objs)
+ # Cleaning
+ clean-dirs := static shared
+ 
+-# install binary
+-install-y := $(shared-y)
+diff --git a/usr/kinit/nfsmount/Kbuild b/usr/kinit/nfsmount/Kbuild
+index 461e6f3..ba31708 100644
+--- a/usr/kinit/nfsmount/Kbuild
++++ b/usr/kinit/nfsmount/Kbuild
+@@ -23,5 +23,3 @@ dummypmap-y := dummypmap_test.o
  
  clean-dirs := static shared
  
 -# Install binary
 -install-y := $(shared-y)
-
-Index: klibc-1.5.24/usr/kinit/resume/Kbuild
-===================================================================
---- a/usr/kinit/resume/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/kinit/resume/Kbuild	2011-08-01 00:13:51.000000000 +0200
-@@ -26,5 +26,3 @@
+diff --git a/usr/kinit/resume/Kbuild b/usr/kinit/resume/Kbuild
+index 034195d..c1342e1 100644
+--- a/usr/kinit/resume/Kbuild
++++ b/usr/kinit/resume/Kbuild
+@@ -26,5 +26,3 @@ shared/resume-lib := ../lib.a
  # Cleaning
  clean-dirs := static shared
  
 -# install binary
 -install-y := $(shared-y)
-
-Index: klibc-1.5.24/usr/kinit/run-init/Kbuild
-===================================================================
---- a/usr/kinit/run-init/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/kinit/run-init/Kbuild	2011-08-01 00:14:41.000000000 +0200
-@@ -25,5 +25,3 @@
+diff --git a/usr/kinit/run-init/Kbuild b/usr/kinit/run-init/Kbuild
+index f7832b7..c153b0a 100644
+--- a/usr/kinit/run-init/Kbuild
++++ b/usr/kinit/run-init/Kbuild
+@@ -30,5 +30,3 @@ shared/run-init-lib := ../lib.a
  # Cleaning
  clean-dirs := static shared
  
 -# install binary
 -install-y := $(shared-y)
-
-Index: klibc-1.5.24/usr/klibc/Kbuild
-===================================================================
---- a/usr/klibc/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/klibc/Kbuild	2011-08-01 00:18:11.000000000 +0200
-@@ -177,5 +177,3 @@
+diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
+index eba6add..98caf2e 100644
+--- a/usr/klibc/Kbuild
++++ b/usr/klibc/Kbuild
+@@ -185,5 +185,3 @@ install-rule:
  	          $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib))
  	$(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \
  	                      $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib
 -	$(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \
 -	                      $(INSTALLROOT)$(SHLIBDIR)
-
-Index: klibc-1.5.24/usr/utils/Kbuild
-===================================================================
---- a/usr/utils/Kbuild	2011-07-27 15:50:53.000000000 +0200
-+++ b/usr/utils/Kbuild	2011-08-01 00:19:13.000000000 +0200
-@@ -72,5 +72,3 @@
+diff --git a/usr/utils/Kbuild b/usr/utils/Kbuild
+index 05aa794..67d9486 100644
+--- a/usr/utils/Kbuild
++++ b/usr/utils/Kbuild
+@@ -72,5 +72,3 @@ $(obj)/shared/reboot $(obj)/shared/poweroff: $(obj)/shared/halt
  # Clean deletes the static and shared dir
  clean-dirs := static shared
  
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils.inc b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils.inc
index 9014f52..7df33d6 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils.inc
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils.inc
@@ -48,7 +48,7 @@
     ln -s gzip ${D}${base_bindir}/zcat
 }
 
-EXTRA_KLIBC_DEPS = "${@base_conditional('KLIBC_UTILS_VARIANT', 'shared', '${THIS_LIBKLIBC}', '', d)}"
+EXTRA_KLIBC_DEPS = "${@oe.utils.conditional('KLIBC_UTILS_VARIANT', 'shared', '${THIS_LIBKLIBC}', '', d)}"
 
 PACKAGES_DYNAMIC += "^${KLIBC_UTILS_PKGNAME}-.*"
 
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch
similarity index 86%
rename from import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch
rename to import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch
index 6e1b9ff..6ac2cca 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch
@@ -1,7 +1,7 @@
-From c4e6bd9378645d577e9d9f85da85f1438afe7c50 Mon Sep 17 00:00:00 2001
+From 1c989e4c36d0bf76ab444f984bc73b98eeacd03f 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
+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.
@@ -22,13 +22,13 @@
 
 Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
 ---
- Makefile | 24 ++----------------------
- 1 file changed, 2 insertions(+), 22 deletions(-)
+ Makefile | 26 ++------------------------
+ 1 file changed, 2 insertions(+), 24 deletions(-)
 
-Index: git/Makefile
-===================================================================
---- git.orig/Makefile
-+++ git/Makefile
+diff --git a/Makefile b/Makefile
+index 3ce8587..8b79f71 100644
+--- a/Makefile
++++ b/Makefile
 @@ -16,28 +16,11 @@ endif
  
  TESTS = tests
@@ -82,3 +82,6 @@
  #
  # Common libmtd
  #
+-- 
+2.7.4
+
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch
similarity index 71%
rename from import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch
rename to import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch
index f46824b..c23d11f 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch
@@ -1,11 +1,11 @@
-From f3609c7c0450b4c31e1d4603fcf2cfb1ba46f994 Mon Sep 17 00:00:00 2001
+From 89c76bbe82a2029a25b0654eb0a1d0b22d6e6877 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
+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: Pending
+Upstream-Status: Submitted
 
 Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
 ---
@@ -13,7 +13,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/common.mk b/common.mk
-index ba87377..59c56df 100644
+index ba87377..126d11a 100644
 --- a/common.mk
 +++ b/common.mk
 @@ -1,4 +1,4 @@
@@ -23,5 +23,5 @@
  RANLIB := $(CROSS)ranlib
  
 -- 
-1.9.1
+2.7.4
 
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch
similarity index 91%
rename from import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch
rename to import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch
index 962b368..9ad4a5b 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch
@@ -1,7 +1,7 @@
-From 72a39bb3290a79e76b0dbf59eef83ea2d9b577a1 Mon Sep 17 00:00:00 2001
+From fecbb7056d621a30f7106e67f5fe209763571b70 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
+Subject: [PATCH 3/9] 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.
@@ -36,7 +36,7 @@
 |  __extern int ioctl(int, int, void *);
 |               ^
 
-Upstream-Status: Inappropriate [klibc specific]
+Upstream-Status: Accepted
 
 Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
 ---
@@ -44,7 +44,7 @@
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/ubi-utils/libubi.c b/ubi-utils/libubi.c
-index 1e08b7d..491e525 100644
+index 97c0434..2b49833 100644
 --- a/ubi-utils/libubi.c
 +++ b/ubi-utils/libubi.c
 @@ -687,7 +687,7 @@ void libubi_close(libubi_t desc)
@@ -72,5 +72,5 @@
  
  int ubi_update_start(libubi_t desc, int fd, long long bytes)
 -- 
-1.9.1
+2.7.4
 
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch
similarity index 85%
rename from import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch
rename to import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch
index fee1cbc..2f31fb4 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch
@@ -1,7 +1,11 @@
-From e56767b9caa02e7c41803499c77dc939d5a7f64a Mon Sep 17 00:00:00 2001
+From b668cb75cb7e72ff92055209130d4cd4b3cacbdb 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
+Subject: [PATCH 4/9] Restore compatibility to dietlibc, klibc, musl libc after
+ commit 4f1b108
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
 
 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
@@ -21,7 +25,7 @@
 |                       ^
 | compilation terminated.
 
-Upstream-Status: Pending
+Upstream-Status: Submitted
 
 Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
 Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
@@ -30,7 +34,7 @@
  1 file changed, 24 insertions(+)
 
 diff --git a/include/common.h b/include/common.h
-index 6895e5c..77f3f7d 100644
+index fb0ca83..5a20964 100644
 --- a/include/common.h
 +++ b/include/common.h
 @@ -26,7 +26,9 @@
@@ -43,7 +47,7 @@
  #include <inttypes.h>
  #include "version.h"
  
-@@ -52,6 +54,21 @@ extern "C" {
+@@ -67,6 +69,21 @@ extern "C" {
  #endif
  
  /* define a print format specifier for off_t */
@@ -65,7 +69,7 @@
  #ifdef __USE_FILE_OFFSET64
  #define PRIxoff_t PRIx64
  #define PRIdoff_t PRId64
-@@ -59,6 +76,13 @@ extern "C" {
+@@ -74,6 +91,13 @@ extern "C" {
  #define PRIxoff_t "l"PRIx32
  #define PRIdoff_t "l"PRId32
  #endif
@@ -80,5 +84,5 @@
  /* Verbose messages */
  #define bareverbose(verbose, fmt, ...) do {                        \
 -- 
-1.9.1
+2.7.4
 
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch
similarity index 70%
rename from import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch
rename to import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch
index 6b09c14..8309a72 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch
@@ -1,7 +1,7 @@
-From 8318852ef4f768bed31072aa7b57e11adc1f639c Mon Sep 17 00:00:00 2001
+From 5d4a66b502003ef385dab31a17012246407e7364 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
+Subject: [PATCH 5/9] common.h: more workarounds for klibc compatibility
 
 Patch is addressing two issues:
 * First,  Klibc doesn't have rpmatch().
@@ -15,18 +15,18 @@
 | .../git/./include/common.h:157: undefined reference to `getline'
 | .../git/./include/common.h:164: undefined reference to `rpmatch'
 
-Upstream-Status: Pending
+Upstream-Status: Submitted
 
 Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
 ---
- include/common.h | 10 ++++++----
- 1 file changed, 6 insertions(+), 4 deletions(-)
+ include/common.h | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
 
-Index: git/include/common.h
-===================================================================
---- git.orig/include/common.h
-+++ git/include/common.h
-@@ -161,15 +161,17 @@ static inline int __rpmatch(const char *
+diff --git a/include/common.h b/include/common.h
+index 5a20964..2f51e1c 100644
+--- a/include/common.h
++++ b/include/common.h
+@@ -161,15 +161,17 @@ static inline int __rpmatch(const char *resp)
   */
  static inline bool prompt(const char *msg, bool def)
  {
@@ -47,3 +47,6 @@
  			printf("failed to read prompt; assuming '%s'\n",
  				def ? "yes" : "no");
  			break;
+-- 
+2.7.4
+
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch
similarity index 94%
rename from import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch
rename to import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch
index 043a89d..d046f95 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch
@@ -1,7 +1,7 @@
-From 72a04a9b9ed33c889d2e2b86f306c5be9f6cde35 Mon Sep 17 00:00:00 2001
+From 2af30e9b2988111e45ed6ea6af55e49ec7cb1cb1 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
+Subject: [PATCH 6/9] libiniparser: remove unused function needing float
 
 Fixes:
 |   LD      ubi-utils/ubiformat
@@ -13,7 +13,7 @@
 Grep doesn't reveal any occurrence of iniparser_getdouble(), using atof() so
 remove it: floating-point is not supported in klibc
 
-Upstream-Status: Pending
+Upstream-Status: Accepted
 
 Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
 ---
@@ -81,5 +81,5 @@
    @param    d Dictionary to search
    @param    key Key string to look for
 -- 
-1.9.1
+2.7.4
 
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch
new file mode 100644
index 0000000..36b012f
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch
@@ -0,0 +1,64 @@
+From 41e7c76b0853bf5241b38b8167dfd57c27fef1eb Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Sun, 28 Jan 2018 21:47:59 +0100
+Subject: [PATCH 7/9] mtd-utils: common.c: convert to integer arithmetic
+
+We use floating point just to print out KiB, MiB, GiB.
+Avoid that to be klibc friendly.
+
+Fixes compilation for aarch64 against klibc:
+
+error: '-mgeneral-regs-only' is incompatible with floating-point argument
+|    printf("%s%.1f GiB", p, (double)bytes / (1024 * 1024 * 1024));
+etc.
+
+Note:
+* In the KiB case, we could apparently multiply by 100 before dividing
+  without risking overflow. This code simply avoids multiplications.
+
+Upstream-Status: Submitted
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ ubi-utils/ubiutils-common.c | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/ubi-utils/ubiutils-common.c b/ubi-utils/ubiutils-common.c
+index 6609a6b..0ded2a4 100644
+--- a/ubi-utils/ubiutils-common.c
++++ b/ubi-utils/ubiutils-common.c
+@@ -107,6 +107,9 @@ long long ubiutils_get_bytes(const char *str)
+ void ubiutils_print_bytes(long long bytes, int bracket)
+ {
+ 	const char *p;
++	int GiB = 1024 * 1024 * 1024;
++	int MiB = 1024 * 1024;
++	int KiB = 1024;
+ 
+ 	if (bracket)
+ 		p = " (";
+@@ -115,12 +118,15 @@ void ubiutils_print_bytes(long long bytes, int bracket)
+ 
+ 	printf("%lld bytes", bytes);
+ 
+-	if (bytes > 1024 * 1024 * 1024)
+-		printf("%s%.1f GiB", p, (double)bytes / (1024 * 1024 * 1024));
+-	else if (bytes > 1024 * 1024)
+-		printf("%s%.1f MiB", p, (double)bytes / (1024 * 1024));
+-	else if (bytes > 1024 && bytes != 0)
+-		printf("%s%.1f KiB", p, (double)bytes / 1024);
++	if (bytes > GiB)
++		printf("%s%lld.%lld GiB", p,
++		       bytes / GiB, bytes % GiB / (GiB / 10));
++	else if (bytes > MiB)
++		printf("%s%lld.%lld MiB", p,
++		       bytes / MiB, bytes % MiB / (MiB / 10));
++	else if (bytes > KiB && bytes != 0)
++		printf("%s%lld.%lld KiB", p,
++		       bytes / KiB, bytes % KiB / (KiB / 10));
+ 	else
+ 		return;
+ 
+-- 
+2.7.4
+
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch
new file mode 100644
index 0000000..5bd0574
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch
@@ -0,0 +1,44 @@
+From e6f1a85c0a3df24fe3ca9a520dc697105e75a80c Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Sat, 27 Jan 2018 09:39:26 +0100
+Subject: [PATCH 8/9] ubi-utils: ubiformat.c: convert to integer arithmetic
+
+Do not cast percent to double, it is just used as upper limit.
+Avoid floating point to fix compilation for aarch64 against klibc:
+
+error: '-mgeneral-regs-only' is incompatible with floating-point code
+|    int percent = ((double)si->ok_cnt)/si->good_cnt * 100;
+|        ^~~~~~~
+
+Notes:
+* The checks in the code above this line ensure that si->good_cnt is not 0.
+
+* The code assumes  si->good_cnt * 100  will not overflow, then we can use
+  (si->ok_cnt * 100) safely because the former is bigger.
+
+* The truncated result does not affect the logic:
+  i.e. a value of 49.9 is truncated to 49 and is still <50.
+
+Upstream-Status: Submitted
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ ubi-utils/ubiformat.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c
+index 21409ca..d93164a 100644
+--- a/ubi-utils/ubiformat.c
++++ b/ubi-utils/ubiformat.c
+@@ -843,7 +843,7 @@ int main(int argc, char * const argv[])
+ 	}
+ 
+ 	if (!args.override_ec && si->empty_cnt < si->good_cnt) {
+-		int percent = ((double)si->ok_cnt)/si->good_cnt * 100;
++		int percent = (si->ok_cnt * 100) / si->good_cnt;
+ 
+ 		/*
+ 		 * Make sure the majority of eraseblocks have valid
+-- 
+2.7.4
+
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch
new file mode 100644
index 0000000..658246a
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch
@@ -0,0 +1,48 @@
+From 2229f3b9fd4bad47794c28e558ad273173cea73d Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Sat, 27 Jan 2018 09:52:46 +0100
+Subject: [PATCH 9/9] Eliminate warnings about implicit non-const casting in
+ libmtd
+
+The mtd_get_dev_info1 function reads (among other things) name and type
+string into coresponding struct mtd_dev_info fields.
+
+The struct mtd_dev_info has the string fields marked const, requiring
+them to be cast to non-const version during initialization.
+
+This cast was previously omitted from the dev_read_data calls,
+triggering warnings during compilation.
+
+Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+
+Upstream-Status: Backport
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ lib/libmtd.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/libmtd.c b/lib/libmtd.c
+index 60b4782..5f0bcbc 100644
+--- a/lib/libmtd.c
++++ b/lib/libmtd.c
+@@ -746,13 +746,13 @@ int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd)
+ 	if (dev_get_major(lib, mtd_num, &mtd->major, &mtd->minor))
+ 		return -1;
+ 
+-	ret = dev_read_data(lib->mtd_name, mtd_num, &mtd->name,
++	ret = dev_read_data(lib->mtd_name, mtd_num, (char *)&mtd->name,
+ 			    MTD_NAME_MAX + 1);
+ 	if (ret < 0)
+ 		return -1;
+ 	((char *)mtd->name)[ret - 1] = '\0';
+ 
+-	ret = dev_read_data(lib->mtd_type, mtd_num, &mtd->type_str,
++	ret = dev_read_data(lib->mtd_type, mtd_num, (char *)&mtd->type_str,
+ 			    MTD_TYPE_MAX + 1);
+ 	if (ret < 0)
+ 		return -1;
+-- 
+2.7.4
+
diff --git a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb
index 518c02f..abb0d4b 100644
--- a/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb
+++ b/import-layers/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb
@@ -11,12 +11,15 @@
 
 SRCREV = "aea36417067dade75192bafa03af70b6eb2677b1"
 SRC_URI = "git://git.infradead.org/mtd-utils.git \
-             file://0001-Makefile-only-build-ubi-utils.patch \
+             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.patch \
-             file://0004-common.h-klibc-fixes-1.patch \
-             file://0005-common.h-klibc-fixes-2.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 \
              "
 
 S = "${WORKDIR}/git/"