diff options
| author | Khem Raj <raj.khem@gmail.com> | 2024-05-23 07:59:17 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-28 09:38:24 +0100 |
| commit | d79dfb75799c7c370a42582104895b527ab945f1 (patch) | |
| tree | 3d50045573fc9726ca98c399376e569aa93e18b8 | |
| parent | 6327a50e03558e5bb67aee29d8446aac4f6f8b38 (diff) | |
| download | poky-d79dfb75799c7c370a42582104895b527ab945f1.tar.gz | |
kexec-tools: Fix build with GCC-14 on musl
(From OE-Core rev: 704f51f72c301bd081a635dbe94e52aa97ffb827)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-kernel/kexec/kexec-tools/0001-x86-linux-setup.c-Use-POSIX-basename-API.patch | 54 | ||||
| -rw-r--r-- | meta/recipes-kernel/kexec/kexec-tools_2.0.28.bb | 1 |
2 files changed, 55 insertions, 0 deletions
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0001-x86-linux-setup.c-Use-POSIX-basename-API.patch b/meta/recipes-kernel/kexec/kexec-tools/0001-x86-linux-setup.c-Use-POSIX-basename-API.patch new file mode 100644 index 0000000000..e223f45998 --- /dev/null +++ b/meta/recipes-kernel/kexec/kexec-tools/0001-x86-linux-setup.c-Use-POSIX-basename-API.patch | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | From 32c8ffa7ace6f1b7e63f9ddffab00b00c36a7b57 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 15 May 2024 21:18:08 -0700 | ||
| 4 | Subject: [PATCH] x86-linux-setup.c: Use POSIX basename API | ||
| 5 | |||
| 6 | Musl C library only supports POSIX basename function. while glibc has | ||
| 7 | both GNU extention as well as POSIX basename implemented. Switch to | ||
| 8 | using posix version, so it can work across musl and glibc | ||
| 9 | |||
| 10 | basename prototype has been removed from string.h from latest musl [1] | ||
| 11 | compilers e.g. clang-18/GCC-14 flags the absense of prototype as error. | ||
| 12 | therefore include libgen.h for providing it. | ||
| 13 | |||
| 14 | [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 | ||
| 15 | |||
| 16 | Upstream-Status: Submitted [https://lists.infradead.org/pipermail/kexec/2024-May/030034.html] | ||
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 18 | --- | ||
| 19 | kexec/arch/i386/x86-linux-setup.c | 9 ++++++--- | ||
| 20 | 1 file changed, 6 insertions(+), 3 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c | ||
| 23 | index 9a281dc..73251b9 100644 | ||
| 24 | --- a/kexec/arch/i386/x86-linux-setup.c | ||
| 25 | +++ b/kexec/arch/i386/x86-linux-setup.c | ||
| 26 | @@ -14,6 +14,7 @@ | ||
| 27 | * | ||
| 28 | */ | ||
| 29 | #define _GNU_SOURCE | ||
| 30 | +#include <libgen.h> | ||
| 31 | #include <stdint.h> | ||
| 32 | #include <stdio.h> | ||
| 33 | #include <string.h> | ||
| 34 | @@ -329,12 +330,14 @@ static int add_edd_entry(struct x86_linux_param_header *real_mode, | ||
| 35 | memset(edd_info, 0, sizeof(struct edd_info)); | ||
| 36 | |||
| 37 | /* extract the device number */ | ||
| 38 | - if (sscanf(basename(sysfs_name), "int13_dev%hhx", &devnum) != 1) { | ||
| 39 | + char* sysfs_name_copy = strdup(sysfs_name); | ||
| 40 | + if (sscanf(basename(sysfs_name_copy), "int13_dev%hhx", &devnum) != 1) { | ||
| 41 | fprintf(stderr, "Invalid format of int13_dev dir " | ||
| 42 | - "entry: %s\n", basename(sysfs_name)); | ||
| 43 | + "entry: %s\n", basename(sysfs_name_copy)); | ||
| 44 | + free(sysfs_name_copy); | ||
| 45 | return -1; | ||
| 46 | } | ||
| 47 | - | ||
| 48 | + free(sysfs_name_copy); | ||
| 49 | /* if there's a MBR signature, then add it */ | ||
| 50 | if (file_scanf(sysfs_name, "mbr_signature", "0x%x", &mbr_sig) == 1) { | ||
| 51 | real_mode->edd_mbr_sig_buffer[*current_mbr] = mbr_sig; | ||
| 52 | -- | ||
| 53 | 2.45.1 | ||
| 54 | |||
diff --git a/meta/recipes-kernel/kexec/kexec-tools_2.0.28.bb b/meta/recipes-kernel/kexec/kexec-tools_2.0.28.bb index c39fff834d..b60c51df4a 100644 --- a/meta/recipes-kernel/kexec/kexec-tools_2.0.28.bb +++ b/meta/recipes-kernel/kexec/kexec-tools_2.0.28.bb | |||
| @@ -18,6 +18,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz | |||
| 18 | file://0005-Disable-PIE-during-link.patch \ | 18 | file://0005-Disable-PIE-during-link.patch \ |
| 19 | file://0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch \ | 19 | file://0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch \ |
| 20 | file://Fix-building-on-x86_64-with-binutils-2.41.patch \ | 20 | file://Fix-building-on-x86_64-with-binutils-2.41.patch \ |
| 21 | file://0001-x86-linux-setup.c-Use-POSIX-basename-API.patch \ | ||
| 21 | " | 22 | " |
| 22 | 23 | ||
| 23 | SRC_URI[sha256sum] = "f33d2660b3e38d25a127e87097978e0f7a9a73ab5151a29eb80974d169ff6a29" | 24 | SRC_URI[sha256sum] = "f33d2660b3e38d25a127e87097978e0f7a9a73ab5151a29eb80974d169ff6a29" |
