added my Recipes
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
From 2a62d7623e3d4c0eaa44434ab678274fe3a9edb1 Mon Sep 17 00:00:00 2001
|
||||
From: OpenEmbedded <oe.patch@oe>
|
||||
Date: Wed, 11 Apr 2018 22:51:00 +0200
|
||||
Subject: [PATCH] force static build
|
||||
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
Makefile.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index fb01134..dbf1fb6 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -47,7 +47,7 @@ TARGET_CFLAGS = @TARGET_CFLAGS@
|
||||
# where necessary.
|
||||
CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -I$(srcdir)/util_lib/include \
|
||||
-Iinclude/ $($(ARCH)_CPPFLAGS)
|
||||
-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@ $($(ARCH)_ASFLAGS)
|
||||
LDFLAGS = @LDFLAGS@
|
||||
@@ -0,0 +1,29 @@
|
||||
From 6843cefb1d1d0017a714a2752bb008efd844f3e4 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
|
||||
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
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 9679ad7..82c6141 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/socket.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
-#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
+#include <net/if.h>
|
||||
|
||||
/*
|
||||
* First, we find all shaper devices and down them. Then we
|
||||
@@ -0,0 +1,92 @@
|
||||
From 7e202ea55e8dd803278d9d1eac7ffd355344d6be Mon Sep 17 00:00:00 2001
|
||||
From: OpenEmbedded <oe.patch@oe>
|
||||
Date: Wed, 11 Apr 2018 22:51:00 +0200
|
||||
Subject: [PATCH] kexec-elf-rel: use our elf.h
|
||||
|
||||
Fix:
|
||||
|
||||
kexec-elf-rel.c: In function 'elf_rel_load':
|
||||
kexec-elf-rel.c:386:39: error: 'STT_NOTYPE' undeclared
|
||||
|
||||
and similar.
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/arch/arm/kexec-elf-rel-arm.c | 2 +-
|
||||
kexec/arch/i386/kexec-elf-rel-x86.c | 2 +-
|
||||
kexec/arch/ppc/kexec-elf-rel-ppc.c | 2 +-
|
||||
kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 2 +-
|
||||
kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 2 +-
|
||||
kexec/kexec-elf-rel.c | 2 +-
|
||||
6 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/arm/kexec-elf-rel-arm.c b/kexec/arch/arm/kexec-elf-rel-arm.c
|
||||
index a939cf4..2551dc0 100644
|
||||
--- 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"
|
||||
|
||||
diff --git a/kexec/arch/i386/kexec-elf-rel-x86.c b/kexec/arch/i386/kexec-elf-rel-x86.c
|
||||
index 55a214e..e7583d1 100644
|
||||
--- 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"
|
||||
|
||||
diff --git a/kexec/arch/ppc/kexec-elf-rel-ppc.c b/kexec/arch/ppc/kexec-elf-rel-ppc.c
|
||||
index 1acbd86..a60c66c 100644
|
||||
--- 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"
|
||||
|
||||
diff --git a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
|
||||
index 51b1354..c85f421 100644
|
||||
--- 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"
|
||||
diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
|
||||
index db85b44..761a4ed 100644
|
||||
--- 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/kexec/kexec-elf-rel.c b/kexec/kexec-elf-rel.c
|
||||
index 9a6e63d..a856636 100644
|
||||
--- 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"
|
||||
@@ -0,0 +1,30 @@
|
||||
From 720e24029fca7dcd8e1cd0b556f37aa1dc2b8fe8 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Tue, 17 Apr 2018 10:57:23 +0200
|
||||
Subject: [PATCH] kexec-elf-exec.c: replace with our elf.h
|
||||
|
||||
Fix
|
||||
|
||||
kexec-elf-exec.c: In function 'elf_exec_load':
|
||||
error: 'EM_AARCH64' undeclared
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/kexec-elf-exec.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/kexec-elf-exec.c b/kexec/kexec-elf-exec.c
|
||||
index a9329ac..0dd0700 100644
|
||||
--- a/kexec/kexec-elf-exec.c
|
||||
+++ b/kexec/kexec-elf-exec.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"
|
||||
@@ -0,0 +1,134 @@
|
||||
From 43fb9cec1749b337bfa252fc2c1b0288847e8fa7 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Wed, 18 Apr 2018 02:21:30 +0200
|
||||
Subject: [PATCH] crashdump-elf.c: work around for _SC_NPROCESSORS_CONF
|
||||
|
||||
klibc sysconf lacks this so the implementation
|
||||
of Linus Torvalds was taken (simplified):
|
||||
|
||||
https://sourceware.org/ml/libc-alpha/2011-06/msg00079.html
|
||||
|
||||
Have fun reding the thread!
|
||||
|
||||
Fix
|
||||
|
||||
crashdump-elf.c:117:21: error: '_SC_NPROCESSORS_CONF' undeclared
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/crashdump-elf.c | 92 +++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 92 insertions(+)
|
||||
|
||||
diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c
|
||||
index b8bb686..7e6767c 100644
|
||||
--- a/kexec/crashdump-elf.c
|
||||
+++ b/kexec/crashdump-elf.c
|
||||
@@ -25,6 +25,94 @@ do { \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
+#ifdef __KLIBC__
|
||||
+#ifndef KLIBC_SYSFS_CPU_H
|
||||
+#define KLIBC_SYSFS_CPU_H
|
||||
+
|
||||
+
|
||||
+static int __get_sysfs_cpus(const char *path);
|
||||
+int __get_nprocs (void);
|
||||
+int __get_nprocs_conf (void);
|
||||
+
|
||||
+
|
||||
+
|
||||
+static int __get_sysfs_cpus(const char *path)
|
||||
+{
|
||||
+ FILE *file;
|
||||
+ int nr_cpus = 0;
|
||||
+ int prev = -1;
|
||||
+ char *p;
|
||||
+ char line[10];
|
||||
+
|
||||
+
|
||||
+ file = fopen(path, "r");
|
||||
+ if (!file)
|
||||
+ return -1;
|
||||
+ for (;;) {
|
||||
+ char sep;
|
||||
+ int cpu;
|
||||
+ int n;
|
||||
+
|
||||
+ /* int n = fscanf(file, "%u%c", &cpu, &sep); */
|
||||
+ p = fgets(line, sizeof(line), file);
|
||||
+ if (p == NULL)
|
||||
+ return -1;
|
||||
+ else
|
||||
+ n = sscanf(line, "%u%c", &cpu, &sep);
|
||||
+
|
||||
+ if (n <= 0)
|
||||
+ break;
|
||||
+
|
||||
+ /* EOF == EOLN */
|
||||
+ if (n == 1)
|
||||
+ sep = '\n';
|
||||
+
|
||||
+ /* Was the previous CPU a range? */
|
||||
+ if (prev >= 0) {
|
||||
+ nr_cpus += cpu - prev + 1;
|
||||
+ prev = -1;
|
||||
+ } else if (sep == '-')
|
||||
+ prev = cpu;
|
||||
+ else
|
||||
+ nr_cpus++;
|
||||
+
|
||||
+ if (sep == '\n')
|
||||
+ break;
|
||||
+ }
|
||||
+ fclose(file);
|
||||
+ return nr_cpus;
|
||||
+}
|
||||
+
|
||||
+int __get_nprocs ()
|
||||
+{
|
||||
+ long ret;
|
||||
+ static int cached = -1;
|
||||
+
|
||||
+ ret = cached;
|
||||
+ if (ret < 0)
|
||||
+ {
|
||||
+ ret = __get_sysfs_cpus("/sys/devices/system/cpu/online");
|
||||
+ cached = ret;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+int __get_nprocs_conf ()
|
||||
+{
|
||||
+ long ret;
|
||||
+ static int cached = -1;
|
||||
+
|
||||
+ ret = cached;
|
||||
+ if (ret < 0)
|
||||
+ {
|
||||
+ ret = __get_sysfs_cpus("/sys/devices/system/cpu/possible");
|
||||
+ cached = ret;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
/* Prepares the crash memory headers and stores in supplied buffer. */
|
||||
int FUNC(struct kexec_info *info,
|
||||
struct crash_elf_info *elf_info,
|
||||
@@ -46,7 +134,11 @@ int FUNC(struct kexec_info *info,
|
||||
if (xen_present())
|
||||
nr_cpus = xen_get_nr_phys_cpus();
|
||||
else
|
||||
+#ifndef __KLIBC__
|
||||
nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
|
||||
+#else
|
||||
+ nr_cpus = __get_nprocs_conf();
|
||||
+#endif
|
||||
|
||||
if (nr_cpus < 0) {
|
||||
return -1;
|
||||
@@ -0,0 +1,68 @@
|
||||
From ab24f236cbc0aa8a3eadde5d71d9d7ea1d979a51 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Fri, 31 Aug 2018 11:33:51 +0200
|
||||
Subject: [PATCH] kexec-syscall.h: work around missing syscall() wrapper
|
||||
|
||||
Fix
|
||||
|
||||
kexec-syscall.h: In function 'kexec_load':
|
||||
kexec-syscall.h:80:16: warning: implicit declaration of function 'syscall'
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/kexec-syscall.h | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
|
||||
index b96e02a..2a3794d 100644
|
||||
--- a/kexec/kexec-syscall.h
|
||||
+++ b/kexec/kexec-syscall.h
|
||||
@@ -77,11 +77,16 @@
|
||||
|
||||
struct kexec_segment;
|
||||
|
||||
+#ifndef __KLIBC__
|
||||
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);
|
||||
}
|
||||
+#else
|
||||
+extern long kexec_load(void *entry, unsigned long nr_segments,
|
||||
+ struct kexec_segment *segments, unsigned long flags);
|
||||
+#endif
|
||||
|
||||
static inline int is_kexec_file_load_implemented(void) {
|
||||
if (__NR_kexec_file_load != 0xffffffff)
|
||||
@@ -89,6 +94,21 @@ static inline int is_kexec_file_load_implemented(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef __KLIBC__
|
||||
+/* Stub provided by klibc only for the following archs */
|
||||
+#if defined (__x86_64__) || defined (__powerpc_64__) || defined (__s390x__)
|
||||
+extern long kexec_file_load(int kernel_fd, int initrd_fd,
|
||||
+ unsigned long cmdline_len, const char *cmdline_ptr,
|
||||
+ unsigned long flags);
|
||||
+#else
|
||||
+static inline long kexec_file_load(int kernel_fd, int initrd_fd,
|
||||
+ unsigned long cmdline_len, const char *cmdline_ptr,
|
||||
+ unsigned long flags)
|
||||
+{
|
||||
+ return -1;
|
||||
+}
|
||||
+#endif
|
||||
+#else
|
||||
static inline long kexec_file_load(int kernel_fd, int initrd_fd,
|
||||
unsigned long cmdline_len, const char *cmdline_ptr,
|
||||
unsigned long flags)
|
||||
@@ -96,6 +116,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,
|
||||
return (long) syscall(__NR_kexec_file_load, kernel_fd, initrd_fd,
|
||||
cmdline_len, cmdline_ptr, flags);
|
||||
}
|
||||
+#endif
|
||||
|
||||
#define KEXEC_ON_CRASH 0x00000001
|
||||
#define KEXEC_PRESERVE_CONTEXT 0x00000002
|
||||
@@ -0,0 +1,37 @@
|
||||
From 17e9da8d3c3c69f84e11c0457bd9fb8c4ee4274b Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Tue, 17 Apr 2018 11:35:14 +0200
|
||||
Subject: [PATCH] kexec.c: add guard around ENOTSUP
|
||||
|
||||
Fix
|
||||
|
||||
kexec.c: In function 'main':
|
||||
kexec.c:1515:11: error: 'ENOTSUP' undeclared
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/kexec.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||
index 32ae56c..0764e85 100644
|
||||
--- a/kexec/kexec.c
|
||||
+++ b/kexec/kexec.c
|
||||
@@ -1517,6 +1517,7 @@ int main(int argc, char *argv[])
|
||||
*/
|
||||
case -EINVAL:
|
||||
case -ENOEXEC:
|
||||
+#ifndef __KLIBC__
|
||||
/*
|
||||
* ENOTSUP can be unsupported image
|
||||
* type or unsupported PE signature
|
||||
@@ -1529,6 +1530,7 @@ int main(int argc, char *argv[])
|
||||
* kernel bug
|
||||
*/
|
||||
case -ENOTSUP:
|
||||
+#endif
|
||||
do_kexec_file_syscall = 0;
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
From 30b61da180286643bea68b09b092744346011801 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Tue, 17 Apr 2018 11:38:42 +0200
|
||||
Subject: [PATCH] kexec.c: replace missing BLKGETSIZE64
|
||||
|
||||
Fix
|
||||
|
||||
kexec.c: In function 'slurp_file_generic':
|
||||
kexec.c:564:19: error: 'BLKGETSIZE64' undeclared
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/kexec.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||
index 0764e85..157c577 100644
|
||||
--- a/kexec/kexec.c
|
||||
+++ b/kexec/kexec.c
|
||||
@@ -55,6 +55,10 @@
|
||||
#define KEXEC_LOADED_PATH "/sys/kernel/kexec_loaded"
|
||||
#define KEXEC_CRASH_LOADED_PATH "/sys/kernel/kexec_crash_loaded"
|
||||
|
||||
+#ifndef BLKGETSIZE64
|
||||
+#define BLKGETSIZE64 _IOR(0x12,114,size_t)
|
||||
+#endif
|
||||
+
|
||||
unsigned long long mem_min = 0;
|
||||
unsigned long long mem_max = ULONG_MAX;
|
||||
static unsigned long kexec_flags = 0;
|
||||
@@ -0,0 +1,57 @@
|
||||
From 20e2c61fc04a291250acee649c2523d2546cedea Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Tue, 17 Apr 2018 13:14:12 +0200
|
||||
Subject: [PATCH] vmcore-dmesg.c: work around missing imaxdiv()
|
||||
|
||||
Convert to integer arithmetic for klibc.
|
||||
|
||||
Fix
|
||||
|
||||
vmcore-dmesg.c: In function 'dump_dmesg_structured':
|
||||
vmcore-dmesg.c:578:2: error: unknown type name 'imaxdiv_t'
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
vmcore-dmesg/vmcore-dmesg.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
|
||||
index 7972788..c63ac4f 100644
|
||||
--- a/vmcore-dmesg/vmcore-dmesg.c
|
||||
+++ b/vmcore-dmesg/vmcore-dmesg.c
|
||||
@@ -575,8 +575,11 @@ static void dump_dmesg_structured(int fd)
|
||||
ssize_t ret;
|
||||
char *msg;
|
||||
uint16_t text_len;
|
||||
+#ifndef __KLIBC__
|
||||
imaxdiv_t imaxdiv_sec, imaxdiv_usec;
|
||||
-
|
||||
+#else
|
||||
+ int64_t imaxdiv_sec, imaxdiv_usec;
|
||||
+#endif
|
||||
if (!log_buf_vaddr) {
|
||||
fprintf(stderr, "Missing the log_buf symbol\n");
|
||||
exit(60);
|
||||
@@ -645,12 +648,20 @@ static void dump_dmesg_structured(int fd)
|
||||
exit(65);
|
||||
}
|
||||
ts_nsec = struct_val_u64(buf, log_offset_ts_nsec);
|
||||
+#ifndef __KLIBC__
|
||||
imaxdiv_sec = imaxdiv(ts_nsec, 1000000000);
|
||||
imaxdiv_usec = imaxdiv(imaxdiv_sec.rem, 1000);
|
||||
|
||||
len += sprintf(out_buf + len, "[%5llu.%06llu] ",
|
||||
(long long unsigned int)imaxdiv_sec.quot,
|
||||
(long long unsigned int)imaxdiv_usec.quot);
|
||||
+#else
|
||||
+ imaxdiv_sec = ts_nsec / 1000000000;
|
||||
+ imaxdiv_usec = (ts_nsec % 1000000000) / 1000;
|
||||
+ len += sprintf(out_buf + len, "[%5llu.%06llu] ",
|
||||
+ (long long unsigned int)imaxdiv_sec,
|
||||
+ (long long unsigned int)imaxdiv_usec);
|
||||
+#endif
|
||||
|
||||
/* escape non-printable characters */
|
||||
text_len = struct_val_u16(buf, log_offset_text_len);
|
||||
@@ -0,0 +1,47 @@
|
||||
From 14d4dbd293c75bc81a0dde6e678f9bbefb40b6f1 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Tue, 17 Apr 2018 13:48:25 +0200
|
||||
Subject: [PATCH] fs2dt.c: work around missing getline()
|
||||
|
||||
This simple case can be rewrtten with fgets()
|
||||
|
||||
Fix
|
||||
|
||||
fs2dt.c: In function 'dt_copy_old_root_param':
|
||||
fs2dt.c:541:6: warning: implicit declaration of function 'getline'
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/fs2dt.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/kexec/fs2dt.c b/kexec/fs2dt.c
|
||||
index 07a5e2f..d635636 100644
|
||||
--- a/kexec/fs2dt.c
|
||||
+++ b/kexec/fs2dt.c
|
||||
@@ -531,6 +531,9 @@ static void dt_copy_old_root_param(void)
|
||||
char *last_cmdline = NULL;
|
||||
char *p, *old_param;
|
||||
size_t len = 0;
|
||||
+#ifdef __KLIBC__
|
||||
+ char buf[512];
|
||||
+#endif
|
||||
|
||||
strcpy(filename, pathname);
|
||||
strcat(filename, "bootargs");
|
||||
@@ -538,8 +541,13 @@ static void dt_copy_old_root_param(void)
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
+#ifndef __KLIBC__
|
||||
if (getline(&last_cmdline, &len, fp) == -1)
|
||||
die("unable to read %s\n", filename);
|
||||
+#else
|
||||
+ last_cmdline = fgets(buf, 200, fp);
|
||||
+ last_cmdline[strlen(last_cmdline) - 1] = '\0';
|
||||
+#endif
|
||||
|
||||
p = strstr(last_cmdline, "root=");
|
||||
if (p) {
|
||||
@@ -0,0 +1,34 @@
|
||||
From b6ebe05dc389b9457e3707401411fd075230b10e Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Tue, 21 Aug 2018 16:31:44 +0200
|
||||
Subject: [PATCH] purgatory Makefile: adapt to klcc
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
purgatory/Makefile | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/purgatory/Makefile
|
||||
+++ b/purgatory/Makefile
|
||||
@@ -47,7 +47,7 @@ purgatory/sha256.o: $(srcdir)/util_lib/s
|
||||
$(PURGATORY): CC=$(TARGET_CC)
|
||||
$(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \
|
||||
$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
|
||||
- -Os -fno-builtin -ffreestanding \
|
||||
+ -Os -fno-builtin -ffreestanding -nostdinc \
|
||||
-fno-zero-initialized-in-bss \
|
||||
-fno-PIC -fno-PIE -fno-stack-protector
|
||||
|
||||
@@ -59,8 +59,8 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATO
|
||||
-Iinclude \
|
||||
-I$(shell $(CC) -print-file-name=include)
|
||||
$(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\
|
||||
- -Wl,--no-undefined -nostartfiles -nostdlib \
|
||||
- -nodefaultlibs -e purgatory_start -r \
|
||||
+ -Wl,--no-undefined -no-pie -nostartfiles -nostdlib \
|
||||
+ -nodefaultlibs -Wl,--entry=purgatory_start -Wl,-r \
|
||||
-Wl,-Map=$(PURGATORY_MAP)
|
||||
|
||||
$(PURGATORY): $(PURGATORY_OBJS)
|
||||
@@ -0,0 +1,28 @@
|
||||
From 9bb386018257e1e18ffe0e925201946515b31080 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Thu, 19 Apr 2018 00:28:14 +0200
|
||||
Subject: [PATCH] purgatory/string.c: avoid inclusion of string.h
|
||||
|
||||
Fix
|
||||
|
||||
purgatory/string.c:39:5: error: conflicting types for 'memcmp'
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
purgatory/string.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/purgatory/string.c b/purgatory/string.c
|
||||
index f06c460..c5e978a 100644
|
||||
--- a/purgatory/string.c
|
||||
+++ b/purgatory/string.c
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <stddef.h>
|
||||
+#ifndef __KLIBC__
|
||||
#include <string.h>
|
||||
+#endif
|
||||
|
||||
size_t strnlen(const char *s, size_t max)
|
||||
{
|
||||
@@ -0,0 +1,33 @@
|
||||
From 60098810e1c04be677794bff6a3935011af98934 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Thu, 19 Apr 2018 23:26:43 +0200
|
||||
Subject: [PATCH] sha256.h: avoid inclusion of sys/types.h
|
||||
|
||||
Fix
|
||||
|
||||
purgatory/printf.c:2:10: fatal error: limits.h:
|
||||
No such file or directory
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
util_lib/include/sha256.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/util_lib/include/sha256.h b/util_lib/include/sha256.h
|
||||
index 467fb22..40fd3ed 100644
|
||||
--- a/util_lib/include/sha256.h
|
||||
+++ b/util_lib/include/sha256.h
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef SHA256_H
|
||||
#define SHA256_H
|
||||
|
||||
+#ifndef __KLIBC__
|
||||
#include <sys/types.h>
|
||||
+#else
|
||||
+#include <stddef.h>
|
||||
+#endif
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct
|
||||
@@ -0,0 +1,150 @@
|
||||
From 04eec97b390621f2b3794b0d774b77429eb88cfd Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Wed, 2 May 2018 23:14:19 +0200
|
||||
Subject: [PATCH] add if_nameindex from musl
|
||||
|
||||
Taken from musl, minimal changes.
|
||||
klibc lacks struct and func
|
||||
|
||||
Fix
|
||||
|
||||
ifdown.o: In function `ifdown':
|
||||
ifdown.c (.text+0x30): undefined reference to `if_nameindex'
|
||||
|
||||
While there add klibc-specific guard and include sys/types.h
|
||||
to fix :
|
||||
|
||||
/kexec/if_nameindex.c:2:
|
||||
/usr/lib/klibc/include/linux/types.h:22:0:
|
||||
warning: "__bitwise" redefined
|
||||
#define __bitwise __bitwise__
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/Makefile | 2 +-
|
||||
kexec/if_nameindex.c | 64 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
kexec/if_nameindex.h | 15 +++++++++++
|
||||
kexec/ifdown.c | 3 +++
|
||||
4 files changed, 83 insertions(+), 1 deletion(-)
|
||||
create mode 100644 kexec/if_nameindex.c
|
||||
create mode 100644 kexec/if_nameindex.h
|
||||
|
||||
diff --git a/kexec/Makefile b/kexec/Makefile
|
||||
index 4db84d8..fb7520b 100644
|
||||
--- a/kexec/Makefile
|
||||
+++ b/kexec/Makefile
|
||||
@@ -11,7 +11,7 @@ KEXEC_SRCS = $(KEXEC_SRCS_base)
|
||||
KEXEC_GENERATED_SRCS =
|
||||
|
||||
KEXEC_SRCS_base += kexec/kexec.c
|
||||
-KEXEC_SRCS_base += kexec/ifdown.c
|
||||
+KEXEC_SRCS_base += kexec/if_nameindex kexec/ifdown.c
|
||||
KEXEC_SRCS_base += kexec/kexec-elf.c
|
||||
KEXEC_SRCS_base += kexec/kexec-elf-exec.c
|
||||
KEXEC_SRCS_base += kexec/kexec-elf-core.c
|
||||
diff --git a/kexec/if_nameindex.c b/kexec/if_nameindex.c
|
||||
new file mode 100644
|
||||
index 0000000..e586e41
|
||||
--- /dev/null
|
||||
+++ b/kexec/if_nameindex.c
|
||||
@@ -0,0 +1,64 @@
|
||||
+#define _GNU_SOURCE
|
||||
+#ifdef __KLIBC__
|
||||
+#include <sys/types.h>
|
||||
+#endif
|
||||
+#include <netinet/in.h>
|
||||
+#include <net/if.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <errno.h>
|
||||
+#include <sys/syscall.h>
|
||||
+#include <stdio.h>
|
||||
+#ifdef __KLIBC__
|
||||
+#include "if_nameindex.h"
|
||||
+#endif
|
||||
+
|
||||
+static void *do_nameindex(int s, size_t n)
|
||||
+{
|
||||
+ size_t i, len, k;
|
||||
+ struct ifconf conf;
|
||||
+ struct if_nameindex *idx;
|
||||
+
|
||||
+ idx = malloc(n * (sizeof(struct if_nameindex)+sizeof(struct ifreq)));
|
||||
+ if (!idx) return 0;
|
||||
+
|
||||
+ conf.ifc_buf = (void *)&idx[n];
|
||||
+ conf.ifc_len = len = n * sizeof(struct ifreq);
|
||||
+ if (ioctl(s, SIOCGIFCONF, &conf) < 0) {
|
||||
+ free(idx);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (conf.ifc_len == len) {
|
||||
+ free(idx);
|
||||
+ return (void *)-1;
|
||||
+ }
|
||||
+
|
||||
+ n = conf.ifc_len / sizeof(struct ifreq);
|
||||
+ for (i=k=0; i<n; i++) {
|
||||
+ if (ioctl(s, SIOCGIFINDEX, &conf.ifc_req[i]) < 0) {
|
||||
+ k++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ idx[i-k].if_index = conf.ifc_req[i].ifr_ifindex;
|
||||
+ idx[i-k].if_name = conf.ifc_req[i].ifr_name;
|
||||
+ }
|
||||
+ idx[i-k].if_name = 0;
|
||||
+ idx[i-k].if_index = 0;
|
||||
+
|
||||
+ return idx;
|
||||
+}
|
||||
+
|
||||
+struct if_nameindex *if_nameindex()
|
||||
+{
|
||||
+ size_t n;
|
||||
+ void *p = 0;
|
||||
+ int s = socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||
+ if (s>=0) {
|
||||
+ for (n=0; (p=do_nameindex(s, n)) == (void *)-1; n++);
|
||||
+/* __syscall(SYS_close, s); */
|
||||
+ close(s);
|
||||
+ }
|
||||
+ errno = ENOBUFS;
|
||||
+ return p;
|
||||
+}
|
||||
diff --git a/kexec/if_nameindex.h b/kexec/if_nameindex.h
|
||||
new file mode 100644
|
||||
index 0000000..cf1c061
|
||||
--- /dev/null
|
||||
+++ b/kexec/if_nameindex.h
|
||||
@@ -0,0 +1,15 @@
|
||||
+#ifndef _NET_IF__NAMEINDEX_H
|
||||
+#define _NET_IF_NAMEINDEX_H
|
||||
+
|
||||
+struct if_nameindex
|
||||
+{
|
||||
+ unsigned int if_index;
|
||||
+ char *if_name;
|
||||
+};
|
||||
+
|
||||
+unsigned int if_nametoindex (const char *);
|
||||
+char *if_indextoname (unsigned int, char *);
|
||||
+struct if_nameindex *if_nameindex (void);
|
||||
+void if_freenameindex (struct if_nameindex *);
|
||||
+
|
||||
+#endif
|
||||
diff --git a/kexec/ifdown.c b/kexec/ifdown.c
|
||||
index 82c6141..cc3ca9f 100644
|
||||
--- a/kexec/ifdown.c
|
||||
+++ b/kexec/ifdown.c
|
||||
@@ -18,6 +18,9 @@ char *v_ifdown = "@(#)ifdown.c 1.11 02-Jun-1998 miquels@cistron.nl";
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
+#ifdef __KLIBC__
|
||||
+#include "if_nameindex.h"
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* First, we find all shaper devices and down them. Then we
|
||||
@@ -0,0 +1,27 @@
|
||||
From a2679731a56748de58a4cf0a46b7a15d75543a88 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Sun, 29 Apr 2018 00:52:31 +0200
|
||||
Subject: [PATCH] vmcore-dmesg: fix warning
|
||||
|
||||
# define __bitwise
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
vmcore-dmesg/vmcore-dmesg.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
|
||||
index c63ac4f..a4e3014 100644
|
||||
--- a/vmcore-dmesg/vmcore-dmesg.c
|
||||
+++ b/vmcore-dmesg/vmcore-dmesg.c
|
||||
@@ -2,6 +2,9 @@
|
||||
#define _GNU_SOURCE
|
||||
#define _LARGEFILE_SOURCE 1
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
+#ifdef __KLIBC__
|
||||
+#include <sys/types.h>
|
||||
+#endif
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
#include <stdio.h>
|
||||
@@ -0,0 +1,156 @@
|
||||
From 7bd94a64cd5424e74ad49dbda65a15e83670268f Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Mon, 17 Dec 2018 11:25:20 +0100
|
||||
Subject: [PATCH] kexec-tools: fix non-device tree devices on mips
|
||||
|
||||
Add additional argument '--no-dtb' which disables device tree
|
||||
search in currently loaded kernel.
|
||||
|
||||
Taken from LEDE-DEV:
|
||||
https://patchwork.ozlabs.org/patch/852961/
|
||||
|
||||
Rebased for kexec-tools 2.0.18
|
||||
Removed ppc change (unwanted ?)
|
||||
|
||||
Signed-off-by: Konstantin Kuzov <master.nosferatu@gmail.com>
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/arch/mips/include/arch/options.h | 4 +-
|
||||
kexec/arch/mips/kexec-elf-mips.c | 58 ++++++++++++++------------
|
||||
kexec/arch/mips/kexec-mips.c | 4 ++
|
||||
kexec/arch/mips/kexec-mips.h | 1 +
|
||||
4 files changed, 39 insertions(+), 28 deletions(-)
|
||||
|
||||
--- a/kexec/arch/mips/include/arch/options.h
|
||||
+++ b/kexec/arch/mips/include/arch/options.h
|
||||
@@ -5,6 +5,7 @@
|
||||
#define OPT_APPEND (OPT_ARCH_MAX+0)
|
||||
#define OPT_DTB (OPT_ARCH_MAX+1)
|
||||
#define OPT_RAMDISK (OPT_ARCH_MAX+2)
|
||||
+#define OPT_NO_DTB (OPT_ARCH_MAX+3)
|
||||
|
||||
/* Options relevant to the architecture (excluding loader-specific ones),
|
||||
* in this case none:
|
||||
@@ -14,7 +15,8 @@
|
||||
{"command-line", 1, 0, OPT_APPEND}, \
|
||||
{"append", 1, 0, OPT_APPEND}, \
|
||||
{"dtb", 1, 0, OPT_DTB }, \
|
||||
- {"initrd", 1, 0, OPT_RAMDISK },
|
||||
+ {"initrd", 1, 0, OPT_RAMDISK }, \
|
||||
+ {"no-dtb", 0, 0, OPT_NO_DTB },
|
||||
|
||||
|
||||
#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
|
||||
--- a/kexec/arch/mips/kexec-elf-mips.c
|
||||
+++ b/kexec/arch/mips/kexec-elf-mips.c
|
||||
@@ -141,45 +141,49 @@ int elf_mips_load(int argc, char **argv,
|
||||
else
|
||||
cmdline_addr = 0;
|
||||
|
||||
- /* MIPS systems that have been converted to use device tree
|
||||
- * passed through UHI will use commandline in the DTB and
|
||||
- * the DTB passed as a separate buffer. Note that
|
||||
- * CMDLINE_PREFIX is skipped here intentionally, as it is
|
||||
- * used only in the legacy method */
|
||||
-
|
||||
- if (arch_options.dtb_file) {
|
||||
- dtb_buf = slurp_file(arch_options.dtb_file, &dtb_length);
|
||||
- } else {
|
||||
- create_flatten_tree(&dtb_buf, &dtb_length, cmdline_buf + strlen(CMDLINE_PREFIX));
|
||||
- }
|
||||
-
|
||||
- if (arch_options.initrd_file) {
|
||||
- initrd_buf = slurp_file(arch_options.initrd_file, &initrd_size);
|
||||
|
||||
- /* Create initrd entries in dtb - although at this time
|
||||
- * they would not point to the correct location */
|
||||
- dtb_set_initrd(&dtb_buf, &dtb_length, initrd_buf, initrd_buf + initrd_size);
|
||||
-
|
||||
- initrd_base = add_buffer(info, initrd_buf, initrd_size,
|
||||
- initrd_size, sizeof(void *),
|
||||
- _ALIGN_UP(kernel_addr + kernel_size + dtb_length,
|
||||
- pagesize), 0x0fffffff, 1);
|
||||
-
|
||||
- /* Now that the buffer for initrd is prepared, update the dtb
|
||||
- * with an appropriate location */
|
||||
- dtb_set_initrd(&dtb_buf, &dtb_length, initrd_base, initrd_base + initrd_size);
|
||||
+ if (!arch_options.no_dtb) {
|
||||
+ /* MIPS systems that have been converted to use device tree
|
||||
+ * passed through UHI will use commandline in the DTB and
|
||||
+ * the DTB passed as a separate buffer. Note that
|
||||
+ * CMDLINE_PREFIX is skipped here intentionally, as it is
|
||||
+ * used only in the legacy method */
|
||||
+
|
||||
+ if (arch_options.dtb_file) {
|
||||
+ dtb_buf = slurp_file(arch_options.dtb_file, &dtb_length);
|
||||
+ } else {
|
||||
+ create_flatten_tree(&dtb_buf, &dtb_length, cmdline_buf + strlen(CMDLINE_PREFIX));
|
||||
+ }
|
||||
+
|
||||
+ if (arch_options.initrd_file) {
|
||||
+ initrd_buf = slurp_file(arch_options.initrd_file, &initrd_size);
|
||||
+
|
||||
+ /* Create initrd entries in dtb - although at this time
|
||||
+ * they would not point to the correct location */
|
||||
+ dtb_set_initrd(&dtb_buf, &dtb_length, (off_t)initrd_buf, (off_t)initrd_buf + initrd_size);
|
||||
+
|
||||
+ initrd_base = add_buffer(info, initrd_buf, initrd_size,
|
||||
+ initrd_size, sizeof(void *),
|
||||
+ _ALIGN_UP(kernel_addr + kernel_size + dtb_length,
|
||||
+ pagesize), 0x0fffffff, 1);
|
||||
+
|
||||
+ /* Now that the buffer for initrd is prepared, update the dtb
|
||||
+ * with an appropriate location */
|
||||
+ dtb_set_initrd(&dtb_buf, &dtb_length, initrd_base, initrd_base + initrd_size);
|
||||
+ }
|
||||
}
|
||||
|
||||
-
|
||||
/* This is a legacy method for commandline passing used
|
||||
* currently by Octeon CPUs only */
|
||||
add_buffer(info, cmdline_buf, sizeof(cmdline_buf),
|
||||
sizeof(cmdline_buf), sizeof(void *),
|
||||
cmdline_addr, 0x0fffffff, 1);
|
||||
|
||||
- add_buffer(info, dtb_buf, dtb_length, dtb_length, 0,
|
||||
- _ALIGN_UP(kernel_addr + kernel_size, pagesize),
|
||||
- 0x0fffffff, 1);
|
||||
+ if (!arch_options.no_dtb) {
|
||||
+ add_buffer(info, dtb_buf, dtb_length, dtb_length, 0,
|
||||
+ _ALIGN_UP(kernel_addr + kernel_size, pagesize),
|
||||
+ 0x0fffffff, 1);
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
--- a/kexec/arch/mips/kexec-mips.c
|
||||
+++ b/kexec/arch/mips/kexec-mips.c
|
||||
@@ -89,6 +89,7 @@ void arch_usage(void)
|
||||
" --append=STRING Set the kernel command line to STRING.\n"
|
||||
" --dtb=FILE Use FILE as the device tree blob.\n"
|
||||
" --initrd=FILE Use FILE as initial ramdisk.\n"
|
||||
+ " --no-dtb Don't try to find device tree\n"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -121,6 +122,9 @@ int arch_process_options(int argc, char
|
||||
case OPT_RAMDISK:
|
||||
arch_options.initrd_file = optarg;
|
||||
break;
|
||||
+ case OPT_NO_DTB:
|
||||
+ arch_options.no_dtb = 1;
|
||||
+ break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
--- a/kexec/arch/mips/kexec-mips.h
|
||||
+++ b/kexec/arch/mips/kexec-mips.h
|
||||
@@ -22,6 +22,7 @@ struct arch_options_t {
|
||||
char *dtb_file;
|
||||
char *initrd_file;
|
||||
int core_header_type;
|
||||
+ int no_dtb;
|
||||
};
|
||||
|
||||
extern struct memory_ranges usablemem_rgns;
|
||||
@@ -0,0 +1,32 @@
|
||||
From 3fd4db2ce1710f45eb297ae6b2c10726b33204f3 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Sun, 29 Apr 2018 00:46:16 +0200
|
||||
Subject: [PATCH] arm64: crashdump-arm64.c: fix warning
|
||||
|
||||
from ../git/kexec/kexec.h:6,
|
||||
from ../git/kexec/arch/arm64/crashdump-arm64.c:18:
|
||||
/tmp/build/tmp-musl/work/aarch64-oe-linux-musl/kexec-tools-klibc/0.6+gitAUTOINC+
|
||||
0481e9ed61-r0/recipe-sysroot/usr/lib/klibc/include/klibc/compiler.h:144:0: warni
|
||||
ng: "__bitwise" redefined
|
||||
# define __bitwise
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/arch/arm64/crashdump-arm64.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
|
||||
index 4fd7aa8..890d88f 100644
|
||||
--- a/kexec/arch/arm64/crashdump-arm64.c
|
||||
+++ b/kexec/arch/arm64/crashdump-arm64.c
|
||||
@@ -13,6 +13,9 @@
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <errno.h>
|
||||
+#ifdef __KLIBC__
|
||||
+#include <sys/types.h>
|
||||
+#endif
|
||||
#include <linux/elf.h>
|
||||
|
||||
#include "kexec.h"
|
||||
@@ -0,0 +1,58 @@
|
||||
From a99fc685214452aedabf9ac105bb99357006aa26 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Wed, 5 Sep 2018 17:07:48 +0200
|
||||
Subject: [PATCH] kexec-arm64.c: workaround for getrandom() syscall
|
||||
|
||||
The syscall was added to OE's klibc.
|
||||
Fix
|
||||
|
||||
| ../git/kexec/arch/arm64/kexec-arm64.c:19:10: fatal error: syscall.h: No such file or directory
|
||||
| #include <syscall.h>
|
||||
|
||||
and
|
||||
|
||||
| ../git/kexec/arch/arm64/kexec-arm64.c: In function 'setup_2nd_dtb':
|
||||
| ../git/kexec/arch/arm64/kexec-arm64.c:499:12: warning: implicit declaration of function 'getrandom'; did you mean 'srandom'? [-Wimplicit-function-declaration]
|
||||
| result = getrandom(&fdt_val64,
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/arch/arm64/kexec-arm64.c | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||
index b143e86..88d4168 100644
|
||||
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||
@@ -16,7 +16,11 @@
|
||||
#include <elf.h>
|
||||
|
||||
#include <unistd.h>
|
||||
+
|
||||
+#ifndef __KLIBC__
|
||||
#include <syscall.h>
|
||||
+#endif
|
||||
+
|
||||
#include <errno.h>
|
||||
#include <linux/random.h>
|
||||
|
||||
@@ -487,10 +491,16 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash)
|
||||
* have a valid random seed to pass to the
|
||||
* secondary kernel.
|
||||
*/
|
||||
+#ifndef __KLIBC__
|
||||
result = syscall(SYS_getrandom, &fdt_val64,
|
||||
sizeof(fdt_val64),
|
||||
GRND_NONBLOCK);
|
||||
-
|
||||
+#else
|
||||
+ extern ssize_t getrandom(void *, size_t, unsigned int);
|
||||
+ result = getrandom(&fdt_val64,
|
||||
+ sizeof(fdt_val64),
|
||||
+ GRND_NONBLOCK);
|
||||
+#endif
|
||||
if(result == -1) {
|
||||
fprintf(stderr, "%s: Reading random bytes failed.\n",
|
||||
__func__);
|
||||
@@ -0,0 +1,37 @@
|
||||
From c5e7928217ee73640d25c6471c4619601cb1ba19 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Thu, 19 Apr 2018 10:47:17 +0200
|
||||
Subject: [PATCH] kexec/arm64: image-header.h: add macro for le64toh
|
||||
|
||||
Fix
|
||||
|
||||
kexec-arm64.c:(.text+0x370): undefined reference to `le64toh'
|
||||
kexec-arm64.c:(.text+0x380): undefined reference to `le64toh'
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/arch/arm64/image-header.h | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/kexec/arch/arm64/image-header.h b/kexec/arch/arm64/image-header.h
|
||||
index 158d411..10ed2d6 100644
|
||||
--- a/kexec/arch/arm64/image-header.h
|
||||
+++ b/kexec/arch/arm64/image-header.h
|
||||
@@ -8,6 +8,15 @@
|
||||
#include <endian.h>
|
||||
#include <stdint.h>
|
||||
|
||||
+#ifdef __KLIBC__
|
||||
+#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
+#define le64toh(x) (x)
|
||||
+#endif
|
||||
+#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+#define le64toh(x) __bswap_64(x)
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* struct arm64_image_header - arm64 kernel image header.
|
||||
*
|
||||
@@ -0,0 +1,42 @@
|
||||
From edf186f45d543e318400195cc25175387ff3f5c4 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Sun, 26 Aug 2018 21:40:06 +0200
|
||||
Subject: [PATCH] arm- backport from oe-core
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/arch/arm/crashdump-arm.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
|
||||
index daa4788..3f72b38 100644
|
||||
--- a/kexec/arch/arm/crashdump-arm.c
|
||||
+++ b/kexec/arch/arm/crashdump-arm.c
|
||||
@@ -240,6 +240,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
|
||||
void *buf;
|
||||
int err;
|
||||
int last_ranges;
|
||||
+ unsigned short align_bit_shift = 20;
|
||||
|
||||
/*
|
||||
* First fetch all the memory (RAM) ranges that we are going to pass to
|
||||
@@ -281,6 +282,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
|
||||
|
||||
/* for support LPAE enabled kernel*/
|
||||
elf_info.class = ELFCLASS64;
|
||||
+ align_bit_shift = 21;
|
||||
|
||||
err = crash_create_elf64_headers(info, &elf_info,
|
||||
usablemem_rgns.ranges,
|
||||
@@ -302,8 +304,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
|
||||
* 1MB) so that available memory passed in kernel command line will be
|
||||
* aligned to 1MB. This is because kernel create_mapping() wants memory
|
||||
* regions to be aligned to SECTION_SIZE.
|
||||
+ * The SECTION_SIZE of LPAE kernel is '1UL << 21' defined in pgtable-3level.h
|
||||
*/
|
||||
- elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20,
|
||||
+ elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << align_bit_shift,
|
||||
crash_kernel_mem.start,
|
||||
crash_kernel_mem.end, -1, 0);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 8ee92bc915d650e188caaa3df0a798ac2002f64e Mon Sep 17 00:00:00 2001
|
||||
From: OpenEmbedded <oe.patch@oe>
|
||||
Date: Wed, 11 Apr 2018 22:51:00 +0200
|
||||
Subject: [PATCH] use our elf.h header
|
||||
|
||||
Fix
|
||||
|
||||
kexec/arch/arm/crashdump-arm.c:70:13: error: 'EM_ARM' undeclared here
|
||||
(not in a function); did you mean 'EM_860'?
|
||||
.machine = EM_ARM,
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/arch/arm/crashdump-arm.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
|
||||
index 3f72b38..af2600d 100644
|
||||
--- a/kexec/arch/arm/crashdump-arm.c
|
||||
+++ b/kexec/arch/arm/crashdump-arm.c
|
||||
@@ -21,7 +21,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <limits.h>
|
||||
-#include <elf.h>
|
||||
+#include "../../../include/elf.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/kexec/Makefile
|
||||
+++ b/kexec/Makefile
|
||||
@@ -110,7 +110,7 @@ $(KEXEC): $(KEXEC_OBJS) $(UTIL_LIB)
|
||||
@$(MKDIR) -p $(@D)
|
||||
$(LINK.o) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
-$(KEXEC): CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/include
|
||||
+$(KEXEC): CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/include -I$(shell $(CC) -print-file-name=include)
|
||||
|
||||
kexec/fs2dt.o: CPPFLAGS+=$($(ARCH)_FS2DT_INCLUDE)
|
||||
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -46,7 +46,7 @@ TARGET_CFLAGS = @TARGET_CFLAGS@
|
||||
# Base compiler flags. These are extended by the subcomponent-Makefiles
|
||||
# where necessary.
|
||||
CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -I$(srcdir)/util_lib/include \
|
||||
- -Iinclude/ $($(ARCH)_CPPFLAGS)
|
||||
+ -Iinclude/ $($(ARCH)_CPPFLAGS) -I$(shell $(CC) -print-file-name=include)
|
||||
CFLAGS = @CFLAGS@ -static -fno-strict-aliasing -Wall -Wstrict-prototypes
|
||||
PURGATORY_EXTRA_CFLAGS = @PURGATORY_EXTRA_CFLAGS@
|
||||
ASFLAGS = @ASFLAGS@ $($(ARCH)_ASFLAGS)
|
||||
@@ -0,0 +1,94 @@
|
||||
From fd40eee42273220fb0050fe10744b10067adc0a7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com>
|
||||
Date: Fri, 31 Aug 2018 17:31:50 +0200
|
||||
Subject: [PATCH] x86_64: Add support to build kexec-tools with x32 ABI
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Summary of changes,
|
||||
|
||||
configure.ac: Add test for detect x32 ABI.
|
||||
purgatory/arch/x86_64/Makefile: Not use mcmodel large when
|
||||
x32 ABI is set.
|
||||
kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set
|
||||
use ELFCLASS32 instead of ELFCLASS64.
|
||||
kexec/kexec-syscall.h: Add correct syscall number for x32 ABI.
|
||||
|
||||
Upstream-Status: Submitted
|
||||
|
||||
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
|
||||
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
|
||||
|
||||
---
|
||||
configure.ac | 9 +++++++++
|
||||
kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++
|
||||
kexec/kexec-syscall.h | 4 ++++
|
||||
purgatory/arch/x86_64/Makefile | 4 +++-
|
||||
4 files changed, 20 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index e05d601..c428146 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -54,6 +54,15 @@ case $target_cpu in
|
||||
;;
|
||||
ia64|x86_64|alpha|m68k )
|
||||
ARCH="$target_cpu"
|
||||
+
|
||||
+ dnl ---Test for x32 ABI in x86_64
|
||||
+ if test "x$ARCH" = "xx86_64" ; then
|
||||
+ AC_EGREP_CPP(x32_test,
|
||||
+ [#if defined(__x86_64__) && defined (__ILP32__)
|
||||
+ x32_test
|
||||
+ #endif
|
||||
+ ], SUBARCH='x32', SUBARCH='64')
|
||||
+ fi
|
||||
;;
|
||||
* )
|
||||
AC_MSG_ERROR([unsupported architecture $target_cpu])
|
||||
diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
|
||||
index 761a4ed..1c0e3f8 100644
|
||||
--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
|
||||
+++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
|
||||
@@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
|
||||
if (ehdr->ei_data != ELFDATA2LSB) {
|
||||
return 0;
|
||||
}
|
||||
+#ifdef __ILP32__
|
||||
+ if (ehdr->ei_class != ELFCLASS32) {
|
||||
+#else
|
||||
if (ehdr->ei_class != ELFCLASS64) {
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
if (ehdr->e_machine != EM_X86_64) {
|
||||
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
|
||||
index 2a3794d..3e67078 100644
|
||||
--- a/kexec/kexec-syscall.h
|
||||
+++ b/kexec/kexec-syscall.h
|
||||
@@ -31,8 +31,12 @@
|
||||
#define __NR_kexec_load 268
|
||||
#endif
|
||||
#ifdef __x86_64__
|
||||
+#ifdef __ILP32__
|
||||
+#define __NR_kexec_load 528
|
||||
+#else
|
||||
#define __NR_kexec_load 246
|
||||
#endif
|
||||
+#endif
|
||||
#ifdef __s390x__
|
||||
#define __NR_kexec_load 277
|
||||
#endif
|
||||
diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
|
||||
index 7300937..4af11e4 100644
|
||||
--- a/purgatory/arch/x86_64/Makefile
|
||||
+++ b/purgatory/arch/x86_64/Makefile
|
||||
@@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c
|
||||
x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c
|
||||
x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c
|
||||
|
||||
-x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
|
||||
+ifeq ($(SUBARCH),64)
|
||||
+ x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
|
||||
+endif
|
||||
@@ -0,0 +1,21 @@
|
||||
From 9c99b0748dd0ea1aaf3836378ee75fa5af099a19 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Fri, 15 Mar 2019 00:22:40 -0700
|
||||
|
||||
---
|
||||
kexec/kexec.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||
index 157c577..5da0d67 100644
|
||||
--- a/kexec/kexec.c
|
||||
+++ b/kexec/kexec.c
|
||||
@@ -901,7 +901,7 @@ static int my_exec(void)
|
||||
if (xen_present())
|
||||
xen_kexec_exec();
|
||||
else
|
||||
- reboot(LINUX_REBOOT_CMD_KEXEC);
|
||||
+ reboot(LINUX_REBOOT_CMD_KEXEC, NULL);
|
||||
/* I have failed if I make it here */
|
||||
fprintf(stderr, "kexec failed: %s\n",
|
||||
strerror(errno));
|
||||
@@ -0,0 +1,31 @@
|
||||
From 3683b3f3e318fa711f6018f154d950c51d5b597a Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Thu, 19 Apr 2018 19:26:53 +0200
|
||||
Subject: [PATCH] powerpc/purgatory: Makefile: remove unknown flags for powerpc
|
||||
|
||||
Fix
|
||||
|
||||
powerpc-oe-linux-musl-ld: unrecognised emulation mode: soft-float
|
||||
Supported emulations: elf32ppclinux elf32ppc elf32ppcsim elf32lppclinux
|
||||
elf32lppc elf32lppcsim elf64ppc elf64lppc
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
purgatory/arch/ppc/Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/purgatory/arch/ppc/Makefile b/purgatory/arch/ppc/Makefile
|
||||
index c85c58a..cd44a16 100644
|
||||
--- a/purgatory/arch/ppc/Makefile
|
||||
+++ b/purgatory/arch/ppc/Makefile
|
||||
@@ -7,7 +7,7 @@ ppc_PURGATORY_SRCS += purgatory/arch/ppc/misc.S
|
||||
ppc_PURGATORY_SRCS += purgatory/arch/ppc/purgatory-ppc.c
|
||||
ppc_PURGATORY_SRCS += purgatory/arch/ppc/console-ppc.c
|
||||
|
||||
-ppc_PURGATORY_EXTRA_CFLAGS += -msoft-float
|
||||
+#ppc_PURGATORY_EXTRA_CFLAGS += -msoft-float
|
||||
|
||||
dist += purgatory/arch/ppc/Makefile $(ppc_PURGATORY_SRCS) \
|
||||
purgatory/arch/ppc/purgatory-ppc.h purgatory/arch/ppc/ppc_asm.h
|
||||
@@ -0,0 +1,36 @@
|
||||
From 6fec72bd7264478c214169b0f30f649304bd39ea Mon Sep 17 00:00:00 2001
|
||||
From: Quanyang Wang <quanyang.wang@windriver.com>
|
||||
Date: Tue, 16 Jun 2015 12:59:57 +0800
|
||||
Subject: [PATCH] powerpc: change the memory size limit
|
||||
|
||||
When run "kexec" in powerpc board, the kexec has a limit that
|
||||
the kernel text and bss size must be less than 24M. But now
|
||||
some kernel size exceed the limit. So we need to change the limit,
|
||||
else will get the error log as below:
|
||||
|
||||
my_load:669: do
|
||||
Could not find a free area of memory of 0x12400 bytes...
|
||||
Could not find a free area of memory of 0x13000 bytes...
|
||||
locate_hole failed
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
|
||||
|
||||
---
|
||||
kexec/arch/ppc/kexec-ppc.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/arch/ppc/kexec-ppc.h b/kexec/arch/ppc/kexec-ppc.h
|
||||
index 04e728e..6bae9ec 100644
|
||||
--- a/kexec/arch/ppc/kexec-ppc.h
|
||||
+++ b/kexec/arch/ppc/kexec-ppc.h
|
||||
@@ -44,7 +44,7 @@ void dol_ppc_usage(void);
|
||||
* During inital setup the kernel does not map the whole memory but a part of
|
||||
* it. On Book-E that is 64MiB, 601 24MiB or 256MiB (if possible).
|
||||
*/
|
||||
-#define KERNEL_ACCESS_TOP (24 * 1024 * 1024)
|
||||
+#define KERNEL_ACCESS_TOP (36 * 1024 * 1024)
|
||||
|
||||
/* boot block version 17 as defined by the linux kernel */
|
||||
struct bootblock {
|
||||
@@ -0,0 +1,30 @@
|
||||
From 7823956149c78e1996c567d1965803456df090f8 Mon Sep 17 00:00:00 2001
|
||||
From: OpenEmbedded <oe.patch@oe>
|
||||
Date: Wed, 11 Apr 2018 22:51:05 +0200
|
||||
Subject: [PATCH] replace basename() with sscanf()
|
||||
|
||||
klibc lacks basename()
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/arch/i386/x86-linux-setup.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
|
||||
index 6cda12c..5514c1c 100644
|
||||
--- a/kexec/arch/i386/x86-linux-setup.c
|
||||
+++ b/kexec/arch/i386/x86-linux-setup.c
|
||||
@@ -304,9 +304,9 @@ static int add_edd_entry(struct x86_linux_param_header *real_mode,
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From e26fe77b0ac9acc2c8086586d267aa7160969d2d Mon Sep 17 00:00:00 2001
|
||||
From: OpenEmbedded <oe.patch@oe>
|
||||
Date: Wed, 11 Apr 2018 22:51:05 +0200
|
||||
Subject: [PATCH] do not build test
|
||||
|
||||
The purpose of this recipe is to build the smallest
|
||||
binaries. kexek klibc-static for armv5 is around 86 KiB
|
||||
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
Makefile.in | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index dbf1fb6..440730d 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -173,8 +173,8 @@ PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
|
||||
PGSRCS:=$(foreach s, $(GENERATED_SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
|
||||
|
||||
MAN_PAGES:=$(KEXEC_MANPAGE) $(VMCORE_DMESG_MANPAGE)
|
||||
-BINARIES_i386:=$(KEXEC_TEST)
|
||||
-BINARIES_x86_64:=$(KEXEC_TEST)
|
||||
+#BINARIES_i386:=$(KEXEC_TEST)
|
||||
+#BINARIES_x86_64:=$(KEXEC_TEST)
|
||||
BINARIES:=$(KEXEC) $(VMCORE_DMESG) $(BINARIES_$(ARCH))
|
||||
|
||||
UNINSTALL_KDUMP = $(sbindir)/kdump
|
||||
@@ -0,0 +1,36 @@
|
||||
From 444160260a11022ecd84cd605fe8c22b316e6546 Mon Sep 17 00:00:00 2001
|
||||
From: OpenEmbedded <oe.patch@oe>
|
||||
Date: Wed, 11 Apr 2018 22:51:04 +0200
|
||||
Subject: [PATCH] i386: replace with our io.h
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
purgatory/arch/i386/pic.c | 2 +-
|
||||
purgatory/arch/i386/vga.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/purgatory/arch/i386/pic.c b/purgatory/arch/i386/pic.c
|
||||
index c23c459..c5f7046 100644
|
||||
--- 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"
|
||||
|
||||
diff --git a/purgatory/arch/i386/vga.c b/purgatory/arch/i386/vga.c
|
||||
index e65976c..d079d96 100644
|
||||
--- 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"
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From c6934455ec2337e6da7ea9fbc3486ce9beeb5d82 Mon Sep 17 00:00:00 2001
|
||||
From: OpenEmbedded <oe.patch@oe>
|
||||
Date: Wed, 11 Apr 2018 22:51:05 +0200
|
||||
Subject: [PATCH] x86-linux-setup.c: replace vfscanf() with vsscanf()
|
||||
|
||||
klibc lacks vfscanf()
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
kexec/arch/i386/x86-linux-setup.c | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
|
||||
index 5514c1c..bdb28c6 100644
|
||||
--- a/kexec/arch/i386/x86-linux-setup.c
|
||||
+++ b/kexec/arch/i386/x86-linux-setup.c
|
||||
@@ -200,6 +200,8 @@ static int file_scanf(const char *dir, const char *file, const char *scanf_line,
|
||||
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;
|
||||
@@ -210,7 +212,14 @@ static int file_scanf(const char *dir, const char *file, const char *scanf_line,
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,94 @@
|
||||
# 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 = "GPL-2.0-only"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \
|
||||
file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09"
|
||||
PV = "2.0.18+git${SRCPV}"
|
||||
|
||||
DEPENDS = "zlib xz"
|
||||
|
||||
inherit klibc autotools siteinfo
|
||||
|
||||
SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git;branch=master"
|
||||
SRCREV = "5750980cdbbc33ef75bfba6660295b932376ce15"
|
||||
|
||||
BUILD_PATCHES = "file://0001-force-static-build.patch \
|
||||
file://0002-Adjust-the-order-of-headers-to-fix-build-for-musl.patch"
|
||||
|
||||
KLIBC_PATCHES += " \
|
||||
file://0003-kexec-elf-rel-use-our-elf.h.patch \
|
||||
file://0004-kexec-elf-exec.c-replace-with-our-err.h.patch \
|
||||
file://0005-crashdump-elf.c-work-around-for-sysconf-_SC_NPROCESS.patch \
|
||||
file://0006-kexec-syscall.h-work-around-missing-syscall-wrapper.patch \
|
||||
file://0007-kexec.c-add-guard-around-ENOTSUP.patch \
|
||||
file://0008-kexec.c-replace-mising-BLKGETSIZE64.patch \
|
||||
file://0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch \
|
||||
file://0010-fs2dt.c-work-around-missing-getline.patch \
|
||||
file://0011-purgatory-Makefile-adapt-to-klcc.patch \
|
||||
file://0012-purgatory-string.c-avoid-inclusion-of-string.h.patch \
|
||||
file://0013-sha256.h-avoid-inclusion-of-sys-types.h.patch \
|
||||
file://0014-add-if_nameindex-from-musl.patch \
|
||||
file://0015-vmcore-dmesg-fix-warning.patch \
|
||||
file://klibc-reboot.patch \
|
||||
file://include_next.patch \
|
||||
"
|
||||
|
||||
WARNING_FIXES = ""
|
||||
FROM_OE_CORE = "file://arm_crashdump-fix-buffer-align.patch \
|
||||
file://powerpc_change-the-memory-size-limit.patch \
|
||||
file://kexec-x32.patch"
|
||||
|
||||
SRC_URI += "${BUILD_PATCHES} ${KLIBC_PATCHES} ${WARNING_FIXES} ${FROM_OE_CORE}"
|
||||
|
||||
SRC_URI:append:arm = " file://arm_crashdump.patch"
|
||||
|
||||
SRC_URI:append:mips = " file://140-mips_disable_devicetree_support.patch"
|
||||
SRC_URI:append:mipsel = " file://140-mips_disable_devicetree_support.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"
|
||||
|
||||
SRC_URI:append:aarch64 = " file://arm64_kexec-image-header.h-add-missing-le64toh.patch \
|
||||
file://arm64-crashdump-arm64.c-fix-warning.patch \
|
||||
file://arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch"
|
||||
|
||||
SRC_URI:append:powerpc = " file://powerpc-purgatory-Makefile-remove-unknown-flags.patch"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
EXTRA_OECONF += "--without-zlib --without-lzma --without-xen"
|
||||
|
||||
# fix purgatory/printf.c:2:10: fatal error: limits.h: No such file or directory
|
||||
# fix include/limits.h:42:10: fatal error: bitsize/limits.h: No such file or directory
|
||||
CFLAGS += "-O2 -I${STAGING_DIR_HOST}${libdir}/klibc/include -I${S}/purgatory/include \
|
||||
-I${STAGING_DIR_HOST}${libdir}/klibc/include/bits${SITEINFO_BITS}"
|
||||
|
||||
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 vmcore-dmesg-klibc"
|
||||
|
||||
FILES:kexec-klibc = "${sbindir}/kexec"
|
||||
FILES:vmcore-dmesg-klibc = "${sbindir}/vmcore-dmesg"
|
||||
|
||||
INSANE_SKIP:${PN} = "arch"
|
||||
|
||||
COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|powerpc.*|mips.*)-(linux|freebsd.*)'
|
||||
Reference in New Issue
Block a user