diff options
| author | Andrea Adami <andrea.adami@gmail.com> | 2018-05-14 00:17:30 +0200 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2018-05-17 08:32:26 -0700 |
| commit | e22a87046f51e40972d732377505e62f9940d874 (patch) | |
| tree | c92282737f71711b9cb65cb9f3566f4d46ff5a3a /meta-initramfs/recipes-kernel | |
| parent | b4d849f5dbd7c0919e6fc64ece4394dee911e4cd (diff) | |
| download | meta-openembedded-e22a87046f51e40972d732377505e62f9940d874.tar.gz | |
kexec-tools-klibc: upgrade from v. 2.0.2 to 2.0.17
This version does support aarch64.
Ad klibc-specific patchset and track the git repository
to get the (many) fixes for the warnings.
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-initramfs/recipes-kernel')
42 files changed, 1256 insertions, 420 deletions
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/arm_crashdump.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/arm_crashdump.patch deleted file mode 100644 index 0ff61e543e..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/arm_crashdump.patch +++ /dev/null | |||
| @@ -1,12 +0,0 @@ | |||
| 1 | --- a/kexec/arch/arm/crashdump-arm.c | ||
| 2 | +++ b/kexec/arch/arm/crashdump-arm.c | ||
| 3 | @@ -20,7 +20,7 @@ | ||
| 4 | * along with this program; if not, write to the Free Software | ||
| 5 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 6 | */ | ||
| 7 | -#include <elf.h> | ||
| 8 | +#include "../../../include/elf.h" | ||
| 9 | #include <errno.h> | ||
| 10 | #include <stdio.h> | ||
| 11 | #include <stdlib.h> | ||
| 12 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/cflags_static.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/cflags_static.patch deleted file mode 100644 index 35100a3b49..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/cflags_static.patch +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | --- a/Makefile.in | ||
| 2 | +++ b/Makefile.in | ||
| 3 | @@ -46,7 +46,7 @@ | ||
| 4 | # where necessary. | ||
| 5 | CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -I$(srcdir)/util_lib/include \ | ||
| 6 | -Iinclude/ | ||
| 7 | -CFLAGS = @CFLAGS@ -fno-strict-aliasing -Wall -Wstrict-prototypes | ||
| 8 | +CFLAGS = @CFLAGS@ -static -fno-strict-aliasing -Wall -Wstrict-prototypes | ||
| 9 | PURGATORY_EXTRA_CFLAGS = @PURGATORY_EXTRA_CFLAGS@ | ||
| 10 | ASFLAGS = @ASFLAGS@ | ||
| 11 | LDFLAGS = @LDFLAGS@ | ||
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 deleted file mode 100644 index ccbb24d0db..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/fix-out-of-tree-build.patch +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | From 37737527725e465833be649101c4a6f8352c5d5e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Tyler Hall <tylerwhall@gmail.com> | ||
| 3 | Date: Tue, 7 Feb 2012 18:50:05 -0500 | ||
| 4 | Subject: Fix out-of-tree build | ||
| 5 | |||
| 6 | Use automatic variables for prerequisites when copying man pages and | ||
| 7 | include a makefile relative to $(srcdir). | ||
| 8 | |||
| 9 | Backported to 2.0.2-klibc | ||
| 10 | |||
| 11 | Signed-off-by: Tyler Hall <tylerwhall@gmail.com> | ||
| 12 | Signed-off-by: Simon Horman <horms@verge.net.au> | ||
| 13 | |||
| 14 | diff --git a/kdump/Makefile b/kdump/Makefile | ||
| 15 | index 1e2b72c..5dfa928 100644 | ||
| 16 | --- a/kdump/Makefile | ||
| 17 | +++ b/kdump/Makefile | ||
| 18 | @@ -22,7 +22,7 @@ $(KDUMP): $(KDUMP_OBJS) | ||
| 19 | |||
| 20 | $(KDUMP_MANPAGE): kdump/kdump.8 | ||
| 21 | $(MKDIR) -p $(MANDIR)/man8 | ||
| 22 | - cp kdump/kdump.8 $(KDUMP_MANPAGE) | ||
| 23 | + cp $^ $(KDUMP_MANPAGE) | ||
| 24 | echo:: | ||
| 25 | @echo "KDUMP_SRCS $(KDUMP_SRCS)" | ||
| 26 | @echo "KDUMP_DEPS $(KDUMP_DEPS)" | ||
| 27 | diff --git a/kexec/Makefile b/kexec/Makefile | ||
| 28 | index 2137cab..8c815b5 100644 | ||
| 29 | --- a/kexec/Makefile | ||
| 30 | +++ b/kexec/Makefile | ||
| 31 | @@ -82,7 +82,7 @@ $(KEXEC): CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/include | ||
| 32 | |||
| 33 | $(KEXEC_MANPAGE): kexec/kexec.8 | ||
| 34 | @$(MKDIR) -p $(MANDIR)/man8 | ||
| 35 | - cp kexec/kexec.8 $(KEXEC_MANPAGE) | ||
| 36 | + cp $^ $(KEXEC_MANPAGE) | ||
| 37 | echo:: | ||
| 38 | @echo "KEXEC_SRCS $(KEXEC_SRCS)" | ||
| 39 | @echo "KEXEC_DEPS $(KEXEC_DEPS)" | ||
| 40 | diff --git a/kexec/arch/ppc/Makefile b/kexec/arch/ppc/Makefile | ||
| 41 | index 3dba7cf..41242a5 100644 | ||
| 42 | --- a/kexec/arch/ppc/Makefile | ||
| 43 | +++ b/kexec/arch/ppc/Makefile | ||
| 44 | @@ -1,7 +1,7 @@ | ||
| 45 | # | ||
| 46 | # kexec ppc (linux booting linux) | ||
| 47 | # | ||
| 48 | -include kexec/arch/ppc/libfdt/Makefile.libfdt | ||
| 49 | +include $(srcdir)/kexec/arch/ppc/libfdt/Makefile.libfdt | ||
| 50 | |||
| 51 | ppc_KEXEC_SRCS = kexec/arch/ppc/kexec-ppc.c | ||
| 52 | ppc_KEXEC_SRCS += kexec/arch/ppc/kexec-elf-ppc.c | ||
| 53 | |||
| 54 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ifdown_errno.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ifdown_errno.patch deleted file mode 100644 index 7f8cddd354..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ifdown_errno.patch +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | --- a/kexec/ifdown.c | ||
| 2 | +++ b/kexec/ifdown.c | ||
| 3 | @@ -14,7 +14,7 @@ | ||
| 4 | #include <sys/ioctl.h> | ||
| 5 | #include <sys/socket.h> | ||
| 6 | #include <sys/time.h> | ||
| 7 | -#include <sys/errno.h> | ||
| 8 | +#include <errno.h> | ||
| 9 | |||
| 10 | #include <net/if.h> | ||
| 11 | #include <netinet/in.h> | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-elf-rel.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-elf-rel.patch deleted file mode 100644 index c666afcac6..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-elf-rel.patch +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | --- a/kexec/kexec-elf-rel.c | ||
| 2 | +++ b/kexec/kexec-elf-rel.c | ||
| 3 | @@ -4,7 +4,7 @@ | ||
| 4 | #include <stdio.h> | ||
| 5 | #include <errno.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | -#include "elf.h" | ||
| 8 | +#include "../include/elf.h" | ||
| 9 | #include <boot/elf_boot.h> | ||
| 10 | #include "kexec.h" | ||
| 11 | #include "kexec-elf.h" | ||
| 12 | |||
| 13 | --- a/kexec/arch/arm/kexec-elf-rel-arm.c | ||
| 14 | +++ b/kexec/arch/arm/kexec-elf-rel-arm.c | ||
| 15 | @@ -1,5 +1,5 @@ | ||
| 16 | #include <stdio.h> | ||
| 17 | -#include <elf.h> | ||
| 18 | +#include "../../../include/elf.h" | ||
| 19 | #include "../../kexec.h" | ||
| 20 | #include "../../kexec-elf.h" | ||
| 21 | |||
| 22 | |||
| 23 | --- a/kexec/arch/i386/kexec-elf-rel-x86.c | ||
| 24 | +++ b/kexec/arch/i386/kexec-elf-rel-x86.c | ||
| 25 | @@ -1,5 +1,5 @@ | ||
| 26 | #include <stdio.h> | ||
| 27 | -#include <elf.h> | ||
| 28 | +#include "../../../include/elf.h" | ||
| 29 | #include "../../kexec.h" | ||
| 30 | #include "../../kexec-elf.h" | ||
| 31 | |||
| 32 | |||
| 33 | --- a/kexec/arch/ppc/kexec-elf-rel-ppc.c | ||
| 34 | +++ b/kexec/arch/ppc/kexec-elf-rel-ppc.c | ||
| 35 | @@ -1,5 +1,5 @@ | ||
| 36 | #include <stdio.h> | ||
| 37 | -#include <elf.h> | ||
| 38 | +#include "../../../include/elf.h" | ||
| 39 | #include "../../kexec.h" | ||
| 40 | #include "../../kexec-elf.h" | ||
| 41 | |||
| 42 | |||
| 43 | --- a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c | ||
| 44 | +++ b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c | ||
| 45 | @@ -1,5 +1,5 @@ | ||
| 46 | #include <stdio.h> | ||
| 47 | -#include <elf.h> | ||
| 48 | +#include "../../../include/elf.h" | ||
| 49 | #include <string.h> | ||
| 50 | #include "../../kexec.h" | ||
| 51 | #include "../../kexec-elf.h" | ||
| 52 | |||
| 53 | --- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c | ||
| 54 | +++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c | ||
| 55 | @@ -1,5 +1,5 @@ | ||
| 56 | #include <stdio.h> | ||
| 57 | -#include <elf.h> | ||
| 58 | +#include "../../../include/elf.h" | ||
| 59 | #include "../../kexec.h" | ||
| 60 | #include "../../kexec-elf.h" | ||
| 61 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-syscall.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-syscall.patch deleted file mode 100644 index 081de1bb51..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/kexec-syscall.patch +++ /dev/null | |||
| @@ -1,44 +0,0 @@ | |||
| 1 | --- a/kexec/kexec-syscall.h | ||
| 2 | +++ b/kexec/kexec-syscall.h | ||
| 3 | @@ -2,7 +2,7 @@ | ||
| 4 | #define KEXEC_SYSCALL_H | ||
| 5 | |||
| 6 | #define __LIBRARY__ | ||
| 7 | -#include <syscall.h> | ||
| 8 | +/*#include <syscall.h>*/ | ||
| 9 | #include <sys/syscall.h> | ||
| 10 | #include <unistd.h> | ||
| 11 | |||
| 12 | @@ -23,6 +23,7 @@ | ||
| 13 | #define LINUX_REBOOT_CMD_KEXEC 0x45584543 | ||
| 14 | |||
| 15 | #ifndef __NR_kexec_load | ||
| 16 | +/* | ||
| 17 | #ifdef __i386__ | ||
| 18 | #define __NR_kexec_load 283 | ||
| 19 | #endif | ||
| 20 | @@ -61,19 +62,21 @@ | ||
| 21 | #ifndef __NR_kexec_load | ||
| 22 | #error Unknown processor architecture. Needs a kexec_load syscall number. | ||
| 23 | #endif | ||
| 24 | +*/ | ||
| 25 | #endif /*ifndef __NR_kexec_load*/ | ||
| 26 | |||
| 27 | struct kexec_segment; | ||
| 28 | - | ||
| 29 | +/* | ||
| 30 | static inline long kexec_load(void *entry, unsigned long nr_segments, | ||
| 31 | struct kexec_segment *segments, unsigned long flags) | ||
| 32 | { | ||
| 33 | return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags); | ||
| 34 | } | ||
| 35 | - | ||
| 36 | +*/ | ||
| 37 | static inline long kexec_reboot(void) | ||
| 38 | { | ||
| 39 | - return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); | ||
| 40 | + //return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); | ||
| 41 | + return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); | ||
| 42 | } | ||
| 43 | |||
| 44 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ppc__lshrdi3.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ppc__lshrdi3.patch deleted file mode 100644 index 56cdfb08d8..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/ppc__lshrdi3.patch +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | --- a/purgatory/arch/ppc/crt.S | ||
| 2 | +++ b/purgatory/arch/ppc/crt.S | ||
| 3 | @@ -249,6 +249,7 @@ | ||
| 4 | * | ||
| 5 | */ | ||
| 6 | |||
| 7 | +/* already defined in misc.S | ||
| 8 | _GLOBAL(__lshrdi3) | ||
| 9 | subfic 6,5,32 | ||
| 10 | srw 4,4,5 # LSW = count > 31 ? 0 : LSW >> count | ||
| 11 | @@ -259,5 +260,7 @@ | ||
| 12 | srw 3,3,5 # MSW = MSW >> count | ||
| 13 | or 4,4,7 # LSW |= t2 | ||
| 14 | blr | ||
| 15 | +*/ | ||
| 16 | + | ||
| 17 | #endif | ||
| 18 | #endif | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_flags.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_flags.patch deleted file mode 100644 index 41fc1168fb..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_flags.patch +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | --- a/purgatory/Makefile | ||
| 2 | +++ b/purgatory/Makefile | ||
| 3 | @@ -47,7 +47,7 @@ | ||
| 4 | $(PURGATORY): CC=$(TARGET_CC) | ||
| 5 | $(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \ | ||
| 6 | $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ | ||
| 7 | - -Os -fno-builtin -ffreestanding | ||
| 8 | + -Os -fno-builtin -ffreestanding -nostdinc | ||
| 9 | |||
| 10 | $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ | ||
| 11 | -I$(srcdir)/purgatory/include \ | ||
| 12 | @@ -61,7 +61,8 @@ | ||
| 13 | |||
| 14 | $(PURGATORY): $(PURGATORY_OBJS) | ||
| 15 | $(MKDIR) -p $(@D) | ||
| 16 | - $(CC) $(LDFLAGS) -o $@ $^ | ||
| 17 | +# $(CC) $(LDFLAGS) -o $@ $^ | ||
| 18 | + $(LD) $(LDFLAGS) -o $@ $^ | ||
| 19 | |||
| 20 | # $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) | ||
| 21 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_string.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_string.patch deleted file mode 100644 index 5710561b16..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/purgatory_string.patch +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | --- a/purgatory/string.c | ||
| 2 | +++ b/purgatory/string.c | ||
| 3 | @@ -1,5 +1,5 @@ | ||
| 4 | #include <stddef.h> | ||
| 5 | -#include <string.h> | ||
| 6 | +/* #include <string.h> */ | ||
| 7 | |||
| 8 | size_t strnlen(const char *s, size_t max) | ||
| 9 | { | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sha256.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sha256.patch deleted file mode 100644 index 85bf7aa4f4..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sha256.patch +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | --- a/util_lib/include/sha256.h | ||
| 2 | +++ b/util_lib/include/sha256.h | ||
| 3 | @@ -1,7 +1,8 @@ | ||
| 4 | #ifndef SHA256_H | ||
| 5 | #define SHA256_H | ||
| 6 | |||
| 7 | -#include <sys/types.h> | ||
| 8 | +//#include <sys/types.h> | ||
| 9 | +#include <stddef.h> | ||
| 10 | #include <stdint.h> | ||
| 11 | |||
| 12 | typedef struct | ||
| 13 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sysconf_nrprocessors.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sysconf_nrprocessors.patch deleted file mode 100644 index 04a97e6bc8..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/sysconf_nrprocessors.patch +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | --- a/kexec/crashdump-elf.c | ||
| 2 | +++ b/kexec/crashdump-elf.c | ||
| 3 | @@ -47,7 +47,8 @@ | ||
| 4 | if (xen_present()) | ||
| 5 | nr_cpus = xen_get_nr_phys_cpus(); | ||
| 6 | else | ||
| 7 | - nr_cpus = sysconf(_SC_NPROCESSORS_CONF); | ||
| 8 | + /*nr_cpus = sysconf(_SC_NPROCESSORS_CONF);*/ | ||
| 9 | + nr_cpus = 1; | ||
| 10 | |||
| 11 | if (nr_cpus < 0) { | ||
| 12 | return -1; | ||
| 13 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_basename.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_basename.patch deleted file mode 100644 index 77a1c01a1c..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_basename.patch +++ /dev/null | |||
| @@ -1,14 +0,0 @@ | |||
| 1 | --- a/kexec/arch/i386/x86-linux-setup.c | ||
| 2 | +++ b/kexec/arch/i386/x86-linux-setup.c | ||
| 3 | @@ -280,9 +280,9 @@ static int add_edd_entry(struct x86_linu | ||
| 4 | memset(edd_info, 0, sizeof(struct edd_info)); | ||
| 5 | |||
| 6 | /* extract the device number */ | ||
| 7 | - if (sscanf(basename(sysfs_name), "int13_dev%hhx", &devnum) != 1) { | ||
| 8 | + if (sscanf(strrchr(sysfs_name,'/') + 1, "int13_dev%hhx", &devnum) != 1) { | ||
| 9 | fprintf(stderr, "Invalid format of int13_dev dir " | ||
| 10 | - "entry: %s\n", basename(sysfs_name)); | ||
| 11 | + "entry: %s\n", strrchr(sysfs_name,'/') + 1); | ||
| 12 | return -1; | ||
| 13 | } | ||
| 14 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_kexec_test.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_kexec_test.patch deleted file mode 100644 index 9500bd6048..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_kexec_test.patch +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | --- a/Makefile.in | ||
| 2 | +++ b/Makefile.in | ||
| 3 | @@ -106,8 +106,8 @@ | ||
| 4 | |||
| 5 | MAN_PAGES:= kexec/kexec.8 | ||
| 6 | MAN_PAGES+= kdump/kdump.8 | ||
| 7 | -BINARIES_i386:= $(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test | ||
| 8 | -BINARIES_x86_64:=$(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test | ||
| 9 | +BINARIES_i386:= $(SBINDIR)/kexec | ||
| 10 | +BINARIES_x86_64:=$(SBINDIR)/kexec | ||
| 11 | BINARIES:=$(SBINDIR)/kexec $(SBINDIR)/kdump $(BINARIES_$(ARCH)) | ||
| 12 | |||
| 13 | TARGETS:=$(BINARIES) $(MAN_PAGES) | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_sys_io.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_sys_io.patch deleted file mode 100644 index a497c9a63d..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_sys_io.patch +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | --- a/purgatory/arch/i386/pic.c | ||
| 2 | +++ b/purgatory/arch/i386/pic.c | ||
| 3 | @@ -16,7 +16,7 @@ | ||
| 4 | * along with this program; if not, write to the Free Software | ||
| 5 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 6 | */ | ||
| 7 | -#include <sys/io.h> | ||
| 8 | +#include "include/arch/io.h" | ||
| 9 | #include <purgatory.h> | ||
| 10 | #include "purgatory-x86.h" | ||
| 11 | |||
| 12 | |||
| 13 | --- a/purgatory/arch/i386/vga.c | ||
| 14 | +++ b/purgatory/arch/i386/vga.c | ||
| 15 | @@ -1,4 +1,4 @@ | ||
| 16 | -#include <sys/io.h> | ||
| 17 | +#include "include/arch/io.h" | ||
| 18 | #include <purgatory.h> | ||
| 19 | #include "purgatory-x86.h" | ||
| 20 | |||
| 21 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_vfscanf.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_vfscanf.patch deleted file mode 100644 index cad6951547..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc-2.0.2/x86_vfscanf.patch +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | --- a/kexec/arch/i386/x86-linux-setup.c | ||
| 2 | +++ b/kexec/arch/i386/x86-linux-setup.c | ||
| 3 | @@ -176,6 +176,8 @@ static int file_scanf(const char *dir, c | ||
| 4 | FILE *fp; | ||
| 5 | int retno; | ||
| 6 | char filename[PATH_MAX]; | ||
| 7 | + long line_size = MAX_LINE; | ||
| 8 | + char *line; | ||
| 9 | |||
| 10 | snprintf(filename, PATH_MAX, "%s/%s", dir, file); | ||
| 11 | filename[PATH_MAX-1] = 0; | ||
| 12 | @@ -186,7 +188,14 @@ static int file_scanf(const char *dir, c | ||
| 13 | } | ||
| 14 | |||
| 15 | va_start(argptr, scanf_line); | ||
| 16 | - retno = vfscanf(fp, scanf_line, argptr); | ||
| 17 | + | ||
| 18 | + line = xmalloc(sizeof(line) * line_size); | ||
| 19 | + while(fgets(line, sizeof(line), fp) != NULL ) { | ||
| 20 | + line_size += MAX_LINE; | ||
| 21 | + line = xrealloc(line,line_size); | ||
| 22 | + } | ||
| 23 | + retno = vsscanf(line, scanf_line, argptr); | ||
| 24 | + | ||
| 25 | va_end(argptr); | ||
| 26 | |||
| 27 | fclose(fp); | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0001-force-static-build.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0001-force-static-build.patch new file mode 100644 index 0000000000..4744e7a35b --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0001-force-static-build.patch | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | From d6af515cfcc8185f423860f80ff28719975b701f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: OpenEmbedded <oe.patch@oe> | ||
| 3 | Date: Wed, 11 Apr 2018 22:51:00 +0200 | ||
| 4 | Subject: [PATCH] force static build | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [embedded specific] | ||
| 7 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 8 | |||
| 9 | --- | ||
| 10 | Makefile.in | 2 +- | ||
| 11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 12 | |||
| 13 | diff --git a/Makefile.in b/Makefile.in | ||
| 14 | index 54c206f..79188d8 100644 | ||
| 15 | --- a/Makefile.in | ||
| 16 | +++ b/Makefile.in | ||
| 17 | @@ -47,7 +47,7 @@ TARGET_CFLAGS = @TARGET_CFLAGS@ | ||
| 18 | # where necessary. | ||
| 19 | CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -I$(srcdir)/util_lib/include \ | ||
| 20 | -Iinclude/ $($(ARCH)_CPPFLAGS) | ||
| 21 | -CFLAGS = @CFLAGS@ -fno-strict-aliasing -Wall -Wstrict-prototypes | ||
| 22 | +CFLAGS = @CFLAGS@ -static -fno-strict-aliasing -Wall -Wstrict-prototypes | ||
| 23 | PURGATORY_EXTRA_CFLAGS = @PURGATORY_EXTRA_CFLAGS@ | ||
| 24 | ASFLAGS = @ASFLAGS@ $($(ARCH)_ASFLAGS) | ||
| 25 | LDFLAGS = @LDFLAGS@ | ||
diff --git a/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-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0002-Adjust-the-order-of-headers-to-fix-build-for-musl.patch index a7600b3010..1d96a2b3db 100644 --- a/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-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0002-Adjust-the-order-of-headers-to-fix-build-for-musl.patch | |||
| @@ -1,30 +1,29 @@ | |||
| 1 | From 86b962e7c0de43b20b6210d059e4855ce87078bc Mon Sep 17 00:00:00 2001 | 1 | From 0976d2d5be1ed44c2324b609c7d16c1e93181c4b Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 13 Jul 2017 16:20:08 -0700 | 3 | Date: Thu, 13 Jul 2017 16:20:08 -0700 |
| 4 | Subject: [PATCH] Adjust the order of headers to fix build for musl | 4 | Subject: [PATCH] Adjust the order of headers to fix build for musl |
| 5 | 5 | ||
| 6 | Fixes | 6 | Fixes |
| 7 | kexec/ifdown.c:33:16: error: storage size of 'ifc' isn't known | 7 | kexec/ifdown.c:33:16: error: storage size of 'ifc' isn't known |
| 8 | 8 | ||
| 9 | Upstream-Status: Inappropriate [embedded specific] | ||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 11 | |||
| 10 | --- | 12 | --- |
| 11 | kexec/ifdown.c | 2 +- | 13 | kexec/ifdown.c | 2 +- |
| 12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 14 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 13 | 15 | ||
| 14 | diff --git a/kexec/ifdown.c b/kexec/ifdown.c | 16 | diff --git a/kexec/ifdown.c b/kexec/ifdown.c |
| 15 | index 2215798..e13f777 100644 | 17 | index 9679ad7..82c6141 100644 |
| 16 | --- a/kexec/ifdown.c | 18 | --- a/kexec/ifdown.c |
| 17 | +++ b/kexec/ifdown.c | 19 | +++ b/kexec/ifdown.c |
| 18 | @@ -16,8 +16,8 @@ char *v_ifdown = "@(#)ifdown.c 1.11 02-Jun-1998 miquels@cistron.nl"; | 20 | @@ -16,8 +16,8 @@ char *v_ifdown = "@(#)ifdown.c 1.11 02-Jun-1998 miquels@cistron.nl"; |
| 21 | #include <sys/socket.h> | ||
| 19 | #include <sys/time.h> | 22 | #include <sys/time.h> |
| 20 | #include <errno.h> | ||
| 21 | 23 | ||
| 22 | -#include <net/if.h> | 24 | -#include <net/if.h> |
| 23 | #include <netinet/in.h> | 25 | #include <netinet/in.h> |
| 24 | +#include <net/if.h> | 26 | +#include <net/if.h> |
| 25 | 27 | ||
| 26 | #define MAX_IFS 64 | 28 | /* |
| 27 | 29 | * First, we find all shaper devices and down them. Then we | |
| 28 | -- | ||
| 29 | 2.13.2 | ||
| 30 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0003-kexec-elf-rel-use-our-elf.h.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0003-kexec-elf-rel-use-our-elf.h.patch new file mode 100644 index 0000000000..ae9e7bbc48 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0003-kexec-elf-rel-use-our-elf.h.patch | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | From 7f91875d65778154709e4fa0ccb23f3b2a98b0dc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: OpenEmbedded <oe.patch@oe> | ||
| 3 | Date: Wed, 11 Apr 2018 22:51:00 +0200 | ||
| 4 | Subject: [PATCH] kexec-elf-rel: use our elf.h | ||
| 5 | |||
| 6 | Fix: | ||
| 7 | |||
| 8 | kexec-elf-rel.c: In function 'elf_rel_load': | ||
| 9 | kexec-elf-rel.c:386:39: error: 'STT_NOTYPE' undeclared | ||
| 10 | |||
| 11 | and similar. | ||
| 12 | |||
| 13 | Upstream-Status: Inappropriate [klibc specific] | ||
| 14 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 15 | |||
| 16 | --- | ||
| 17 | kexec/arch/arm/kexec-elf-rel-arm.c | 2 +- | ||
| 18 | kexec/arch/i386/kexec-elf-rel-x86.c | 2 +- | ||
| 19 | kexec/arch/ppc/kexec-elf-rel-ppc.c | 2 +- | ||
| 20 | kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 2 +- | ||
| 21 | kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 2 +- | ||
| 22 | kexec/kexec-elf-rel.c | 2 +- | ||
| 23 | 6 files changed, 6 insertions(+), 6 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/kexec/arch/arm/kexec-elf-rel-arm.c b/kexec/arch/arm/kexec-elf-rel-arm.c | ||
| 26 | index a939cf4..2551dc0 100644 | ||
| 27 | --- a/kexec/arch/arm/kexec-elf-rel-arm.c | ||
| 28 | +++ b/kexec/arch/arm/kexec-elf-rel-arm.c | ||
| 29 | @@ -1,5 +1,5 @@ | ||
| 30 | #include <stdio.h> | ||
| 31 | -#include <elf.h> | ||
| 32 | +#include "../../../include/elf.h" | ||
| 33 | #include "../../kexec.h" | ||
| 34 | #include "../../kexec-elf.h" | ||
| 35 | |||
| 36 | diff --git a/kexec/arch/i386/kexec-elf-rel-x86.c b/kexec/arch/i386/kexec-elf-rel-x86.c | ||
| 37 | index 55a214e..e7583d1 100644 | ||
| 38 | --- a/kexec/arch/i386/kexec-elf-rel-x86.c | ||
| 39 | +++ b/kexec/arch/i386/kexec-elf-rel-x86.c | ||
| 40 | @@ -1,5 +1,5 @@ | ||
| 41 | #include <stdio.h> | ||
| 42 | -#include <elf.h> | ||
| 43 | +#include "../../../include/elf.h" | ||
| 44 | #include "../../kexec.h" | ||
| 45 | #include "../../kexec-elf.h" | ||
| 46 | |||
| 47 | diff --git a/kexec/arch/ppc/kexec-elf-rel-ppc.c b/kexec/arch/ppc/kexec-elf-rel-ppc.c | ||
| 48 | index 1acbd86..a60c66c 100644 | ||
| 49 | --- a/kexec/arch/ppc/kexec-elf-rel-ppc.c | ||
| 50 | +++ b/kexec/arch/ppc/kexec-elf-rel-ppc.c | ||
| 51 | @@ -1,5 +1,5 @@ | ||
| 52 | #include <stdio.h> | ||
| 53 | -#include <elf.h> | ||
| 54 | +#include "../../../include/elf.h" | ||
| 55 | #include "../../kexec.h" | ||
| 56 | #include "../../kexec-elf.h" | ||
| 57 | |||
| 58 | diff --git a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c | ||
| 59 | index 5f8e3f2..765bf6e 100644 | ||
| 60 | --- a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c | ||
| 61 | +++ b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c | ||
| 62 | @@ -1,5 +1,5 @@ | ||
| 63 | #include <stdio.h> | ||
| 64 | -#include <elf.h> | ||
| 65 | +#include "../../../include/elf.h" | ||
| 66 | #include <string.h> | ||
| 67 | #include "../../kexec.h" | ||
| 68 | #include "../../kexec-elf.h" | ||
| 69 | diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c | ||
| 70 | index 7fdde73..cd5d729 100644 | ||
| 71 | --- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c | ||
| 72 | +++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c | ||
| 73 | @@ -1,5 +1,5 @@ | ||
| 74 | #include <stdio.h> | ||
| 75 | -#include <elf.h> | ||
| 76 | +#include "../../../include/elf.h" | ||
| 77 | #include "../../kexec.h" | ||
| 78 | #include "../../kexec-elf.h" | ||
| 79 | |||
| 80 | diff --git a/kexec/kexec-elf-rel.c b/kexec/kexec-elf-rel.c | ||
| 81 | index 9a6e63d..a856636 100644 | ||
| 82 | --- a/kexec/kexec-elf-rel.c | ||
| 83 | +++ b/kexec/kexec-elf-rel.c | ||
| 84 | @@ -4,7 +4,7 @@ | ||
| 85 | #include <stdio.h> | ||
| 86 | #include <errno.h> | ||
| 87 | #include <stdlib.h> | ||
| 88 | -#include "elf.h" | ||
| 89 | +#include "../include/elf.h" | ||
| 90 | #include <boot/elf_boot.h> | ||
| 91 | #include "kexec.h" | ||
| 92 | #include "kexec-elf.h" | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0004-kexec-elf-exec.c-replace-with-our-err.h.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0004-kexec-elf-exec.c-replace-with-our-err.h.patch new file mode 100644 index 0000000000..1080e8bb56 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0004-kexec-elf-exec.c-replace-with-our-err.h.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | From 8b9da93ac9a4ea79ae953f80f6fe6e4f080341f2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Tue, 17 Apr 2018 10:57:23 +0200 | ||
| 4 | Subject: [PATCH] kexec-elf-exec.c: replace with our elf.h | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | kexec-elf-exec.c: In function 'elf_exec_load': | ||
| 9 | error: 'EM_AARCH64' undeclared | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [klibc specific] | ||
| 12 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 13 | |||
| 14 | --- | ||
| 15 | kexec/kexec-elf-exec.c | 2 +- | ||
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 17 | |||
| 18 | diff --git a/kexec/kexec-elf-exec.c b/kexec/kexec-elf-exec.c | ||
| 19 | index a9329ac..0dd0700 100644 | ||
| 20 | --- a/kexec/kexec-elf-exec.c | ||
| 21 | +++ b/kexec/kexec-elf-exec.c | ||
| 22 | @@ -4,7 +4,7 @@ | ||
| 23 | #include <stdio.h> | ||
| 24 | #include <errno.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | -#include "elf.h" | ||
| 27 | +#include "../include/elf.h" | ||
| 28 | #include <boot/elf_boot.h> | ||
| 29 | #include "kexec.h" | ||
| 30 | #include "kexec-elf.h" | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0005-crashdump-elf.c-work-around-for-sysconf-_SC_NPROCESS.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0005-crashdump-elf.c-work-around-for-sysconf-_SC_NPROCESS.patch new file mode 100644 index 0000000000..4f7506d44c --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0005-crashdump-elf.c-work-around-for-sysconf-_SC_NPROCESS.patch | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | From 1cfee75d9662c3382bb7cb8f1c952333837598ae Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Wed, 18 Apr 2018 02:21:30 +0200 | ||
| 4 | Subject: [PATCH] crashdump-elf.c: work around for _SC_NPROCESSORS_CONF | ||
| 5 | |||
| 6 | klibc sysconf lacks this so the implementation | ||
| 7 | of Linus Torvalds was taken (simplified): | ||
| 8 | |||
| 9 | https://sourceware.org/ml/libc-alpha/2011-06/msg00079.html | ||
| 10 | |||
| 11 | Have fun reding the thread! | ||
| 12 | |||
| 13 | Fix | ||
| 14 | |||
| 15 | crashdump-elf.c:117:21: error: '_SC_NPROCESSORS_CONF' undeclared | ||
| 16 | |||
| 17 | Upstream-Status: Inappropriate [klibc specific] | ||
| 18 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 19 | |||
| 20 | --- | ||
| 21 | kexec/crashdump-elf.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 22 | 1 file changed, 92 insertions(+) | ||
| 23 | |||
| 24 | diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c | ||
| 25 | index b8bb686..7e6767c 100644 | ||
| 26 | --- a/kexec/crashdump-elf.c | ||
| 27 | +++ b/kexec/crashdump-elf.c | ||
| 28 | @@ -25,6 +25,94 @@ do { \ | ||
| 29 | } while(0) | ||
| 30 | #endif | ||
| 31 | |||
| 32 | +#ifdef __KLIBC__ | ||
| 33 | +#ifndef KLIBC_SYSFS_CPU_H | ||
| 34 | +#define KLIBC_SYSFS_CPU_H | ||
| 35 | + | ||
| 36 | + | ||
| 37 | +static int __get_sysfs_cpus(const char *path); | ||
| 38 | +int __get_nprocs (void); | ||
| 39 | +int __get_nprocs_conf (void); | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 43 | +static int __get_sysfs_cpus(const char *path) | ||
| 44 | +{ | ||
| 45 | + FILE *file; | ||
| 46 | + int nr_cpus = 0; | ||
| 47 | + int prev = -1; | ||
| 48 | + char *p; | ||
| 49 | + char line[10]; | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + file = fopen(path, "r"); | ||
| 53 | + if (!file) | ||
| 54 | + return -1; | ||
| 55 | + for (;;) { | ||
| 56 | + char sep; | ||
| 57 | + int cpu; | ||
| 58 | + int n; | ||
| 59 | + | ||
| 60 | + /* int n = fscanf(file, "%u%c", &cpu, &sep); */ | ||
| 61 | + p = fgets(line, sizeof(line), file); | ||
| 62 | + if (p == NULL) | ||
| 63 | + return -1; | ||
| 64 | + else | ||
| 65 | + n = sscanf(line, "%u%c", &cpu, &sep); | ||
| 66 | + | ||
| 67 | + if (n <= 0) | ||
| 68 | + break; | ||
| 69 | + | ||
| 70 | + /* EOF == EOLN */ | ||
| 71 | + if (n == 1) | ||
| 72 | + sep = '\n'; | ||
| 73 | + | ||
| 74 | + /* Was the previous CPU a range? */ | ||
| 75 | + if (prev >= 0) { | ||
| 76 | + nr_cpus += cpu - prev + 1; | ||
| 77 | + prev = -1; | ||
| 78 | + } else if (sep == '-') | ||
| 79 | + prev = cpu; | ||
| 80 | + else | ||
| 81 | + nr_cpus++; | ||
| 82 | + | ||
| 83 | + if (sep == '\n') | ||
| 84 | + break; | ||
| 85 | + } | ||
| 86 | + fclose(file); | ||
| 87 | + return nr_cpus; | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +int __get_nprocs () | ||
| 91 | +{ | ||
| 92 | + long ret; | ||
| 93 | + static int cached = -1; | ||
| 94 | + | ||
| 95 | + ret = cached; | ||
| 96 | + if (ret < 0) | ||
| 97 | + { | ||
| 98 | + ret = __get_sysfs_cpus("/sys/devices/system/cpu/online"); | ||
| 99 | + cached = ret; | ||
| 100 | + } | ||
| 101 | + return ret; | ||
| 102 | +} | ||
| 103 | + | ||
| 104 | +int __get_nprocs_conf () | ||
| 105 | +{ | ||
| 106 | + long ret; | ||
| 107 | + static int cached = -1; | ||
| 108 | + | ||
| 109 | + ret = cached; | ||
| 110 | + if (ret < 0) | ||
| 111 | + { | ||
| 112 | + ret = __get_sysfs_cpus("/sys/devices/system/cpu/possible"); | ||
| 113 | + cached = ret; | ||
| 114 | + } | ||
| 115 | + return ret; | ||
| 116 | +} | ||
| 117 | +#endif | ||
| 118 | +#endif | ||
| 119 | + | ||
| 120 | /* Prepares the crash memory headers and stores in supplied buffer. */ | ||
| 121 | int FUNC(struct kexec_info *info, | ||
| 122 | struct crash_elf_info *elf_info, | ||
| 123 | @@ -46,7 +134,11 @@ int FUNC(struct kexec_info *info, | ||
| 124 | if (xen_present()) | ||
| 125 | nr_cpus = xen_get_nr_phys_cpus(); | ||
| 126 | else | ||
| 127 | +#ifndef __KLIBC__ | ||
| 128 | nr_cpus = sysconf(_SC_NPROCESSORS_CONF); | ||
| 129 | +#else | ||
| 130 | + nr_cpus = __get_nprocs_conf(); | ||
| 131 | +#endif | ||
| 132 | |||
| 133 | if (nr_cpus < 0) { | ||
| 134 | return -1; | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0006-kexec-syscall.h-work-around-missing-syscall-wrapper.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0006-kexec-syscall.h-work-around-missing-syscall-wrapper.patch new file mode 100644 index 0000000000..4a8968bcc6 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0006-kexec-syscall.h-work-around-missing-syscall-wrapper.patch | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | From e6aa1f18dc44dc71be3ceada2a96383d22454399 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Thu, 19 Apr 2018 00:25:01 +0200 | ||
| 4 | Subject: [PATCH] kexec-syscall.h: work around missing syscall() wrapper | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | kexec-syscall.h: In function 'kexec_load': | ||
| 9 | kexec-syscall.h:80:16: warning: implicit declaration of function 'syscall' | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [klibc specific] | ||
| 12 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 13 | |||
| 14 | --- | ||
| 15 | kexec/kexec-syscall.h | 8 ++++++++ | ||
| 16 | 1 file changed, 8 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h | ||
| 19 | index 33638c2..6b633e4 100644 | ||
| 20 | --- a/kexec/kexec-syscall.h | ||
| 21 | +++ b/kexec/kexec-syscall.h | ||
| 22 | @@ -77,7 +77,11 @@ struct kexec_segment; | ||
| 23 | static inline long kexec_load(void *entry, unsigned long nr_segments, | ||
| 24 | struct kexec_segment *segments, unsigned long flags) | ||
| 25 | { | ||
| 26 | +#ifndef __KLIBC__ | ||
| 27 | return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags); | ||
| 28 | +#else | ||
| 29 | + return (long) kexec_load(entry, nr_segments, segments, flags); | ||
| 30 | +#endif | ||
| 31 | } | ||
| 32 | |||
| 33 | static inline int is_kexec_file_load_implemented(void) { | ||
| 34 | @@ -90,8 +94,12 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd, | ||
| 35 | unsigned long cmdline_len, const char *cmdline_ptr, | ||
| 36 | unsigned long flags) | ||
| 37 | { | ||
| 38 | +#ifndef __KLIBC__ | ||
| 39 | return (long) syscall(__NR_kexec_file_load, kernel_fd, initrd_fd, | ||
| 40 | cmdline_len, cmdline_ptr, flags); | ||
| 41 | +#else | ||
| 42 | + return -1; | ||
| 43 | +#endif | ||
| 44 | } | ||
| 45 | |||
| 46 | #define KEXEC_ON_CRASH 0x00000001 | ||
| 47 | -- | ||
| 48 | 2.7.4 | ||
| 49 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0007-kexec.c-add-guard-around-ENOTSUP.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0007-kexec.c-add-guard-around-ENOTSUP.patch new file mode 100644 index 0000000000..3d44683936 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0007-kexec.c-add-guard-around-ENOTSUP.patch | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | From e6bd7a1bcfbd3e54efc81fbd7d60d915f9af0632 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Tue, 17 Apr 2018 11:35:14 +0200 | ||
| 4 | Subject: [PATCH] kexec.c: add guard around ENOTSUP | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | kexec.c: In function 'main': | ||
| 9 | kexec.c:1515:11: error: 'ENOTSUP' undeclared | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [klibc specific] | ||
| 12 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 13 | |||
| 14 | --- | ||
| 15 | kexec/kexec.c | 2 ++ | ||
| 16 | 1 file changed, 2 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/kexec/kexec.c b/kexec/kexec.c | ||
| 19 | index 313d9fe..b5a8a1e 100644 | ||
| 20 | --- a/kexec/kexec.c | ||
| 21 | +++ b/kexec/kexec.c | ||
| 22 | @@ -1501,6 +1501,7 @@ int main(int argc, char *argv[]) | ||
| 23 | */ | ||
| 24 | case -EINVAL: | ||
| 25 | case -ENOEXEC: | ||
| 26 | +#ifndef __KLIBC__ | ||
| 27 | /* | ||
| 28 | * ENOTSUP can be unsupported image | ||
| 29 | * type or unsupported PE signature | ||
| 30 | @@ -1513,6 +1514,7 @@ int main(int argc, char *argv[]) | ||
| 31 | * kernel bug | ||
| 32 | */ | ||
| 33 | case -ENOTSUP: | ||
| 34 | +#endif | ||
| 35 | do_kexec_file_syscall = 0; | ||
| 36 | break; | ||
| 37 | } | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0008-kexec.c-replace-mising-BLKGETSIZE64.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0008-kexec.c-replace-mising-BLKGETSIZE64.patch new file mode 100644 index 0000000000..cfc51cf7f3 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0008-kexec.c-replace-mising-BLKGETSIZE64.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From 12c7b09c3152f2b3475d081691a26bd1a5633256 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Tue, 17 Apr 2018 11:38:42 +0200 | ||
| 4 | Subject: [PATCH] kexec.c: replace missing BLKGETSIZE64 | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | kexec.c: In function 'slurp_file_generic': | ||
| 9 | kexec.c:564:19: error: 'BLKGETSIZE64' undeclared | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [klibc specific] | ||
| 12 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 13 | |||
| 14 | --- | ||
| 15 | kexec/kexec.c | 4 ++++ | ||
| 16 | 1 file changed, 4 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/kexec/kexec.c b/kexec/kexec.c | ||
| 19 | index b5a8a1e..7842f8b 100644 | ||
| 20 | --- a/kexec/kexec.c | ||
| 21 | +++ b/kexec/kexec.c | ||
| 22 | @@ -54,6 +54,10 @@ | ||
| 23 | #define KEXEC_LOADED_PATH "/sys/kernel/kexec_loaded" | ||
| 24 | #define KEXEC_CRASH_LOADED_PATH "/sys/kernel/kexec_crash_loaded" | ||
| 25 | |||
| 26 | +#ifndef BLKGETSIZE64 | ||
| 27 | +#define BLKGETSIZE64 _IOR(0x12,114,size_t) | ||
| 28 | +#endif | ||
| 29 | + | ||
| 30 | unsigned long long mem_min = 0; | ||
| 31 | unsigned long long mem_max = ULONG_MAX; | ||
| 32 | static unsigned long kexec_flags = 0; | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch new file mode 100644 index 0000000000..df980b118e --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | From ad598a71ffff6f86462211f252ac0c7b5de53869 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Tue, 17 Apr 2018 13:14:12 +0200 | ||
| 4 | Subject: [PATCH] vmcore-dmesg.c: work around missing imaxdiv() | ||
| 5 | |||
| 6 | Convert to integer arithmetic for klibc. | ||
| 7 | |||
| 8 | Fix | ||
| 9 | |||
| 10 | vmcore-dmesg.c: In function 'dump_dmesg_structured': | ||
| 11 | vmcore-dmesg.c:578:2: error: unknown type name 'imaxdiv_t' | ||
| 12 | |||
| 13 | Upstream-Status: Inappropriate [klibc specific] | ||
| 14 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 15 | |||
| 16 | --- | ||
| 17 | vmcore-dmesg/vmcore-dmesg.c | 13 ++++++++++++- | ||
| 18 | 1 file changed, 12 insertions(+), 1 deletion(-) | ||
| 19 | |||
| 20 | diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c | ||
| 21 | index e340ef4..1b27b71 100644 | ||
| 22 | --- a/vmcore-dmesg/vmcore-dmesg.c | ||
| 23 | +++ b/vmcore-dmesg/vmcore-dmesg.c | ||
| 24 | @@ -575,8 +575,11 @@ static void dump_dmesg_structured(int fd) | ||
| 25 | ssize_t ret; | ||
| 26 | char *msg; | ||
| 27 | uint16_t text_len; | ||
| 28 | +#ifndef __KLIBC__ | ||
| 29 | imaxdiv_t imaxdiv_sec, imaxdiv_usec; | ||
| 30 | - | ||
| 31 | +#else | ||
| 32 | + int64_t imaxdiv_sec, imaxdiv_usec; | ||
| 33 | +#endif | ||
| 34 | if (!log_buf_vaddr) { | ||
| 35 | fprintf(stderr, "Missing the log_buf symbol\n"); | ||
| 36 | exit(60); | ||
| 37 | @@ -645,12 +648,20 @@ static void dump_dmesg_structured(int fd) | ||
| 38 | exit(65); | ||
| 39 | } | ||
| 40 | ts_nsec = struct_val_u64(buf, log_offset_ts_nsec); | ||
| 41 | +#ifndef __KLIBC__ | ||
| 42 | imaxdiv_sec = imaxdiv(ts_nsec, 1000000000); | ||
| 43 | imaxdiv_usec = imaxdiv(imaxdiv_sec.rem, 1000); | ||
| 44 | |||
| 45 | len += sprintf(out_buf + len, "[%5llu.%06llu] ", | ||
| 46 | (long long unsigned int)imaxdiv_sec.quot, | ||
| 47 | (long long unsigned int)imaxdiv_usec.quot); | ||
| 48 | +#else | ||
| 49 | + imaxdiv_sec = ts_nsec / 1000000000; | ||
| 50 | + imaxdiv_usec = (ts_nsec % 1000000000) / 1000; | ||
| 51 | + len += sprintf(out_buf + len, "[%5llu.%06llu] ", | ||
| 52 | + (long long unsigned int)imaxdiv_sec, | ||
| 53 | + (long long unsigned int)imaxdiv_usec); | ||
| 54 | +#endif | ||
| 55 | |||
| 56 | /* escape non-printable characters */ | ||
| 57 | text_len = struct_val_u16(buf, log_offset_text_len); | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0010-fs2dt.c-work-around-missing-getline.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0010-fs2dt.c-work-around-missing-getline.patch new file mode 100644 index 0000000000..cff1485e5e --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0010-fs2dt.c-work-around-missing-getline.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | From edefda702d906d472ee7a675f6b506d5cfca7ac8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Tue, 17 Apr 2018 13:48:25 +0200 | ||
| 4 | Subject: [PATCH] fs2dt.c: work around missing getline() | ||
| 5 | |||
| 6 | This simple case can be rewrtten with fgets() | ||
| 7 | |||
| 8 | Fix | ||
| 9 | |||
| 10 | fs2dt.c: In function 'dt_copy_old_root_param': | ||
| 11 | fs2dt.c:541:6: warning: implicit declaration of function 'getline' | ||
| 12 | |||
| 13 | Upstream-Status: Inappropriate [klibc specific] | ||
| 14 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 15 | |||
| 16 | --- | ||
| 17 | kexec/fs2dt.c | 8 ++++++++ | ||
| 18 | 1 file changed, 8 insertions(+) | ||
| 19 | |||
| 20 | diff --git a/kexec/fs2dt.c b/kexec/fs2dt.c | ||
| 21 | index 07a5e2f..d635636 100644 | ||
| 22 | --- a/kexec/fs2dt.c | ||
| 23 | +++ b/kexec/fs2dt.c | ||
| 24 | @@ -531,6 +531,9 @@ static void dt_copy_old_root_param(void) | ||
| 25 | char *last_cmdline = NULL; | ||
| 26 | char *p, *old_param; | ||
| 27 | size_t len = 0; | ||
| 28 | +#ifdef __KLIBC__ | ||
| 29 | + char buf[512]; | ||
| 30 | +#endif | ||
| 31 | |||
| 32 | strcpy(filename, pathname); | ||
| 33 | strcat(filename, "bootargs"); | ||
| 34 | @@ -538,8 +541,13 @@ static void dt_copy_old_root_param(void) | ||
| 35 | if (!fp) | ||
| 36 | return; | ||
| 37 | |||
| 38 | +#ifndef __KLIBC__ | ||
| 39 | if (getline(&last_cmdline, &len, fp) == -1) | ||
| 40 | die("unable to read %s\n", filename); | ||
| 41 | +#else | ||
| 42 | + last_cmdline = fgets(buf, 200, fp); | ||
| 43 | + last_cmdline[strlen(last_cmdline) - 1] = '\0'; | ||
| 44 | +#endif | ||
| 45 | |||
| 46 | p = strstr(last_cmdline, "root="); | ||
| 47 | if (p) { | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0011-purgatory-Makefile-adapt-to-klcc.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0011-purgatory-Makefile-adapt-to-klcc.patch new file mode 100644 index 0000000000..0ae2be77de --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0011-purgatory-Makefile-adapt-to-klcc.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | From fa3844ce6ce95f2db142b6c77f077b3e704d4f6f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Tue, 17 Apr 2018 19:12:14 +0200 | ||
| 4 | Subject: [PATCH] purgatory Makefile: adapt to klcc | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [klibc specific] | ||
| 7 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 8 | |||
| 9 | --- | ||
| 10 | purgatory/Makefile | 9 +++++---- | ||
| 11 | 1 file changed, 5 insertions(+), 4 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/purgatory/Makefile b/purgatory/Makefile | ||
| 14 | index 49ce80a..da36075 100644 | ||
| 15 | --- a/purgatory/Makefile | ||
| 16 | +++ b/purgatory/Makefile | ||
| 17 | @@ -47,7 +47,7 @@ purgatory/sha256.o: $(srcdir)/util_lib/sha256.c | ||
| 18 | $(PURGATORY): CC=$(TARGET_CC) | ||
| 19 | $(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \ | ||
| 20 | $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ | ||
| 21 | - -Os -fno-builtin -ffreestanding \ | ||
| 22 | + -Os -fno-builtin -ffreestanding -nostdinc \ | ||
| 23 | -fno-zero-initialized-in-bss \ | ||
| 24 | -fno-PIC -fno-PIE -fno-stack-protector | ||
| 25 | |||
| 26 | @@ -59,13 +59,14 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ | ||
| 27 | -Iinclude \ | ||
| 28 | -I$(shell $(CC) -print-file-name=include) | ||
| 29 | $(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\ | ||
| 30 | - -Wl,--no-undefined -nostartfiles -nostdlib \ | ||
| 31 | + --no-undefined -nostartfiles -nostdlib \ | ||
| 32 | -nodefaultlibs -e purgatory_start -r \ | ||
| 33 | - -Wl,-Map=$(PURGATORY_MAP) | ||
| 34 | + -Map=$(PURGATORY_MAP) | ||
| 35 | |||
| 36 | $(PURGATORY): $(PURGATORY_OBJS) | ||
| 37 | $(MKDIR) -p $(@D) | ||
| 38 | - $(CC) $(CFLAGS) $(LDFLAGS) -o $@.sym $^ | ||
| 39 | +# $(CC) $(CFLAGS) -o $@.sym $^ | ||
| 40 | + $(LD) $(LDFLAGS) -o $@.sym $^ | ||
| 41 | # $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) | ||
| 42 | $(STRIP) --strip-debug -o $@ $@.sym | ||
| 43 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0012-purgatory-string.c-avoid-inclusion-of-string.h.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0012-purgatory-string.c-avoid-inclusion-of-string.h.patch new file mode 100644 index 0000000000..20934da898 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0012-purgatory-string.c-avoid-inclusion-of-string.h.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From 2d2ad16f9328a7cbb3f5b8479ae93eb923a0727f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Thu, 19 Apr 2018 00:28:14 +0200 | ||
| 4 | Subject: [PATCH] purgatory/string.c: avoid inclusion of string.h | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | purgatory/string.c:39:5: error: conflicting types for 'memcmp' | ||
| 9 | |||
| 10 | Upstream-Status: Inappropriate [klibc specific] | ||
| 11 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 12 | |||
| 13 | --- | ||
| 14 | purgatory/string.c | 2 ++ | ||
| 15 | 1 file changed, 2 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/purgatory/string.c b/purgatory/string.c | ||
| 18 | index f06c460..c5e978a 100644 | ||
| 19 | --- a/purgatory/string.c | ||
| 20 | +++ b/purgatory/string.c | ||
| 21 | @@ -1,5 +1,7 @@ | ||
| 22 | #include <stddef.h> | ||
| 23 | +#ifndef __KLIBC__ | ||
| 24 | #include <string.h> | ||
| 25 | +#endif | ||
| 26 | |||
| 27 | size_t strnlen(const char *s, size_t max) | ||
| 28 | { | ||
| 29 | -- | ||
| 30 | 2.7.4 | ||
| 31 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0013-sha256.h-avoid-inclusion-of-sys-types.h.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0013-sha256.h-avoid-inclusion-of-sys-types.h.patch new file mode 100644 index 0000000000..5d1664f76b --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0013-sha256.h-avoid-inclusion-of-sys-types.h.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | From ec6000b9f287e62cb0746e26cfa4372c7ea528f4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Thu, 19 Apr 2018 23:26:43 +0200 | ||
| 4 | Subject: [PATCH] sha256.h: avoid inclusion of sys/types.h | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | purgatory/printf.c:2:10: fatal error: limits.h: | ||
| 9 | No such file or directory | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [klibc specific] | ||
| 12 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 13 | |||
| 14 | --- | ||
| 15 | util_lib/include/sha256.h | 4 ++++ | ||
| 16 | 1 file changed, 4 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/util_lib/include/sha256.h b/util_lib/include/sha256.h | ||
| 19 | index 467fb22..40fd3ed 100644 | ||
| 20 | --- a/util_lib/include/sha256.h | ||
| 21 | +++ b/util_lib/include/sha256.h | ||
| 22 | @@ -1,7 +1,11 @@ | ||
| 23 | #ifndef SHA256_H | ||
| 24 | #define SHA256_H | ||
| 25 | |||
| 26 | +#ifndef __KLIBC__ | ||
| 27 | #include <sys/types.h> | ||
| 28 | +#else | ||
| 29 | +#include <stddef.h> | ||
| 30 | +#endif | ||
| 31 | #include <stdint.h> | ||
| 32 | |||
| 33 | typedef struct | ||
| 34 | -- | ||
| 35 | 2.7.4 | ||
| 36 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0014-add-if_nameindex-from-musl.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0014-add-if_nameindex-from-musl.patch new file mode 100644 index 0000000000..ad21266987 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0014-add-if_nameindex-from-musl.patch | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | From b15e9610b4ab52c381e712241d50dea96d50d873 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Wed, 2 May 2018 23:14:19 +0200 | ||
| 4 | Subject: [PATCH 14/14] add if_nameindex from musl | ||
| 5 | |||
| 6 | Taken from musl, minimal changes. | ||
| 7 | klibc lacks struct and func | ||
| 8 | |||
| 9 | Fix | ||
| 10 | |||
| 11 | ifdown.o: In function `ifdown': | ||
| 12 | ifdown.c (.text+0x30): undefined reference to `if_nameindex' | ||
| 13 | |||
| 14 | While there add klibc-specific guard and include sys/types.h | ||
| 15 | to fix : | ||
| 16 | |||
| 17 | /kexec/if_nameindex.c:2: | ||
| 18 | /usr/lib/klibc/include/linux/types.h:22:0: | ||
| 19 | warning: "__bitwise" redefined | ||
| 20 | #define __bitwise __bitwise__ | ||
| 21 | |||
| 22 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 23 | --- | ||
| 24 | kexec/Makefile | 2 +- | ||
| 25 | kexec/if_nameindex.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 26 | kexec/if_nameindex.h | 15 ++++++++++++ | ||
| 27 | kexec/ifdown.c | 3 +++ | ||
| 28 | 4 files changed, 83 insertions(+), 1 deletion(-) | ||
| 29 | create mode 100644 kexec/if_nameindex.c | ||
| 30 | create mode 100644 kexec/if_nameindex.h | ||
| 31 | |||
| 32 | diff --git a/kexec/Makefile b/kexec/Makefile | ||
| 33 | index 4db84d8..fb7520b 100644 | ||
| 34 | --- a/kexec/Makefile | ||
| 35 | +++ b/kexec/Makefile | ||
| 36 | @@ -11,7 +11,7 @@ KEXEC_SRCS = $(KEXEC_SRCS_base) | ||
| 37 | KEXEC_GENERATED_SRCS = | ||
| 38 | |||
| 39 | KEXEC_SRCS_base += kexec/kexec.c | ||
| 40 | -KEXEC_SRCS_base += kexec/ifdown.c | ||
| 41 | +KEXEC_SRCS_base += kexec/if_nameindex kexec/ifdown.c | ||
| 42 | KEXEC_SRCS_base += kexec/kexec-elf.c | ||
| 43 | KEXEC_SRCS_base += kexec/kexec-elf-exec.c | ||
| 44 | KEXEC_SRCS_base += kexec/kexec-elf-core.c | ||
| 45 | diff --git a/kexec/if_nameindex.c b/kexec/if_nameindex.c | ||
| 46 | new file mode 100644 | ||
| 47 | index 0000000..e586e41 | ||
| 48 | --- /dev/null | ||
| 49 | +++ b/kexec/if_nameindex.c | ||
| 50 | @@ -0,0 +1,64 @@ | ||
| 51 | +#define _GNU_SOURCE | ||
| 52 | +#ifdef __KLIBC__ | ||
| 53 | +#include <sys/types.h> | ||
| 54 | +#endif | ||
| 55 | +#include <netinet/in.h> | ||
| 56 | +#include <net/if.h> | ||
| 57 | +#include <stdlib.h> | ||
| 58 | +#include <sys/socket.h> | ||
| 59 | +#include <sys/ioctl.h> | ||
| 60 | +#include <errno.h> | ||
| 61 | +#include <sys/syscall.h> | ||
| 62 | +#include <stdio.h> | ||
| 63 | +#ifdef __KLIBC__ | ||
| 64 | +#include "if_nameindex.h" | ||
| 65 | +#endif | ||
| 66 | + | ||
| 67 | +static void *do_nameindex(int s, size_t n) | ||
| 68 | +{ | ||
| 69 | + size_t i, len, k; | ||
| 70 | + struct ifconf conf; | ||
| 71 | + struct if_nameindex *idx; | ||
| 72 | + | ||
| 73 | + idx = malloc(n * (sizeof(struct if_nameindex)+sizeof(struct ifreq))); | ||
| 74 | + if (!idx) return 0; | ||
| 75 | + | ||
| 76 | + conf.ifc_buf = (void *)&idx[n]; | ||
| 77 | + conf.ifc_len = len = n * sizeof(struct ifreq); | ||
| 78 | + if (ioctl(s, SIOCGIFCONF, &conf) < 0) { | ||
| 79 | + free(idx); | ||
| 80 | + return 0; | ||
| 81 | + } | ||
| 82 | + if (conf.ifc_len == len) { | ||
| 83 | + free(idx); | ||
| 84 | + return (void *)-1; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + n = conf.ifc_len / sizeof(struct ifreq); | ||
| 88 | + for (i=k=0; i<n; i++) { | ||
| 89 | + if (ioctl(s, SIOCGIFINDEX, &conf.ifc_req[i]) < 0) { | ||
| 90 | + k++; | ||
| 91 | + continue; | ||
| 92 | + } | ||
| 93 | + idx[i-k].if_index = conf.ifc_req[i].ifr_ifindex; | ||
| 94 | + idx[i-k].if_name = conf.ifc_req[i].ifr_name; | ||
| 95 | + } | ||
| 96 | + idx[i-k].if_name = 0; | ||
| 97 | + idx[i-k].if_index = 0; | ||
| 98 | + | ||
| 99 | + return idx; | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +struct if_nameindex *if_nameindex() | ||
| 103 | +{ | ||
| 104 | + size_t n; | ||
| 105 | + void *p = 0; | ||
| 106 | + int s = socket(AF_UNIX, SOCK_DGRAM, 0); | ||
| 107 | + if (s>=0) { | ||
| 108 | + for (n=0; (p=do_nameindex(s, n)) == (void *)-1; n++); | ||
| 109 | +/* __syscall(SYS_close, s); */ | ||
| 110 | + close(s); | ||
| 111 | + } | ||
| 112 | + errno = ENOBUFS; | ||
| 113 | + return p; | ||
| 114 | +} | ||
| 115 | diff --git a/kexec/if_nameindex.h b/kexec/if_nameindex.h | ||
| 116 | new file mode 100644 | ||
| 117 | index 0000000..1725fbd | ||
| 118 | --- /dev/null | ||
| 119 | +++ b/kexec/if_nameindex.h | ||
| 120 | @@ -0,0 +1,15 @@ | ||
| 121 | +#ifndef _NET_IF__NAMEINDEX_H | ||
| 122 | +#define _NET_IF_NAMEINDEX_H | ||
| 123 | + | ||
| 124 | +struct if_nameindex | ||
| 125 | +{ | ||
| 126 | + unsigned int if_index; | ||
| 127 | + char *if_name; | ||
| 128 | +}; | ||
| 129 | + | ||
| 130 | +unsigned int if_nametoindex (const char *); | ||
| 131 | +char *if_indextoname (unsigned int, char *); | ||
| 132 | +struct if_nameindex *if_nameindex (void); | ||
| 133 | +void if_freenameindex (struct if_nameindex *); | ||
| 134 | + | ||
| 135 | +#endif | ||
| 136 | diff --git a/kexec/ifdown.c b/kexec/ifdown.c | ||
| 137 | index 82c6141..cc3ca9f 100644 | ||
| 138 | --- a/kexec/ifdown.c | ||
| 139 | +++ b/kexec/ifdown.c | ||
| 140 | @@ -18,6 +18,9 @@ char *v_ifdown = "@(#)ifdown.c 1.11 02-Jun-1998 miquels@cistron.nl"; | ||
| 141 | |||
| 142 | #include <netinet/in.h> | ||
| 143 | #include <net/if.h> | ||
| 144 | +#ifdef __KLIBC__ | ||
| 145 | +#include "if_nameindex.h" | ||
| 146 | +#endif | ||
| 147 | |||
| 148 | /* | ||
| 149 | * First, we find all shaper devices and down them. Then we | ||
| 150 | -- | ||
| 151 | 2.7.4 | ||
| 152 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0015-vmcore-dmesg-fix-warning.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0015-vmcore-dmesg-fix-warning.patch new file mode 100644 index 0000000000..0b88b94c6e --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0015-vmcore-dmesg-fix-warning.patch | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | From 3294266c6a875c5009065c1ae5d0b86200c4147c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Sun, 29 Apr 2018 00:52:31 +0200 | ||
| 4 | Subject: [PATCH 6/6] vmcore-dmesg: fix warning | ||
| 5 | |||
| 6 | # define __bitwise | ||
| 7 | |||
| 8 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 9 | --- | ||
| 10 | vmcore-dmesg/vmcore-dmesg.c | 3 +++ | ||
| 11 | 1 file changed, 3 insertions(+) | ||
| 12 | |||
| 13 | diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c | ||
| 14 | index e340ef4..91e4789 100644 | ||
| 15 | --- a/vmcore-dmesg/vmcore-dmesg.c | ||
| 16 | +++ b/vmcore-dmesg/vmcore-dmesg.c | ||
| 17 | @@ -2,6 +2,9 @@ | ||
| 18 | #define _GNU_SOURCE | ||
| 19 | #define _LARGEFILE_SOURCE 1 | ||
| 20 | #define _FILE_OFFSET_BITS 64 | ||
| 21 | +#ifdef __KLIBC__ | ||
| 22 | +#include <sys/types.h> | ||
| 23 | +#endif | ||
| 24 | #include <endian.h> | ||
| 25 | #include <byteswap.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | -- | ||
| 28 | 2.7.4 | ||
| 29 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64-crashdump-arm64.c-fix-warning.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64-crashdump-arm64.c-fix-warning.patch new file mode 100644 index 0000000000..24be4dd76d --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64-crashdump-arm64.c-fix-warning.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | From 6f69f489a442b3a192e4c08748ee8c4d31c75dae Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Sun, 29 Apr 2018 00:46:16 +0200 | ||
| 4 | Subject: [PATCH 5/6] arm64: crashdump-arm64.c: fix warning | ||
| 5 | |||
| 6 | from ../git/kexec/kexec.h:6, | ||
| 7 | from ../git/kexec/arch/arm64/crashdump-arm64.c:18: | ||
| 8 | /tmp/build/tmp-musl/work/aarch64-oe-linux-musl/kexec-tools-klibc/0.6+gitAUTOINC+ | ||
| 9 | 0481e9ed61-r0/recipe-sysroot/usr/lib/klibc/include/klibc/compiler.h:144:0: warni | ||
| 10 | ng: "__bitwise" redefined | ||
| 11 | # define __bitwise | ||
| 12 | |||
| 13 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 14 | --- | ||
| 15 | kexec/arch/arm64/crashdump-arm64.c | 3 +++ | ||
| 16 | 1 file changed, 3 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c | ||
| 19 | index 4fd7aa8..890d88f 100644 | ||
| 20 | --- a/kexec/arch/arm64/crashdump-arm64.c | ||
| 21 | +++ b/kexec/arch/arm64/crashdump-arm64.c | ||
| 22 | @@ -13,6 +13,9 @@ | ||
| 23 | #define _GNU_SOURCE | ||
| 24 | |||
| 25 | #include <errno.h> | ||
| 26 | +#ifdef __KLIBC__ | ||
| 27 | +#include <sys/types.h> | ||
| 28 | +#endif | ||
| 29 | #include <linux/elf.h> | ||
| 30 | |||
| 31 | #include "kexec.h" | ||
| 32 | -- | ||
| 33 | 2.7.4 | ||
| 34 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-image-header.h-add-missing-le64toh.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-image-header.h-add-missing-le64toh.patch new file mode 100644 index 0000000000..7decbac4fb --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-image-header.h-add-missing-le64toh.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | From af7d06a753a4c377b7ffe587da67a6ba56048bea Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Thu, 19 Apr 2018 10:47:17 +0200 | ||
| 4 | Subject: [PATCH 2/2] kexec/arm64: image-header.h: add macro for le64toh | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | kexec-arm64.c:(.text+0x370): undefined reference to `le64toh' | ||
| 9 | kexec-arm64.c:(.text+0x380): undefined reference to `le64toh' | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [klibc specific] | ||
| 12 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 13 | |||
| 14 | --- | ||
| 15 | kexec/arch/arm64/image-header.h | 9 +++++++++ | ||
| 16 | 1 file changed, 9 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/kexec/arch/arm64/image-header.h b/kexec/arch/arm64/image-header.h | ||
| 19 | index 158d411..10ed2d6 100644 | ||
| 20 | --- a/kexec/arch/arm64/image-header.h | ||
| 21 | +++ b/kexec/arch/arm64/image-header.h | ||
| 22 | @@ -8,6 +8,15 @@ | ||
| 23 | #include <endian.h> | ||
| 24 | #include <stdint.h> | ||
| 25 | |||
| 26 | +#ifdef __KLIBC__ | ||
| 27 | +#if __BYTE_ORDER == __LITTLE_ENDIAN | ||
| 28 | +#define le64toh(x) (x) | ||
| 29 | +#endif | ||
| 30 | +#if __BYTE_ORDER == __BIG_ENDIAN | ||
| 31 | +#define le64toh(x) __bswap_64(x) | ||
| 32 | +#endif | ||
| 33 | +#endif | ||
| 34 | + | ||
| 35 | /** | ||
| 36 | * struct arm64_image_header - arm64 kernel image header. | ||
| 37 | * | ||
| 38 | -- | ||
| 39 | 2.7.4 | ||
| 40 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_purgatory-Makefile-remove-unknown-flags.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_purgatory-Makefile-remove-unknown-flags.patch new file mode 100644 index 0000000000..f87f4334d7 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_purgatory-Makefile-remove-unknown-flags.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | From 1ceca8645dbe2780e1b8993c80de772993fe3053 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Thu, 19 Apr 2018 10:43:34 +0200 | ||
| 4 | Subject: [PATCH 1/2] purgatory/arm64: Makefile: remove unknown flags for arm64 | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | | aarch64-oe-linux-musl-ld: unrecognised emulation mode: cmodel=large | ||
| 9 | | Supported emulations: aarch64linux aarch64elf aarch64elf32 | ||
| 10 | aarch64elf32b aarch64elfb armelf armelfb aarch64linuxb aarch64linux32 | ||
| 11 | aarch64linux32b armelfb_linux_eabi armelf_linux_eabi | ||
| 12 | |||
| 13 | Upstream-Status: Inappropriate [klibc specific] | ||
| 14 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 15 | |||
| 16 | --- | ||
| 17 | purgatory/arch/arm64/Makefile | 20 ++++++++++---------- | ||
| 18 | 1 file changed, 10 insertions(+), 10 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/purgatory/arch/arm64/Makefile b/purgatory/arch/arm64/Makefile | ||
| 21 | index 636abea..ddc9461 100644 | ||
| 22 | --- a/purgatory/arch/arm64/Makefile | ||
| 23 | +++ b/purgatory/arch/arm64/Makefile | ||
| 24 | @@ -1,13 +1,13 @@ | ||
| 25 | |||
| 26 | -arm64_PURGATORY_EXTRA_CFLAGS = \ | ||
| 27 | - -mcmodel=large \ | ||
| 28 | - -fno-PIC \ | ||
| 29 | - -fno-stack-protector \ | ||
| 30 | - -fno-asynchronous-unwind-tables \ | ||
| 31 | - -Wundef \ | ||
| 32 | - -Werror-implicit-function-declaration \ | ||
| 33 | - -Wdeclaration-after-statement \ | ||
| 34 | - -Werror=implicit-int \ | ||
| 35 | - -Werror=strict-prototypes | ||
| 36 | +#arm64_PURGATORY_EXTRA_CFLAGS = \ | ||
| 37 | +# -mcmodel=large \ | ||
| 38 | +# -fno-PIC \ | ||
| 39 | +# -fno-stack-protector \ | ||
| 40 | +# -fno-asynchronous-unwind-tables \ | ||
| 41 | +# -Wundef \ | ||
| 42 | +# -Werror-implicit-function-declaration \ | ||
| 43 | +# -Wdeclaration-after-statement \ | ||
| 44 | +# -Werror=implicit-int \ | ||
| 45 | +# -Werror=strict-prototypes | ||
| 46 | |||
| 47 | arm64_PURGATORY_SRCS += \ | ||
| 48 | purgatory/arch/arm64/entry.S \ | ||
| 49 | -- | ||
| 50 | 2.7.4 | ||
| 51 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm_crashdump.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm_crashdump.patch new file mode 100644 index 0000000000..95962636e5 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm_crashdump.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From 6dae4752a53973c152b3e91e8a4ca74a486dae8b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: OpenEmbedded <oe.patch@oe> | ||
| 3 | Date: Wed, 11 Apr 2018 22:51:00 +0200 | ||
| 4 | Subject: [PATCH] use our elf.h header | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | kexec/arch/arm/crashdump-arm.c:70:13: error: 'EM_ARM' undeclared here | ||
| 9 | (not in a function); did you mean 'EM_860'? | ||
| 10 | .machine = EM_ARM, | ||
| 11 | |||
| 12 | Upstream-Status: Inappropriate [klibc specific] | ||
| 13 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 14 | |||
| 15 | --- | ||
| 16 | kexec/arch/arm/crashdump-arm.c | 2 +- | ||
| 17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c | ||
| 20 | index daa4788..2530b29 100644 | ||
| 21 | --- a/kexec/arch/arm/crashdump-arm.c | ||
| 22 | +++ b/kexec/arch/arm/crashdump-arm.c | ||
| 23 | @@ -21,7 +21,7 @@ | ||
| 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 25 | */ | ||
| 26 | #include <limits.h> | ||
| 27 | -#include <elf.h> | ||
| 28 | +#include "../../../include/elf.h" | ||
| 29 | #include <errno.h> | ||
| 30 | #include <stdio.h> | ||
| 31 | #include <stdlib.h> | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/powerpc-purgatory-Makefile-remove-unknown-flags.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/powerpc-purgatory-Makefile-remove-unknown-flags.patch new file mode 100644 index 0000000000..c3b2071bcd --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/powerpc-purgatory-Makefile-remove-unknown-flags.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | From 709dfe457c07aa0275f3da14634cbce5cf1029dc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Thu, 19 Apr 2018 19:26:53 +0200 | ||
| 4 | Subject: [PATCH 3/3] powerpc/purgatory: Makefile: remove unknown flags for | ||
| 5 | powerpc | ||
| 6 | |||
| 7 | Fix | ||
| 8 | |||
| 9 | powerpc-oe-linux-musl-ld: unrecognised emulation mode: soft-float | ||
| 10 | Supported emulations: elf32ppclinux elf32ppc elf32ppcsim elf32lppclinux | ||
| 11 | elf32lppc elf32lppcsim elf64ppc elf64lppc | ||
| 12 | |||
| 13 | Upstream-Status: Inappropriate [klibc specific] | ||
| 14 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 15 | --- | ||
| 16 | purgatory/arch/ppc/Makefile | 2 +- | ||
| 17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/purgatory/arch/ppc/Makefile b/purgatory/arch/ppc/Makefile | ||
| 20 | index c85c58a..cd44a16 100644 | ||
| 21 | --- a/purgatory/arch/ppc/Makefile | ||
| 22 | +++ b/purgatory/arch/ppc/Makefile | ||
| 23 | @@ -7,7 +7,7 @@ ppc_PURGATORY_SRCS += purgatory/arch/ppc/misc.S | ||
| 24 | ppc_PURGATORY_SRCS += purgatory/arch/ppc/purgatory-ppc.c | ||
| 25 | ppc_PURGATORY_SRCS += purgatory/arch/ppc/console-ppc.c | ||
| 26 | |||
| 27 | -ppc_PURGATORY_EXTRA_CFLAGS += -msoft-float | ||
| 28 | +#ppc_PURGATORY_EXTRA_CFLAGS += -msoft-float | ||
| 29 | |||
| 30 | dist += purgatory/arch/ppc/Makefile $(ppc_PURGATORY_SRCS) \ | ||
| 31 | purgatory/arch/ppc/purgatory-ppc.h purgatory/arch/ppc/ppc_asm.h | ||
| 32 | -- | ||
| 33 | 2.7.4 | ||
| 34 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86-64-purgatory-Makefile-remove-unknown-flags.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86-64-purgatory-Makefile-remove-unknown-flags.patch new file mode 100644 index 0000000000..f1db75741a --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86-64-purgatory-Makefile-remove-unknown-flags.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From 9453599fd833794fb5d87cab2622de286144ed54 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Wed, 18 Apr 2018 22:30:17 +0200 | ||
| 4 | Subject: [PATCH 6/6] purgatory: Makefile: remove unknown flags | ||
| 5 | |||
| 6 | Fix | ||
| 7 | |||
| 8 | x86_64-oe-linux-musl-ld: unrecognised emulation mode: cmodel=large | ||
| 9 | Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu | ||
| 10 | i386linux elf_l1om elf_k1om | ||
| 11 | ../kexec-tools-2.0.17-rc1/purgatory/Makefile:67: | ||
| 12 | recipe for target 'purgatory/purgatory.ro' failed | ||
| 13 | |||
| 14 | Upstream-Status: Inappropriate [embedded specific] | ||
| 15 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 16 | |||
| 17 | --- | ||
| 18 | purgatory/arch/x86_64/Makefile | 2 +- | ||
| 19 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 20 | |||
| 21 | diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile | ||
| 22 | index 7300937..38f0bf3 100644 | ||
| 23 | --- a/purgatory/arch/x86_64/Makefile | ||
| 24 | +++ b/purgatory/arch/x86_64/Makefile | ||
| 25 | @@ -23,4 +23,4 @@ x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c | ||
| 26 | x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c | ||
| 27 | x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c | ||
| 28 | |||
| 29 | -x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large | ||
| 30 | +#x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large | ||
| 31 | -- | ||
| 32 | 2.7.4 | ||
| 33 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_basename.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_basename.patch new file mode 100644 index 0000000000..0d0ed23c90 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_basename.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | From 5f47c30759684cea9a7a409646686c1a358b78ac Mon Sep 17 00:00:00 2001 | ||
| 2 | From: OpenEmbedded <oe.patch@oe> | ||
| 3 | Date: Wed, 11 Apr 2018 22:51:05 +0200 | ||
| 4 | Subject: [PATCH] replace basename() with sscanf() | ||
| 5 | |||
| 6 | klibc lacks basename() | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [klibc specific] | ||
| 9 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 10 | |||
| 11 | --- | ||
| 12 | kexec/arch/i386/x86-linux-setup.c | 4 ++-- | ||
| 13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c | ||
| 16 | index 6c7d260..7850083 100644 | ||
| 17 | --- a/kexec/arch/i386/x86-linux-setup.c | ||
| 18 | +++ b/kexec/arch/i386/x86-linux-setup.c | ||
| 19 | @@ -304,9 +304,9 @@ static int add_edd_entry(struct x86_linux_param_header *real_mode, | ||
| 20 | memset(edd_info, 0, sizeof(struct edd_info)); | ||
| 21 | |||
| 22 | /* extract the device number */ | ||
| 23 | - if (sscanf(basename(sysfs_name), "int13_dev%hhx", &devnum) != 1) { | ||
| 24 | + if (sscanf(strrchr(sysfs_name,'/') + 1, "int13_dev%hhx", &devnum) != 1) { | ||
| 25 | fprintf(stderr, "Invalid format of int13_dev dir " | ||
| 26 | - "entry: %s\n", basename(sysfs_name)); | ||
| 27 | + "entry: %s\n", strrchr(sysfs_name,'/') + 1); | ||
| 28 | return -1; | ||
| 29 | } | ||
| 30 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_kexec_test.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_kexec_test.patch new file mode 100644 index 0000000000..b7d7c1039c --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_kexec_test.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | From 9de68ec5af8db2eff352f12da28145fe5e96244d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: OpenEmbedded <oe.patch@oe> | ||
| 3 | Date: Wed, 11 Apr 2018 22:51:05 +0200 | ||
| 4 | Subject: [PATCH] do not build test | ||
| 5 | |||
| 6 | The purpose of this recipe is to build the smallest | ||
| 7 | binaries. kexek klibc-static for armv5 is around 86 KiB | ||
| 8 | |||
| 9 | Upstream-Status: Inappropriate [embedded specific] | ||
| 10 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 11 | |||
| 12 | --- | ||
| 13 | Makefile.in | 4 ++-- | ||
| 14 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/Makefile.in b/Makefile.in | ||
| 17 | index 79188d8..953c141 100644 | ||
| 18 | --- a/Makefile.in | ||
| 19 | +++ b/Makefile.in | ||
| 20 | @@ -178,8 +178,8 @@ PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s)) | ||
| 21 | PGSRCS:=$(foreach s, $(GENERATED_SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s)) | ||
| 22 | |||
| 23 | MAN_PAGES:=$(KEXEC_MANPAGE) $(KDUMP_MANPAGE) $(VMCORE_DMESG_MANPAGE) | ||
| 24 | -BINARIES_i386:=$(KEXEC_TEST) | ||
| 25 | -BINARIES_x86_64:=$(KEXEC_TEST) | ||
| 26 | +BINARIES_i386:=$(SBINDIR)/kexec | ||
| 27 | +BINARIES_x86_64:=$(SBINDIR)/kexec | ||
| 28 | BINARIES:=$(KEXEC) $(KDUMP) $(VMCORE_DMESG) $(BINARIES_$(ARCH)) | ||
| 29 | |||
| 30 | TARGETS:=$(BINARIES) $(MAN_PAGES) | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_sys_io.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_sys_io.patch new file mode 100644 index 0000000000..493f298a99 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_sys_io.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | From a992ee014efacdc98d5658be9930dcab0eaadfd7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: OpenEmbedded <oe.patch@oe> | ||
| 3 | Date: Wed, 11 Apr 2018 22:51:04 +0200 | ||
| 4 | Subject: [PATCH] i386: replace with our io.h | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [klibc specific] | ||
| 7 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 8 | |||
| 9 | --- | ||
| 10 | purgatory/arch/i386/pic.c | 2 +- | ||
| 11 | purgatory/arch/i386/vga.c | 2 +- | ||
| 12 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/purgatory/arch/i386/pic.c b/purgatory/arch/i386/pic.c | ||
| 15 | index c23c459..c5f7046 100644 | ||
| 16 | --- a/purgatory/arch/i386/pic.c | ||
| 17 | +++ b/purgatory/arch/i386/pic.c | ||
| 18 | @@ -16,7 +16,7 @@ | ||
| 19 | * along with this program; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 21 | */ | ||
| 22 | -#include <sys/io.h> | ||
| 23 | +#include "include/arch/io.h" | ||
| 24 | #include <purgatory.h> | ||
| 25 | #include "purgatory-x86.h" | ||
| 26 | |||
| 27 | diff --git a/purgatory/arch/i386/vga.c b/purgatory/arch/i386/vga.c | ||
| 28 | index e65976c..d079d96 100644 | ||
| 29 | --- a/purgatory/arch/i386/vga.c | ||
| 30 | +++ b/purgatory/arch/i386/vga.c | ||
| 31 | @@ -1,4 +1,4 @@ | ||
| 32 | -#include <sys/io.h> | ||
| 33 | +#include "include/arch/io.h" | ||
| 34 | #include <purgatory.h> | ||
| 35 | #include "purgatory-x86.h" | ||
| 36 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_vfscanf.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_vfscanf.patch new file mode 100644 index 0000000000..2f0ad2ea45 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/x86_vfscanf.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | From 423c3f6f41fe04f4512e2a97a130f072d53dd4cf Mon Sep 17 00:00:00 2001 | ||
| 2 | From: OpenEmbedded <oe.patch@oe> | ||
| 3 | Date: Wed, 11 Apr 2018 22:51:05 +0200 | ||
| 4 | Subject: [PATCH] x86-linux-setup.c: replace vfscanf() with vsscanf() | ||
| 5 | |||
| 6 | klibc lacks vfscanf() | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [klibc specific] | ||
| 9 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 10 | |||
| 11 | --- | ||
| 12 | kexec/arch/i386/x86-linux-setup.c | 11 ++++++++++- | ||
| 13 | 1 file changed, 10 insertions(+), 1 deletion(-) | ||
| 14 | |||
| 15 | diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c | ||
| 16 | index 7850083..e190356 100644 | ||
| 17 | --- a/kexec/arch/i386/x86-linux-setup.c | ||
| 18 | +++ b/kexec/arch/i386/x86-linux-setup.c | ||
| 19 | @@ -200,6 +200,8 @@ static int file_scanf(const char *dir, const char *file, const char *scanf_line, | ||
| 20 | FILE *fp; | ||
| 21 | int retno; | ||
| 22 | char filename[PATH_MAX]; | ||
| 23 | + long line_size = MAX_LINE; | ||
| 24 | + char *line; | ||
| 25 | |||
| 26 | snprintf(filename, PATH_MAX, "%s/%s", dir, file); | ||
| 27 | filename[PATH_MAX-1] = 0; | ||
| 28 | @@ -210,7 +212,14 @@ static int file_scanf(const char *dir, const char *file, const char *scanf_line, | ||
| 29 | } | ||
| 30 | |||
| 31 | va_start(argptr, scanf_line); | ||
| 32 | - retno = vfscanf(fp, scanf_line, argptr); | ||
| 33 | + | ||
| 34 | + line = xmalloc(sizeof(line) * line_size); | ||
| 35 | + while(fgets(line, sizeof(line), fp) != NULL ) { | ||
| 36 | + line_size += MAX_LINE; | ||
| 37 | + line = xrealloc(line,line_size); | ||
| 38 | + } | ||
| 39 | + retno = vsscanf(line, scanf_line, argptr); | ||
| 40 | + | ||
| 41 | va_end(argptr); | ||
| 42 | |||
| 43 | fclose(fp); | ||
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 deleted file mode 100644 index 2e2703382a..0000000000 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_2.0.2.bb +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | # the binaries are statically linked against klibc | ||
| 2 | SUMMARY = "Kexec tools, statically compiled against klibc" | ||
| 3 | AUTHOR = "Eric Biederman" | ||
| 4 | HOMEPAGE = "http://kernel.org/pub/linux/utils/kernel/kexec/" | ||
| 5 | SECTION = "kernel/userland" | ||
| 6 | LICENSE = "GPLv2" | ||
| 7 | LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \ | ||
| 8 | file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09" | ||
| 9 | DEPENDS = "zlib xz" | ||
| 10 | |||
| 11 | PR = "r1" | ||
| 12 | |||
| 13 | inherit klibc autotools | ||
| 14 | |||
| 15 | FILESPATH =. "${FILE_DIRNAME}/kexec-tools-${PV}:" | ||
| 16 | |||
| 17 | SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz" | ||
| 18 | |||
| 19 | SRC_URI += " \ | ||
| 20 | file://kexec-elf-rel.patch \ | ||
| 21 | file://kexec-syscall.patch \ | ||
| 22 | file://cflags_static.patch \ | ||
| 23 | file://ifdown_errno.patch \ | ||
| 24 | file://purgatory_flags.patch \ | ||
| 25 | file://purgatory_string.patch \ | ||
| 26 | file://sha256.patch \ | ||
| 27 | file://sysconf_nrprocessors.patch \ | ||
| 28 | file://fix-out-of-tree-build.patch \ | ||
| 29 | file://0001-Adjust-the-order-of-headers-to-fix-build-for-musl.patch \ | ||
| 30 | " | ||
| 31 | |||
| 32 | SRC_URI[md5sum] = "92eff93b097475b7767f8c98df84408a" | ||
| 33 | SRC_URI[sha256sum] = "09e180ff36dee087182cdc939ba6c6917b6adbb5fc12d589f31fd3659b6471f2" | ||
| 34 | |||
| 35 | SRC_URI_append_arm = " file://arm_crashdump.patch" | ||
| 36 | SRC_URI_append_powerpc = " file://ppc__lshrdi3.patch" | ||
| 37 | SRC_URI_append_x86 = " file://x86_sys_io.patch file://x86_basename.patch file://x86_vfscanf.patch file://x86_kexec_test.patch" | ||
| 38 | SRC_URI_append_x86-64 = " file://x86_sys_io.patch file://x86_basename.patch file://x86_vfscanf.patch file://x86_kexec_test.patch" | ||
| 39 | |||
| 40 | S = "${WORKDIR}/kexec-tools-${PV}" | ||
| 41 | |||
| 42 | EXTRA_OECONF += "--without-zlib --without-lzma --without-xen" | ||
| 43 | |||
| 44 | CFLAGS += "-I${STAGING_DIR_HOST}${libdir}/klibc/include -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits32" | ||
| 45 | CFLAGS_x86-64 += "-I${STAGING_DIR_HOST}${libdir}/klibc/include -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits64" | ||
| 46 | |||
| 47 | do_compile_prepend() { | ||
| 48 | # Remove the prepackaged config.h from the source tree as it overrides | ||
| 49 | # the same file generated by configure and placed in the build tree | ||
| 50 | rm -f ${S}/include/config.h | ||
| 51 | |||
| 52 | # Remove the '*.d' file to make sure the recompile is OK | ||
| 53 | for dep in `find ${B} -type f -name '*.d'`; do | ||
| 54 | dep_no_d="`echo $dep | sed 's#.d$##'`" | ||
| 55 | # Remove file.d when there is a file.o | ||
| 56 | if [ -f "$dep_no_d.o" ]; then | ||
| 57 | rm -f $dep | ||
| 58 | fi | ||
| 59 | done | ||
| 60 | } | ||
| 61 | |||
| 62 | PACKAGES =+ "kexec-klibc kdump-klibc" | ||
| 63 | |||
| 64 | FILES_kexec-klibc = "${sbindir}/kexec" | ||
| 65 | FILES_kdump-klibc = "${sbindir}/kdump" | ||
| 66 | |||
| 67 | INSANE_SKIP_${PN} = "arch" | ||
| 68 | |||
| 69 | COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|powerpc.*|mips.*)-(linux|freebsd.*)' | ||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb new file mode 100644 index 0000000000..14edec2d12 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | # the binaries are statically linked against klibc | ||
| 2 | SUMMARY = "Kexec tools, statically compiled against klibc" | ||
| 3 | AUTHOR = "Eric Biederman" | ||
| 4 | HOMEPAGE = "http://kernel.org/pub/linux/utils/kernel/kexec/" | ||
| 5 | SECTION = "kernel/userland" | ||
| 6 | LICENSE = "GPLv2" | ||
| 7 | LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \ | ||
| 8 | file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09" | ||
| 9 | PV = "2.0.17+git${SRCPV}" | ||
| 10 | |||
| 11 | DEPENDS = "zlib xz" | ||
| 12 | |||
| 13 | inherit klibc autotools | ||
| 14 | |||
| 15 | SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git" | ||
| 16 | SRCREV = "0481e9ed61ef80b3d851bb96b0c70a3d4a112c8b" | ||
| 17 | |||
| 18 | BUILD_PATCHES = "file://0001-force-static-build.patch \ | ||
| 19 | file://0002-Adjust-the-order-of-headers-to-fix-build-for-musl.patch" | ||
| 20 | |||
| 21 | KLIBC_PATCHES += " \ | ||
| 22 | file://0003-kexec-elf-rel-use-our-elf.h.patch \ | ||
| 23 | file://0004-kexec-elf-exec.c-replace-with-our-err.h.patch \ | ||
| 24 | file://0005-crashdump-elf.c-work-around-for-sysconf-_SC_NPROCESS.patch \ | ||
| 25 | file://0006-kexec-syscall.h-work-around-missing-syscall-wrapper.patch \ | ||
| 26 | file://0007-kexec.c-add-guard-around-ENOTSUP.patch \ | ||
| 27 | file://0008-kexec.c-replace-mising-BLKGETSIZE64.patch \ | ||
| 28 | file://0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch \ | ||
| 29 | file://0010-fs2dt.c-work-around-missing-getline.patch \ | ||
| 30 | file://0011-purgatory-Makefile-adapt-to-klcc.patch \ | ||
| 31 | file://0012-purgatory-string.c-avoid-inclusion-of-string.h.patch \ | ||
| 32 | file://0013-sha256.h-avoid-inclusion-of-sys-types.h.patch \ | ||
| 33 | file://0014-add-if_nameindex-from-musl.patch \ | ||
| 34 | file://0015-vmcore-dmesg-fix-warning.patch" | ||
| 35 | |||
| 36 | WARNING_FIXES = "" | ||
| 37 | |||
| 38 | SRC_URI += "${BUILD_PATCHES} ${KLIBC_PATCHES} ${WARNING_FIXES}" | ||
| 39 | |||
| 40 | SRC_URI_append_arm = " file://arm_crashdump.patch" | ||
| 41 | |||
| 42 | SRC_URI_append_x86 = " file://x86_sys_io.patch file://x86_basename.patch \ | ||
| 43 | file://x86_vfscanf.patch file://x86_kexec_test.patch" | ||
| 44 | |||
| 45 | SRC_URI_append_x86-64 = " file://x86_sys_io.patch file://x86_basename.patch \ | ||
| 46 | file://x86_vfscanf.patch file://x86_kexec_test.patch \ | ||
| 47 | file://x86-64-purgatory-Makefile-remove-unknown-flags.patch" | ||
| 48 | |||
| 49 | SRC_URI_append_aarch64 = " file://arm64_purgatory-Makefile-remove-unknown-flags.patch \ | ||
| 50 | file://arm64_kexec-image-header.h-add-missing-le64toh.patch \ | ||
| 51 | file://arm64-crashdump-arm64.c-fix-warning.patch" | ||
| 52 | |||
| 53 | SRC_URI_append_powerpc = " file://powerpc-purgatory-Makefile-remove-unknown-flags.patch" | ||
| 54 | |||
| 55 | S = "${WORKDIR}/git" | ||
| 56 | |||
| 57 | EXTRA_OECONF += "--without-zlib --without-lzma --without-xen" | ||
| 58 | |||
| 59 | # fix purgatory/printf.c:2:10: fatal error: limits.h: No such file or directory | ||
| 60 | # fix include/limits.h:42:10: fatal error: bitsize/limits.h: No such file or directory | ||
| 61 | COMMON_CFLAGS += "-I${STAGING_DIR_HOST}${libdir}/klibc/include -I${S}/purgatory/include" | ||
| 62 | CFLAGS_x86_append = " ${COMMON_CFLAGS} -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits32" | ||
| 63 | CFLAGS_x86-64_append = " ${COMMON_CFLAGS} -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits64" | ||
| 64 | CFLAGS_arm_append = " ${COMMON_CFLAGS} -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits32" | ||
| 65 | CFLAGS_aarch64_append = "${COMMON_CFLAGS} -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits64" | ||
| 66 | CFLAGS_mips_append = " ${COMMON_CFLAGS} -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits32" | ||
| 67 | CFLAGS_mips64_append = " ${COMMON_CFLAGS} -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits64" | ||
| 68 | CFLAGS_powerpc_append = " ${COMMON_CFLAGS} -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits32" | ||
| 69 | |||
| 70 | do_compile_prepend() { | ||
| 71 | # Remove the prepackaged config.h from the source tree as it overrides | ||
| 72 | # the same file generated by configure and placed in the build tree | ||
| 73 | rm -f ${S}/include/config.h | ||
| 74 | |||
| 75 | # Remove the '*.d' file to make sure the recompile is OK | ||
| 76 | for dep in `find ${B} -type f -name '*.d'`; do | ||
| 77 | dep_no_d="`echo $dep | sed 's#.d$##'`" | ||
| 78 | # Remove file.d when there is a file.o | ||
| 79 | if [ -f "$dep_no_d.o" ]; then | ||
| 80 | rm -f $dep | ||
| 81 | fi | ||
| 82 | done | ||
| 83 | } | ||
| 84 | |||
| 85 | PACKAGES =+ "kexec-klibc kdump-klibc" | ||
| 86 | |||
| 87 | FILES_kexec-klibc = "${sbindir}/kexec" | ||
| 88 | FILES_kdump-klibc = "${sbindir}/kdump" | ||
| 89 | |||
| 90 | INSANE_SKIP_${PN} = "arch" | ||
| 91 | |||
| 92 | COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|powerpc.*|mips.*)-(linux|freebsd.*)' | ||
