summaryrefslogtreecommitdiffstats
path: root/meta-initramfs
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2018-09-05 17:45:26 +0200
committerKhem Raj <raj.khem@gmail.com>2018-09-05 13:59:16 -0700
commitd1efc0181d5a2bcee3099a96d9b7f2c890029d87 (patch)
tree920d90127033924509251992d513c74a8e6b0dc5 /meta-initramfs
parent98e284846c9929dbaeddeb77ad2271f18fd85bdc (diff)
downloadmeta-openembedded-d1efc0181d5a2bcee3099a96d9b7f2c890029d87.tar.gz
kexec-tools-klibc: fix build for qemuarm64
Since c3f043241a86 upstream the getrandom() syscall is used. Last recipe bump overlooked that. The syscall has been added to OE's klibc so we can fix this. Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-initramfs')
-rw-r--r--meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch61
-rw-r--r--meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb3
2 files changed, 63 insertions, 1 deletions
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch
new file mode 100644
index 000000000..b22ac3aca
--- /dev/null
+++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch
@@ -0,0 +1,61 @@
1From 10afeecd10499fbd64b2c68d3b076c6906df441f Mon Sep 17 00:00:00 2001
2From: Andrea Adami <andrea.adami@gmail.com>
3Date: Wed, 5 Sep 2018 17:07:48 +0200
4Subject: [PATCH] kexec-arm64.c: workaround for getrandom() syscall
5
6The syscall was added to OE's klibc.
7Fix
8
9| ../git/kexec/arch/arm64/kexec-arm64.c:19:10: fatal error: syscall.h: No such file or directory
10| #include <syscall.h>
11
12and
13
14| ../git/kexec/arch/arm64/kexec-arm64.c: In function 'setup_2nd_dtb':
15| ../git/kexec/arch/arm64/kexec-arm64.c:499:12: warning: implicit declaration of function 'getrandom'; did you mean 'srandom'? [-Wimplicit-function-declaration]
16| result = getrandom(&fdt_val64,
17
18
19Upstream-Status: Inappropriate [klibc specific]
20Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
21---
22 kexec/arch/arm64/kexec-arm64.c | 12 +++++++++++-
23 1 file changed, 11 insertions(+), 1 deletion(-)
24
25diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
26index 7a12479..8a7f5c5 100644
27--- a/kexec/arch/arm64/kexec-arm64.c
28+++ b/kexec/arch/arm64/kexec-arm64.c
29@@ -16,7 +16,11 @@
30 #include <elf.h>
31
32 #include <unistd.h>
33+
34+#ifndef __KLIBC__
35 #include <syscall.h>
36+#endif
37+
38 #include <errno.h>
39 #include <linux/random.h>
40
41@@ -487,10 +491,16 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash)
42 * have a valid random seed to pass to the
43 * secondary kernel.
44 */
45+#ifndef __KLIBC__
46 result = syscall(SYS_getrandom, &fdt_val64,
47 sizeof(fdt_val64),
48 GRND_NONBLOCK);
49-
50+#else
51+ extern ssize_t getrandom(void *, size_t, unsigned int);
52+ result = getrandom(&fdt_val64,
53+ sizeof(fdt_val64),
54+ GRND_NONBLOCK);
55+#endif
56 if(result == -1) {
57 dbgprintf("%s: Reading random bytes failed.\n",
58 __func__);
59--
602.7.4
61
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb
index d6d3dc835..4bbda4c9e 100644
--- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb
+++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb
@@ -51,7 +51,8 @@ SRC_URI_append_x86-64 = " file://x86_sys_io.patch file://x86_basename.patch \
51 51
52SRC_URI_append_aarch64 = " file://arm64_purgatory-Makefile-remove-unknown-flags.patch \ 52SRC_URI_append_aarch64 = " file://arm64_purgatory-Makefile-remove-unknown-flags.patch \
53 file://arm64_kexec-image-header.h-add-missing-le64toh.patch \ 53 file://arm64_kexec-image-header.h-add-missing-le64toh.patch \
54 file://arm64-crashdump-arm64.c-fix-warning.patch" 54 file://arm64-crashdump-arm64.c-fix-warning.patch \
55 file://arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch"
55 56
56SRC_URI_append_powerpc = " file://powerpc-purgatory-Makefile-remove-unknown-flags.patch" 57SRC_URI_append_powerpc = " file://powerpc-purgatory-Makefile-remove-unknown-flags.patch"
57 58