summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-initramfs/recipes-kernel/kexec
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-initramfs/recipes-kernel/kexec')
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/0001-Adjust-the-order-of-headers-to-fix-build-for-musl.patch30
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/arm_crashdump.patch12
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/cflags_static.patch11
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/fix-out-of-tree-build.patch54
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ifdown_errno.patch11
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-elf-rel.patch61
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-syscall.patch44
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ppc__lshrdi3.patch18
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_flags.patch21
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_string.patch9
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sha256.patch13
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sysconf_nrprocessors.patch13
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_basename.patch14
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_kexec_test.patch13
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_sys_io.patch21
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_vfscanf.patch27
-rw-r--r--meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb69
17 files changed, 441 insertions, 0 deletions
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/0001-Adjust-the-order-of-headers-to-fix-build-for-musl.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/0001-Adjust-the-order-of-headers-to-fix-build-for-musl.patch
new file mode 100644
index 000000000..a7600b301
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/0001-Adjust-the-order-of-headers-to-fix-build-for-musl.patch
@@ -0,0 +1,30 @@
+From 86b962e7c0de43b20b6210d059e4855ce87078bc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 13 Jul 2017 16:20:08 -0700
+Subject: [PATCH] Adjust the order of headers to fix build for musl
+
+Fixes
+kexec/ifdown.c:33:16: error: storage size of 'ifc' isn't known
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ kexec/ifdown.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kexec/ifdown.c b/kexec/ifdown.c
+index 2215798..e13f777 100644
+--- a/kexec/ifdown.c
++++ b/kexec/ifdown.c
+@@ -16,8 +16,8 @@ char *v_ifdown = "@(#)ifdown.c 1.11 02-Jun-1998 miquels@cistron.nl";
+ #include <sys/time.h>
+ #include <errno.h>
+
+-#include <net/if.h>
+ #include <netinet/in.h>
++#include <net/if.h>
+
+ #define MAX_IFS 64
+
+--
+2.13.2
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/arm_crashdump.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/arm_crashdump.patch
new file mode 100644
index 000000000..0ff61e543
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/arm_crashdump.patch
@@ -0,0 +1,12 @@
+--- a/kexec/arch/arm/crashdump-arm.c
++++ b/kexec/arch/arm/crashdump-arm.c
+@@ -20,7 +20,7 @@
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+-#include <elf.h>
++#include "../../../include/elf.h"
+ #include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/cflags_static.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/cflags_static.patch
new file mode 100644
index 000000000..35100a3b4
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/cflags_static.patch
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -46,7 +46,7 @@
+ # where necessary.
+ CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -I$(srcdir)/util_lib/include \
+ -Iinclude/
+-CFLAGS = @CFLAGS@ -fno-strict-aliasing -Wall -Wstrict-prototypes
++CFLAGS = @CFLAGS@ -static -fno-strict-aliasing -Wall -Wstrict-prototypes
+ PURGATORY_EXTRA_CFLAGS = @PURGATORY_EXTRA_CFLAGS@
+ ASFLAGS = @ASFLAGS@
+ LDFLAGS = @LDFLAGS@
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/fix-out-of-tree-build.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/fix-out-of-tree-build.patch
new file mode 100644
index 000000000..ccbb24d0d
--- /dev/null
+++ b/meta-openembedded/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-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ifdown_errno.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ifdown_errno.patch
new file mode 100644
index 000000000..7f8cddd35
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ifdown_errno.patch
@@ -0,0 +1,11 @@
+--- a/kexec/ifdown.c
++++ b/kexec/ifdown.c
+@@ -14,7 +14,7 @@
+ #include <sys/ioctl.h>
+ #include <sys/socket.h>
+ #include <sys/time.h>
+-#include <sys/errno.h>
++#include <errno.h>
+
+ #include <net/if.h>
+ #include <netinet/in.h>
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-elf-rel.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-elf-rel.patch
new file mode 100644
index 000000000..c666afcac
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-elf-rel.patch
@@ -0,0 +1,61 @@
+--- a/kexec/kexec-elf-rel.c
++++ b/kexec/kexec-elf-rel.c
+@@ -4,7 +4,7 @@
+ #include <stdio.h>
+ #include <errno.h>
+ #include <stdlib.h>
+-#include "elf.h"
++#include "../include/elf.h"
+ #include <boot/elf_boot.h>
+ #include "kexec.h"
+ #include "kexec-elf.h"
+
+--- a/kexec/arch/arm/kexec-elf-rel-arm.c
++++ b/kexec/arch/arm/kexec-elf-rel-arm.c
+@@ -1,5 +1,5 @@
+ #include <stdio.h>
+-#include <elf.h>
++#include "../../../include/elf.h"
+ #include "../../kexec.h"
+ #include "../../kexec-elf.h"
+
+
+--- a/kexec/arch/i386/kexec-elf-rel-x86.c
++++ b/kexec/arch/i386/kexec-elf-rel-x86.c
+@@ -1,5 +1,5 @@
+ #include <stdio.h>
+-#include <elf.h>
++#include "../../../include/elf.h"
+ #include "../../kexec.h"
+ #include "../../kexec-elf.h"
+
+
+--- a/kexec/arch/ppc/kexec-elf-rel-ppc.c
++++ b/kexec/arch/ppc/kexec-elf-rel-ppc.c
+@@ -1,5 +1,5 @@
+ #include <stdio.h>
+-#include <elf.h>
++#include "../../../include/elf.h"
+ #include "../../kexec.h"
+ #include "../../kexec-elf.h"
+
+
+--- a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
++++ b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
+@@ -1,5 +1,5 @@
+ #include <stdio.h>
+-#include <elf.h>
++#include "../../../include/elf.h"
+ #include <string.h>
+ #include "../../kexec.h"
+ #include "../../kexec-elf.h"
+
+--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
++++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+@@ -1,5 +1,5 @@
+ #include <stdio.h>
+-#include <elf.h>
++#include "../../../include/elf.h"
+ #include "../../kexec.h"
+ #include "../../kexec-elf.h"
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-syscall.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-syscall.patch
new file mode 100644
index 000000000..081de1bb5
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-syscall.patch
@@ -0,0 +1,44 @@
+--- a/kexec/kexec-syscall.h
++++ b/kexec/kexec-syscall.h
+@@ -2,7 +2,7 @@
+ #define KEXEC_SYSCALL_H
+
+ #define __LIBRARY__
+-#include <syscall.h>
++/*#include <syscall.h>*/
+ #include <sys/syscall.h>
+ #include <unistd.h>
+
+@@ -23,6 +23,7 @@
+ #define LINUX_REBOOT_CMD_KEXEC 0x45584543
+
+ #ifndef __NR_kexec_load
++/*
+ #ifdef __i386__
+ #define __NR_kexec_load 283
+ #endif
+@@ -61,19 +62,21 @@
+ #ifndef __NR_kexec_load
+ #error Unknown processor architecture. Needs a kexec_load syscall number.
+ #endif
++*/
+ #endif /*ifndef __NR_kexec_load*/
+
+ struct kexec_segment;
+-
++/*
+ static inline long kexec_load(void *entry, unsigned long nr_segments,
+ struct kexec_segment *segments, unsigned long flags)
+ {
+ return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags);
+ }
+-
++*/
+ static inline long kexec_reboot(void)
+ {
+- return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0);
++ //return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0);
++ return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0);
+ }
+
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ppc__lshrdi3.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ppc__lshrdi3.patch
new file mode 100644
index 000000000..56cdfb08d
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ppc__lshrdi3.patch
@@ -0,0 +1,18 @@
+--- a/purgatory/arch/ppc/crt.S
++++ b/purgatory/arch/ppc/crt.S
+@@ -249,6 +249,7 @@
+ *
+ */
+
++/* already defined in misc.S
+ _GLOBAL(__lshrdi3)
+ subfic 6,5,32
+ srw 4,4,5 # LSW = count > 31 ? 0 : LSW >> count
+@@ -259,5 +260,7 @@
+ srw 3,3,5 # MSW = MSW >> count
+ or 4,4,7 # LSW |= t2
+ blr
++*/
++
+ #endif
+ #endif
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_flags.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_flags.patch
new file mode 100644
index 000000000..41fc1168f
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_flags.patch
@@ -0,0 +1,21 @@
+--- a/purgatory/Makefile
++++ b/purgatory/Makefile
+@@ -47,7 +47,7 @@
+ $(PURGATORY): CC=$(TARGET_CC)
+ $(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \
+ $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
+- -Os -fno-builtin -ffreestanding
++ -Os -fno-builtin -ffreestanding -nostdinc
+
+ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
+ -I$(srcdir)/purgatory/include \
+@@ -61,7 +61,8 @@
+
+ $(PURGATORY): $(PURGATORY_OBJS)
+ $(MKDIR) -p $(@D)
+- $(CC) $(LDFLAGS) -o $@ $^
++# $(CC) $(LDFLAGS) -o $@ $^
++ $(LD) $(LDFLAGS) -o $@ $^
+
+ # $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB)
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_string.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_string.patch
new file mode 100644
index 000000000..5710561b1
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_string.patch
@@ -0,0 +1,9 @@
+--- a/purgatory/string.c
++++ b/purgatory/string.c
+@@ -1,5 +1,5 @@
+ #include <stddef.h>
+-#include <string.h>
++/* #include <string.h> */
+
+ size_t strnlen(const char *s, size_t max)
+ {
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sha256.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sha256.patch
new file mode 100644
index 000000000..85bf7aa4f
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sha256.patch
@@ -0,0 +1,13 @@
+--- a/util_lib/include/sha256.h
++++ b/util_lib/include/sha256.h
+@@ -1,7 +1,8 @@
+ #ifndef SHA256_H
+ #define SHA256_H
+
+-#include <sys/types.h>
++//#include <sys/types.h>
++#include <stddef.h>
+ #include <stdint.h>
+
+ typedef struct
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sysconf_nrprocessors.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sysconf_nrprocessors.patch
new file mode 100644
index 000000000..04a97e6bc
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sysconf_nrprocessors.patch
@@ -0,0 +1,13 @@
+--- a/kexec/crashdump-elf.c
++++ b/kexec/crashdump-elf.c
+@@ -47,7 +47,8 @@
+ if (xen_present())
+ nr_cpus = xen_get_nr_phys_cpus();
+ else
+- nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
++ /*nr_cpus = sysconf(_SC_NPROCESSORS_CONF);*/
++ nr_cpus = 1;
+
+ if (nr_cpus < 0) {
+ return -1;
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_basename.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_basename.patch
new file mode 100644
index 000000000..77a1c01a1
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_basename.patch
@@ -0,0 +1,14 @@
+--- a/kexec/arch/i386/x86-linux-setup.c
++++ b/kexec/arch/i386/x86-linux-setup.c
+@@ -280,9 +280,9 @@ static int add_edd_entry(struct x86_linu
+ memset(edd_info, 0, sizeof(struct edd_info));
+
+ /* extract the device number */
+- if (sscanf(basename(sysfs_name), "int13_dev%hhx", &devnum) != 1) {
++ if (sscanf(strrchr(sysfs_name,'/') + 1, "int13_dev%hhx", &devnum) != 1) {
+ fprintf(stderr, "Invalid format of int13_dev dir "
+- "entry: %s\n", basename(sysfs_name));
++ "entry: %s\n", strrchr(sysfs_name,'/') + 1);
+ return -1;
+ }
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_kexec_test.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_kexec_test.patch
new file mode 100644
index 000000000..9500bd604
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_kexec_test.patch
@@ -0,0 +1,13 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -106,8 +106,8 @@
+
+ MAN_PAGES:= kexec/kexec.8
+ MAN_PAGES+= kdump/kdump.8
+-BINARIES_i386:= $(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
+-BINARIES_x86_64:=$(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
++BINARIES_i386:= $(SBINDIR)/kexec
++BINARIES_x86_64:=$(SBINDIR)/kexec
+ BINARIES:=$(SBINDIR)/kexec $(SBINDIR)/kdump $(BINARIES_$(ARCH))
+
+ TARGETS:=$(BINARIES) $(MAN_PAGES)
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_sys_io.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_sys_io.patch
new file mode 100644
index 000000000..a497c9a63
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_sys_io.patch
@@ -0,0 +1,21 @@
+--- a/purgatory/arch/i386/pic.c
++++ b/purgatory/arch/i386/pic.c
+@@ -16,7 +16,7 @@
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+-#include <sys/io.h>
++#include "include/arch/io.h"
+ #include <purgatory.h>
+ #include "purgatory-x86.h"
+
+
+--- a/purgatory/arch/i386/vga.c
++++ b/purgatory/arch/i386/vga.c
+@@ -1,4 +1,4 @@
+-#include <sys/io.h>
++#include "include/arch/io.h"
+ #include <purgatory.h>
+ #include "purgatory-x86.h"
+
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_vfscanf.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_vfscanf.patch
new file mode 100644
index 000000000..cad695154
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_vfscanf.patch
@@ -0,0 +1,27 @@
+--- a/kexec/arch/i386/x86-linux-setup.c
++++ b/kexec/arch/i386/x86-linux-setup.c
+@@ -176,6 +176,8 @@ static int file_scanf(const char *dir, c
+ FILE *fp;
+ int retno;
+ char filename[PATH_MAX];
++ long line_size = MAX_LINE;
++ char *line;
+
+ snprintf(filename, PATH_MAX, "%s/%s", dir, file);
+ filename[PATH_MAX-1] = 0;
+@@ -186,7 +188,14 @@ static int file_scanf(const char *dir, c
+ }
+
+ va_start(argptr, scanf_line);
+- retno = vfscanf(fp, scanf_line, argptr);
++
++ line = xmalloc(sizeof(line) * line_size);
++ while(fgets(line, sizeof(line), fp) != NULL ) {
++ line_size += MAX_LINE;
++ line = xrealloc(line,line_size);
++ }
++ retno = vsscanf(line, scanf_line, argptr);
++
+ va_end(argptr);
+
+ fclose(fp);
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb
new file mode 100644
index 000000000..2e2703382
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb
@@ -0,0 +1,69 @@
+# the binaries are statically linked against klibc
+SUMMARY = "Kexec tools, statically compiled against klibc"
+AUTHOR = "Eric Biederman"
+HOMEPAGE = "http://kernel.org/pub/linux/utils/kernel/kexec/"
+SECTION = "kernel/userland"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \
+ file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09"
+DEPENDS = "zlib xz"
+
+PR = "r1"
+
+inherit klibc autotools
+
+FILESPATH =. "${FILE_DIRNAME}/kexec-tools-${PV}:"
+
+SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz"
+
+SRC_URI += " \
+ file://kexec-elf-rel.patch \
+ file://kexec-syscall.patch \
+ file://cflags_static.patch \
+ file://ifdown_errno.patch \
+ file://purgatory_flags.patch \
+ file://purgatory_string.patch \
+ file://sha256.patch \
+ file://sysconf_nrprocessors.patch \
+ file://fix-out-of-tree-build.patch \
+ file://0001-Adjust-the-order-of-headers-to-fix-build-for-musl.patch \
+ "
+
+SRC_URI[md5sum] = "92eff93b097475b7767f8c98df84408a"
+SRC_URI[sha256sum] = "09e180ff36dee087182cdc939ba6c6917b6adbb5fc12d589f31fd3659b6471f2"
+
+SRC_URI_append_arm = " file://arm_crashdump.patch"
+SRC_URI_append_powerpc = " file://ppc__lshrdi3.patch"
+SRC_URI_append_x86 = " file://x86_sys_io.patch file://x86_basename.patch file://x86_vfscanf.patch file://x86_kexec_test.patch"
+SRC_URI_append_x86-64 = " file://x86_sys_io.patch file://x86_basename.patch file://x86_vfscanf.patch file://x86_kexec_test.patch"
+
+S = "${WORKDIR}/kexec-tools-${PV}"
+
+EXTRA_OECONF += "--without-zlib --without-lzma --without-xen"
+
+CFLAGS += "-I${STAGING_DIR_HOST}${libdir}/klibc/include -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits32"
+CFLAGS_x86-64 += "-I${STAGING_DIR_HOST}${libdir}/klibc/include -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits64"
+
+do_compile_prepend() {
+ # Remove the prepackaged config.h from the source tree as it overrides
+ # the same file generated by configure and placed in the build tree
+ rm -f ${S}/include/config.h
+
+ # Remove the '*.d' file to make sure the recompile is OK
+ for dep in `find ${B} -type f -name '*.d'`; do
+ dep_no_d="`echo $dep | sed 's#.d$##'`"
+ # Remove file.d when there is a file.o
+ if [ -f "$dep_no_d.o" ]; then
+ rm -f $dep
+ fi
+ done
+}
+
+PACKAGES =+ "kexec-klibc kdump-klibc"
+
+FILES_kexec-klibc = "${sbindir}/kexec"
+FILES_kdump-klibc = "${sbindir}/kdump"
+
+INSANE_SKIP_${PN} = "arch"
+
+COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|powerpc.*|mips.*)-(linux|freebsd.*)'
OpenPOWER on IntegriCloud