From d1efc0181d5a2bcee3099a96d9b7f2c890029d87 Mon Sep 17 00:00:00 2001 From: Andrea Adami Date: Wed, 5 Sep 2018 17:45:26 +0200 Subject: 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 Signed-off-by: Khem Raj --- ...-arm64.c-workaround-for-getrandom-syscall.patch | 61 ++++++++++++++++++++++ .../recipes-kernel/kexec/kexec-tools-klibc_git.bb | 3 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch (limited to 'meta-initramfs') 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 0000000000..b22ac3aca4 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch @@ -0,0 +1,61 @@ +From 10afeecd10499fbd64b2c68d3b076c6906df441f Mon Sep 17 00:00:00 2001 +From: Andrea Adami +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 + +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 +--- + 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 7a12479..8a7f5c5 100644 +--- a/kexec/arch/arm64/kexec-arm64.c ++++ b/kexec/arch/arm64/kexec-arm64.c +@@ -16,7 +16,11 @@ + #include + + #include ++ ++#ifndef __KLIBC__ + #include ++#endif ++ + #include + #include + +@@ -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) { + dbgprintf("%s: Reading random bytes failed.\n", + __func__); +-- +2.7.4 + 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 d6d3dc8352..4bbda4c9e1 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 \ SRC_URI_append_aarch64 = " file://arm64_purgatory-Makefile-remove-unknown-flags.patch \ file://arm64_kexec-image-header.h-add-missing-le64toh.patch \ - file://arm64-crashdump-arm64.c-fix-warning.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" -- cgit 1.2.3-korg