aboutsummaryrefslogtreecommitdiffstats
path: root/meta-initramfs
diff options
context:
space:
mode:
Diffstat (limited to 'meta-initramfs')
-rw-r--r--meta-initramfs/recipes-bsp/kexecboot/files/0001-kexecboot-fix-build-when-S-B.patch61
-rw-r--r--meta-initramfs/recipes-bsp/kexecboot/files/0002-kexecboot-fix-configure-warnings.patch33
-rw-r--r--meta-initramfs/recipes-bsp/kexecboot/files/0003-kexecboot-do-not-hardcode-MOUNTPOINT.patch97
-rw-r--r--meta-initramfs/recipes-bsp/kexecboot/files/0004-kexecboot.c-workaround-for-absolute-kernel-and-initr.patch135
-rw-r--r--meta-initramfs/recipes-bsp/kexecboot/kexecboot_0.6.bb9
-rw-r--r--meta-initramfs/recipes-devtools/dracut/dracut_git.bb25
-rw-r--r--meta-initramfs/recipes-devtools/klibc/klibc.inc1
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch87
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch27
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch76
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch84
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch61
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch85
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch53
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/common.mk.patch8
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libiniparser.c.patch19
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libubi.c.patch28
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/ubiformat.c.patch20
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb (renamed from meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.0.bb)35
-rw-r--r--meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/fix-out-of-tree-build.patch54
-rw-r--r--meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb1
-rw-r--r--meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.17.bb26
-rw-r--r--meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.19.bb (renamed from meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.10.bb)2
23 files changed, 848 insertions, 179 deletions
diff --git a/meta-initramfs/recipes-bsp/kexecboot/files/0001-kexecboot-fix-build-when-S-B.patch b/meta-initramfs/recipes-bsp/kexecboot/files/0001-kexecboot-fix-build-when-S-B.patch
new file mode 100644
index 0000000000..6d3270f891
--- /dev/null
+++ b/meta-initramfs/recipes-bsp/kexecboot/files/0001-kexecboot-fix-build-when-S-B.patch
@@ -0,0 +1,61 @@
+From 8519d61a7097498b0ee93fb8dc8262286825f3e5 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Thu, 1 May 2014 23:58:51 +0200
+Subject: [PATCH 1/4] kexecboot: fix build when S != B
+
+* fatal error: ../config.h: No such file or directory
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ machine/zaurus.c | 2 +-
+ res/theme-gui.h | 2 +-
+ res/theme-tui.h | 4 ++--
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/machine/zaurus.c b/machine/zaurus.c
+index ea21047..83be13b 100644
+--- a/machine/zaurus.c
++++ b/machine/zaurus.c
+@@ -25,7 +25,7 @@
+ *
+ */
+
+-#include "../config.h"
++#include "config.h"
+
+ #ifdef USE_ZAURUS
+
+diff --git a/res/theme-gui.h b/res/theme-gui.h
+index f8fef7f..79bed39 100644
+--- a/res/theme-gui.h
++++ b/res/theme-gui.h
+@@ -15,7 +15,7 @@
+ *
+ */
+
+-#include "../config.h"
++#include "config.h"
+
+ #ifdef USE_ICONS
+ /** Icons **/
+diff --git a/res/theme-tui.h b/res/theme-tui.h
+index 94e7693..909be56 100644
+--- a/res/theme-tui.h
++++ b/res/theme-tui.h
+@@ -15,11 +15,11 @@
+ *
+ */
+
+-#include "../config.h"
++#include "config.h"
+
+ #ifdef USE_TEXTUI
+ /** TEXT UI colors **/
+-#include "../termseq.h"
++#include "termseq.h"
+
+ /* Background color pair */
+ #define TUI_CLR_BG TERM_CSI TERM_BG_BLACK ";" TERM_FG_WHITE TERM_SGR
+--
+1.9.1
+
diff --git a/meta-initramfs/recipes-bsp/kexecboot/files/0002-kexecboot-fix-configure-warnings.patch b/meta-initramfs/recipes-bsp/kexecboot/files/0002-kexecboot-fix-configure-warnings.patch
new file mode 100644
index 0000000000..ecf422b72d
--- /dev/null
+++ b/meta-initramfs/recipes-bsp/kexecboot/files/0002-kexecboot-fix-configure-warnings.patch
@@ -0,0 +1,33 @@
+From b8938acc3f1ab35273fa9a2fa7728050ef72ff65 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Fri, 2 May 2014 00:19:24 +0200
+Subject: [PATCH 2/4] kexecboot: fix configure warnings
+
+Makefile.am:5: warning: source file 'fstype/fstype.c' is in a subdirectory,
+Makefile.am:5: but option 'subdir-objects' is disabled
+automake: warning: possible forward-incompatibility.
+...
+Makefile.am:5: warning: source file 'machine/zaurus.c' is in a subdirectory,
+...
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0ca4b81..66ec54e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,7 +1,7 @@
+ AC_PREREQ(2.53)
+ AC_INIT([kexecboot], [0.6], [kexecboot-devel@linuxtogo.org])
+ AC_CANONICAL_HOST
+-AM_INIT_AUTOMAKE([-Wall foreign])
++AM_INIT_AUTOMAKE([-Wall foreign] [subdir-objects])
+ AC_CONFIG_SRCDIR(kexecboot.c)
+ AC_CONFIG_HEADERS(config.h)
+ AM_MAINTAINER_MODE
+--
+1.9.1
+
diff --git a/meta-initramfs/recipes-bsp/kexecboot/files/0003-kexecboot-do-not-hardcode-MOUNTPOINT.patch b/meta-initramfs/recipes-bsp/kexecboot/files/0003-kexecboot-do-not-hardcode-MOUNTPOINT.patch
new file mode 100644
index 0000000000..4caa0d5f02
--- /dev/null
+++ b/meta-initramfs/recipes-bsp/kexecboot/files/0003-kexecboot-do-not-hardcode-MOUNTPOINT.patch
@@ -0,0 +1,97 @@
+From 800dae0d34f8629a34c638a612166b76dda03e27 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Sat, 2 Aug 2014 01:13:08 +0200
+Subject: [PATCH 3/4] kexecboot: do not hardcode MOUNTPOINT
+
+Avoid to hardcode it: could be requested as a new configure option.
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ cfgparser.c | 6 +++---
+ kexecboot.c | 18 ++++++++++--------
+ 2 files changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/cfgparser.c b/cfgparser.c
+index 8f6688c..dec27b1 100644
+--- a/cfgparser.c
++++ b/cfgparser.c
+@@ -141,7 +141,7 @@ static int set_kernel(struct cfgdata_t *cfgdata, char *value)
+ return -1;
+ }
+
+- strcpy(sc->kernelpath, "/mnt");
++ strcpy(sc->kernelpath, MOUNTPOINT);
+ strcat(sc->kernelpath, value);
+ return 0;
+ }
+@@ -155,7 +155,7 @@ static int set_icon(struct cfgdata_t *cfgdata, char *value)
+
+ dispose(sc->iconpath);
+ /* Add our mountpoint, since the enduser won't know it */
+- sc->iconpath = malloc(sizeof(MOUNTPOINT)+strlen(value));
++ sc->iconpath = malloc(strlen(MOUNTPOINT)+strlen(value)+1);
+ if (NULL == sc->iconpath) {
+ DPRINTF("Can't allocate memory to store iconpath '%s'", value);
+ return -1;
+@@ -194,7 +194,7 @@ static int set_initrd(struct cfgdata_t *cfgdata, char *value)
+ return -1;
+ }
+
+- strcpy(sc->initrd, "/mnt");
++ strcpy(sc->initrd, MOUNTPOINT);
+ strcat(sc->initrd, value);
+ return 0;
+ }
+diff --git a/kexecboot.c b/kexecboot.c
+index d6657a0..7268d6b 100644
+--- a/kexecboot.c
++++ b/kexecboot.c
+@@ -57,20 +57,22 @@
+ #endif
+
+ #ifdef USE_MACHINE_KERNEL
+-/* Machine-dependent kernel patch */
++/* Machine-dependent kernel path */
+ char *machine_kernel = NULL;
+ #endif
+
++#define PREPEND_MOUNTPATH(string) MOUNTPOINT""string
++
+ /* NULL-terminated array of kernel search paths
+ * First item should be filled with machine-dependent path */
+ char *default_kernels[] = {
+ #ifdef USE_ZIMAGE
+- "/mnt/boot/zImage",
+- "/mnt/zImage",
++ PREPEND_MOUNTPATH("/boot/zImage"),
++ PREPEND_MOUNTPATH("/zImage"),
+ #endif
+ #ifdef USE_UIMAGE
+- "/mnt/boot/uImage",
+- "/mnt/uImage",
++ PREPEND_MOUNTPATH("/boot/uImage"),
++ PREPEND_MOUNTPATH("/uImage"),
+ #endif
+ NULL
+ };
+@@ -149,14 +151,14 @@ char *get_machine_kernelpath() {
+ ++tmp;
+ }
+
+- /* Prepend "/mnt/boot/zImage-" to hw */
+- tmp = malloc(strlen(hw) + 17 + 1); /* strlen("/mnt/boot/zImage-") */
++ /* Prepend MOUNTPOINT"/boot/zImage-" to hw */
++ tmp = malloc(strlen(PREPEND_MOUNTPATH("/boot/zImage-")) + strlen(hw) + 1);
+ if (NULL == tmp) {
+ DPRINTF("Can't allocate memory for machine-specific kernel path");
+ return NULL;
+ }
+
+- strcpy(tmp, "/mnt/boot/zImage-");
++ strcpy(tmp, PREPEND_MOUNTPATH("/boot/zImage-"));
+ strcat(tmp, hw);
+
+ return tmp;
+--
+1.9.1
+
diff --git a/meta-initramfs/recipes-bsp/kexecboot/files/0004-kexecboot.c-workaround-for-absolute-kernel-and-initr.patch b/meta-initramfs/recipes-bsp/kexecboot/files/0004-kexecboot.c-workaround-for-absolute-kernel-and-initr.patch
new file mode 100644
index 0000000000..6d81d83578
--- /dev/null
+++ b/meta-initramfs/recipes-bsp/kexecboot/files/0004-kexecboot.c-workaround-for-absolute-kernel-and-initr.patch
@@ -0,0 +1,135 @@
+From de9a6284df8add6ec03e1d9981d0b6d0595bbc69 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Mon, 10 Nov 2014 23:37:23 +0100
+Subject: [PATCH 4/4] kexecboot.c: workaround for absolute kernel and initrd
+ symlinks
+
+Add MOUNTPOINT prefix if the kernel/initrd symlinks start with '/'.
+Do nothing if the path is a relative symbolic link or not a symlink.
+
+Fix following situation:
+
+root@mizar:/var/tmp# ls -al boot/
+total 2076
+drwxr-xr-x 2 root root 4096 lug 5 01:38 .
+drwxrwxrwt 4 root root 4096 lug 5 12:26 ..
+-rw-r--r-- 1 root root 831 lug 5 01:24 boot.cfg
+-rw-r--r-- 1 root root 1322 lug 5 01:24 icon.xpm
+lrwxrwxrwx 1 root root 34 lug 5 12:26 zImage ->
+/boot/zImage-3.14.5-yocto-standard
+-rw-r--r-- 1 root root 2106832 lug 5 01:20 zImage-3.14.5-yocto-standard
+
+Cannot open `/mnt/boot/zImage': No such file or directory
+Nothing has been loaded!
+
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ kexecboot.c | 53 ++++++++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 44 insertions(+), 9 deletions(-)
+
+diff --git a/kexecboot.c b/kexecboot.c
+index 7268d6b..8a7a7d2 100644
+--- a/kexecboot.c
++++ b/kexecboot.c
+@@ -208,11 +208,16 @@ void start_kernel(struct params_t *params, int choice)
+ const char *load_argv[] = { NULL, "-l", NULL, NULL, NULL, NULL };
+ const char *exec_argv[] = { NULL, "-e", NULL, NULL};
+
+- char *cmdline_arg = NULL, *initrd_arg = NULL;
++ char *cmdline_arg = NULL, *initrd_arg = NULL, *kernel_arg = NULL;
+ int n, idx, u;
+ struct stat sinfo;
+ struct boot_item_t *item;
+
++ /* buffer for readlink (could be truncated) */
++ char buf[512];
++ int len;
++
++
+ item = params->bootcfg->list[choice];
+
+ exec_argv[0] = kexec_path;
+@@ -306,10 +311,17 @@ void start_kernel(struct params_t *params, int choice)
+ }
+ }
+
++ /* Mount boot device */
++ if ( -1 == mount(mount_dev, mount_point, mount_fstype,
++ MS_RDONLY, NULL) ) {
++ perror("Can't mount boot device");
++ exit(-1);
++ }
++
+ /* fill '--initrd' option */
+ if (item->initrd) {
+ /* allocate space */
+- n = sizeof(str_initrd_start) + strlen(item->initrd);
++ n = sizeof(str_initrd_start) + strlen(item->initrd) + 1 + sizeof(mount_point) + sizeof(buf);
+
+ initrd_arg = (char *)malloc(n);
+ if (NULL == initrd_arg) {
+@@ -317,24 +329,46 @@ void start_kernel(struct params_t *params, int choice)
+ } else {
+ strcpy(initrd_arg, str_initrd_start); /* --initrd= */
+ strcat(initrd_arg, item->initrd);
++
++ if ((len = readlink(item->initrd, buf, sizeof(buf)-1)) != -1) {
++ buf[len] = '\0';
++ /* Fix absolute symlinks: prepend MOUNTPOINT */
++ if (buf[0] == '/') {
++ strcpy(initrd_arg, str_initrd_start); /* --initrd= */
++ strcat(initrd_arg, mount_point);
++ strcat(initrd_arg, buf);
++ }
++ }
+ load_argv[idx] = initrd_arg;
+ ++idx;
+ }
+ }
+
+ /* Append kernelpath as last arg of kexec */
+- load_argv[idx] = item->kernelpath;
++ /* allocate space */
++ n = strlen(item->kernelpath) + 1 + sizeof(mount_point) + sizeof(buf);
++
++ kernel_arg = (char *)malloc(n);
++ if (NULL == kernel_arg) {
++ perror("Can't allocate memory for kernel_arg");
++ } else {
++ strcpy(kernel_arg, item->kernelpath);
++
++ if ((len = readlink(item->kernelpath, buf, sizeof(buf)-1)) != -1) {
++ buf[len] = '\0';
++ /* Fix absolute symlinks: prepend MOUNTPOINT */
++ if (buf[0] == '/') {
++ strcpy(kernel_arg, mount_point);
++ strcat(kernel_arg, buf);
++ }
++ }
++ load_argv[idx] = kernel_arg;
++ }
+
+ DPRINTF("load_argv: %s, %s, %s, %s, %s", load_argv[0],
+ load_argv[1], load_argv[2],
+ load_argv[3], load_argv[4]);
+
+- /* Mount boot device */
+- if ( -1 == mount(mount_dev, mount_point, mount_fstype,
+- MS_RDONLY, NULL) ) {
+- perror("Can't mount boot device");
+- exit(-1);
+- }
+
+ /* Load kernel */
+ n = fexecw(kexec_path, (char *const *)load_argv, envp);
+@@ -347,6 +381,7 @@ void start_kernel(struct params_t *params, int choice)
+
+ dispose(cmdline_arg);
+ dispose(initrd_arg);
++ dispose(kernel_arg);
+
+ /* Check /proc/sys/net presence */
+ if ( -1 == stat("/proc/sys/net", &sinfo) ) {
+--
+1.9.1
+
diff --git a/meta-initramfs/recipes-bsp/kexecboot/kexecboot_0.6.bb b/meta-initramfs/recipes-bsp/kexecboot/kexecboot_0.6.bb
index 1fb5f0da5f..9061c272fc 100644
--- a/meta-initramfs/recipes-bsp/kexecboot/kexecboot_0.6.bb
+++ b/meta-initramfs/recipes-bsp/kexecboot/kexecboot_0.6.bb
@@ -42,7 +42,14 @@ SRC_URI = "https://github.com/kexecboot/kexecboot/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "46b7c1a6f20531be56445ebb8669a2b8"
SRC_URI[sha256sum] = "6b360b8aa59bc5d68a96705349a0dd416f8ed704e931fa0ac7849298258f0f15"
-inherit autotools-brokensep
+SRC_URI += "\
+ file://0001-kexecboot-fix-build-when-S-B.patch \
+ file://0002-kexecboot-fix-configure-warnings.patch \
+ file://0003-kexecboot-do-not-hardcode-MOUNTPOINT.patch \
+ file://0004-kexecboot.c-workaround-for-absolute-kernel-and-initr.patch \
+ "
+
+inherit autotools
EXTRA_OECONF = "--enable-delay=2 --enable-evdev-rate=1000,250"
diff --git a/meta-initramfs/recipes-devtools/dracut/dracut_git.bb b/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
index ea55a4dfbd..77c137c463 100644
--- a/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
+++ b/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
@@ -13,8 +13,10 @@ SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git"
S = "${WORKDIR}/git"
-do_configure() {
- ./configure --prefix=${prefix} \
+inherit distro_features_check
+REQUIRED_DISTRO_FEATURES = "systemd"
+
+EXTRA_OECONF = "--prefix=${prefix} \
--libdir=${libdir} \
--datadir=${datadir} \
--sysconfdir=${sysconfdir} \
@@ -23,20 +25,31 @@ do_configure() {
--bindir=${bindir} \
--includedir=${includedir} \
--localstatedir=${localstatedir} \
+ --systemdsystemunitdir=${systemd_unitdir}/system"
+
+do_configure() {
+ ./configure ${EXTRA_OECONF}
}
do_install() {
oe_runmake install DESTDIR=${D}
}
-FILES_${PN} += "${datadir}/bash-completion \
- ${libdir}/kernel \
+PACKAGES =+ "${PN}-bash-completion"
+
+FILES_${PN}-bash-completion = "${datadir}/bash-completion"
+
+FILES_${PN} += " ${libdir}/kernel \
+ ${systemd_unitdir} \
"
+CONFFILES_${PN} += "${sysconfdir}/dracut.conf"
+
+RDEPENDS_${PN} = "systemd findutils cpio util-linux-blkid util-linux-getopt bash ldd"
+RDEPENDS_${PN}-bash-completion = "bash-completion"
-# 'getopt' is in the util-linux main package
-RDEPENDS_${PN} = "systemd findutils cpio util-linux-blkid util-linux bash ldd"
# This could be optimized a bit, but let's avoid non-booting systems :)
RRECOMMENDS_${PN} = " \
kernel-modules \
+ busybox \
coreutils \
"
diff --git a/meta-initramfs/recipes-devtools/klibc/klibc.inc b/meta-initramfs/recipes-devtools/klibc/klibc.inc
index f3e9972a4f..9f445e1cb2 100644
--- a/meta-initramfs/recipes-devtools/klibc/klibc.inc
+++ b/meta-initramfs/recipes-devtools/klibc/klibc.inc
@@ -24,6 +24,7 @@ S = "${WORKDIR}/git"
EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \
'CROSS_COMPILE=${TARGET_PREFIX}' \
'KLIBCKERNELSRC=${STAGING_DIR_TARGET}${exec_prefix}' \
+ 'KLIBCLIBGCC=${STAGING_DIR_TARGET}${libdir}/${TARGET_SYS}/*/libgcc.a' \
'prefix=${exec_prefix}' \
'INSTALLROOT=${D}' \
'SHLIBDIR=${libdir}' \
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 0000000000..9d5e4ebf07
--- /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 0000000000..f46824b5cd
--- /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 0000000000..962b3685f3
--- /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 0000000000..fee1cbcf90
--- /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 0000000000..2e43d5d974
--- /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 0000000000..043a89d67e
--- /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/Makefile.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch
deleted file mode 100644
index b7dad878bd..0000000000
--- 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 0a48416c06..0000000000
--- 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 45f2439c8a..0000000000
--- 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 b52e207898..0000000000
--- 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 d21ed577b1..0000000000
--- 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.1.bb
index 134dd80f07..8ca1ca727d 100644
--- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.0.bb
+++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb
@@ -7,16 +7,16 @@ 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 \
-"
+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/"
@@ -31,19 +31,20 @@ do_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"
+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_ubinfo-klibc = "${sbindir}/ubinfo"
+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_mtdinfo-klibc = "${sbindir}/mtdinfo"
-FILES_ubiupdatevol-klibc = "${sbindir}/ubiupdatevol"
+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_ubinize-klibc = "${sbindir}/ubinize"
-FILES_ubiformat-klibc = "${sbindir}/ubiformat"
-FILES_ubicrc32-klibc = "${sbindir}/ubicrc32"
+FILES_ubiupdatevol-klibc = "${sbindir}/ubiupdatevol"
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/fix-out-of-tree-build.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/fix-out-of-tree-build.patch
new file mode 100644
index 0000000000..ccbb24d0db
--- /dev/null
+++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/fix-out-of-tree-build.patch
@@ -0,0 +1,54 @@
+From 37737527725e465833be649101c4a6f8352c5d5e Mon Sep 17 00:00:00 2001
+From: Tyler Hall <tylerwhall@gmail.com>
+Date: Tue, 7 Feb 2012 18:50:05 -0500
+Subject: Fix out-of-tree build
+
+Use automatic variables for prerequisites when copying man pages and
+include a makefile relative to $(srcdir).
+
+Backported to 2.0.2-klibc
+
+Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
+Signed-off-by: Simon Horman <horms@verge.net.au>
+
+diff --git a/kdump/Makefile b/kdump/Makefile
+index 1e2b72c..5dfa928 100644
+--- a/kdump/Makefile
++++ b/kdump/Makefile
+@@ -22,7 +22,7 @@ $(KDUMP): $(KDUMP_OBJS)
+
+ $(KDUMP_MANPAGE): kdump/kdump.8
+ $(MKDIR) -p $(MANDIR)/man8
+- cp kdump/kdump.8 $(KDUMP_MANPAGE)
++ cp $^ $(KDUMP_MANPAGE)
+ echo::
+ @echo "KDUMP_SRCS $(KDUMP_SRCS)"
+ @echo "KDUMP_DEPS $(KDUMP_DEPS)"
+diff --git a/kexec/Makefile b/kexec/Makefile
+index 2137cab..8c815b5 100644
+--- a/kexec/Makefile
++++ b/kexec/Makefile
+@@ -82,7 +82,7 @@ $(KEXEC): CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/include
+
+ $(KEXEC_MANPAGE): kexec/kexec.8
+ @$(MKDIR) -p $(MANDIR)/man8
+- cp kexec/kexec.8 $(KEXEC_MANPAGE)
++ cp $^ $(KEXEC_MANPAGE)
+ echo::
+ @echo "KEXEC_SRCS $(KEXEC_SRCS)"
+ @echo "KEXEC_DEPS $(KEXEC_DEPS)"
+diff --git a/kexec/arch/ppc/Makefile b/kexec/arch/ppc/Makefile
+index 3dba7cf..41242a5 100644
+--- a/kexec/arch/ppc/Makefile
++++ b/kexec/arch/ppc/Makefile
+@@ -1,7 +1,7 @@
+ #
+ # kexec ppc (linux booting linux)
+ #
+-include kexec/arch/ppc/libfdt/Makefile.libfdt
++include $(srcdir)/kexec/arch/ppc/libfdt/Makefile.libfdt
+
+ ppc_KEXEC_SRCS = kexec/arch/ppc/kexec-ppc.c
+ ppc_KEXEC_SRCS += kexec/arch/ppc/kexec-elf-ppc.c
+
+
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb
index b1b6ffca49..d5b7bbe9c7 100644
--- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb
+++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb
@@ -17,6 +17,7 @@ SRC_URI += " \
file://purgatory_string.patch \
file://sha256.patch \
file://sysconf_nrprocessors.patch \
+ file://fix-out-of-tree-build.patch \
"
SRC_URI_append_arm = " file://arm_crashdump.patch"
diff --git a/meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.17.bb b/meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.17.bb
deleted file mode 100644
index f3296c7e86..0000000000
--- a/meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.17.bb
+++ /dev/null
@@ -1,26 +0,0 @@
-require recipes-kernel/linux/linux-yocto-tiny_3.17.bb
-SUMMARY = "Yocto tiny kernel embedding a minimalistic kexecboot initramfs"
-
-PACKAGES = ""
-PROVIDES = ""
-
-KERNEL_IMAGE_BASE_NAME = "${KERNEL_IMAGETYPE}-yocto-tiny-kexecboot-${PV}-${MACHINE}"
-KERNEL_IMAGE_SYMLINK_NAME = "${KERNEL_IMAGETYPE}-yocto-tiny-kexecboot-${MACHINE}"
-
-INITRAMFS_IMAGE = "initramfs-kexecboot-klibc-image"
-INITRAMFS_TASK = "${INITRAMFS_IMAGE}:do_rootfs"
-
-# disable unneeded tasks
-do_install[noexec] = "1"
-do_package[noexec] = "1"
-do_package_qa[noexec] = "1"
-do_packagedata[noexec] = "1"
-do_package_deb[noexec] = "1"
-do_package_ipk[noexec] = "1"
-do_package_rpm[noexec] = "1"
-do_package_tar[noexec] = "1"
-do_package_write_deb[noexec] = "1"
-do_package_write_ipk[noexec] = "1"
-do_package_write_rpm[noexec] = "1"
-do_package_write_tar[noexec] = "1"
-do_populate_sysroot[noexec] = "1"
diff --git a/meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.10.bb b/meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.19.bb
index a823e0fb31..f6d2fa02a4 100644
--- a/meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.10.bb
+++ b/meta-initramfs/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.19.bb
@@ -1,4 +1,4 @@
-require recipes-kernel/linux/linux-yocto-tiny_3.10.bb
+require recipes-kernel/linux/linux-yocto-tiny_${PV}.bb
SUMMARY = "Yocto tiny kernel embedding a minimalistic kexecboot initramfs"
PACKAGES = ""