Bug#1118575: kexec-tools: Please cherry-pick upstream patch to fix build on powerpc

John Paul Adrian Glaubitz <[email protected]>
Newsgroups gmane.linux.debian.ports.powerpc
Message-ID <176113263225.4133.14161403693860913023.reportbug__34829.8536425986$1761132807$gmane$org@z6>
Source: kexec-tools
Version: 1:2.0.32-2
Severity: normal
Tags: patch upstream
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: powerpc

Hello,

kexec-tools currently FTBFS on powerpc. I have taken a look what's wrong and
submitted two patches to address these issues [1].

These patches can be easily downloaded by appending a ".patch" suffix to the
pull request URL. Attaching the patch for convenience.

Thanks,
Adrian

> [1] https://github.com/horms/kexec-tools/pull/11

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
kexec-tools-powerpc.patch (application/mbox, 3.3 KB)
From 7c55ab32897e6fb95760203c3612f5a890bd157b Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <[email protected]>
Date: Wed, 22 Oct 2025 13:10:27 +0200
Subject: [PATCH 1/2] kexec-tools: powerpc: Fix function signature of
 comparefunc()

Fixes the following build error on 32-bit PowerPC:

kexec/arch/ppc/fs2dt.c: In function 'putnode':
kexec/arch/ppc/fs2dt.c:338:51: error: passing argument 4 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types]
  338 |         numlist = scandir(pathname, &namelist, 0, comparefunc);
      |                                                   ^~~~~~~~~~~
      |                                                   |
      |                                                   int (*)(const void *, const void *)

Signed-off-by: John Paul Adrian Glaubitz <[email protected]>
---
 kexec/arch/ppc/fs2dt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kexec/arch/ppc/fs2dt.c b/kexec/arch/ppc/fs2dt.c
index fed499b4..d03b9957 100644
--- a/kexec/arch/ppc/fs2dt.c
+++ b/kexec/arch/ppc/fs2dt.c
@@ -292,7 +292,8 @@ static void putprops(char *fn, struct dirent **nlist, int numlist)
  * Compare function used to sort the device-tree directories
  * This function will be passed to scandir.
  */
-static int comparefunc(const void *dentry1, const void *dentry2)
+static int comparefunc(const struct dirent **dentry1,
+		       const struct dirent **dentry2)
 {
 	char *str1 = (*(struct dirent **)dentry1)->d_name;
 	char *str2 = (*(struct dirent **)dentry2)->d_name;

From 0ad494a409f389d40b79c982ce29dfabe748a024 Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <[email protected]>
Date: Wed, 22 Oct 2025 13:22:27 +0200
Subject: [PATCH 2/2] kexec-tools: powerpc: Fix pointer declarations in
 read_memory_region_limits()

Fixes the following two build errors on 32-bit PowerPC:

kexec/arch/ppc/kexec-ppc.c: In function 'read_memory_region_limits':
kexec/arch/ppc/kexec-ppc.c:106:11: error: assignment to 'long long unsigned int *' from incompatible pointer type 'long unsigned int *' [-Wincompatible-pointer-types]
  106 |         p = (unsigned long*)buf;
      |           ^

kexec/arch/ppc/kexec-ppc.c: In function 'read_memory_region_limits':
kexec/arch/ppc/kexec-ppc.c:112:19: error: assignment to 'long unsigned int *' from incompatible pointer type 'long long unsigned int *' [-Wincompatible-pointer-types]
  112 |                 p = (unsigned long long *)p + 1;
      |                   ^

Signed-off-by: John Paul Adrian Glaubitz <[email protected]>
---
 kexec/arch/ppc/kexec-ppc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
index d3dad0f1..e1734338 100644
--- a/kexec/arch/ppc/kexec-ppc.c
+++ b/kexec/arch/ppc/kexec-ppc.c
@@ -91,7 +91,7 @@ int read_memory_region_limits(int fd, unsigned long long *start,
 				unsigned long long *end)
 {
 	char buf[MAXBYTES];
-	unsigned long *p;
+	unsigned long long *p;
 	unsigned long nbytes = dt_address_cells + dt_size_cells;
 
 	if (lseek(fd, 0, SEEK_SET) == -1) {
@@ -103,7 +103,7 @@ int read_memory_region_limits(int fd, unsigned long long *start,
 		return -1;
 	}
 
-	p = (unsigned long*)buf;
+	p = (unsigned long long*)buf;
 	if (dt_address_cells == sizeof(unsigned long)) {
 		*start = p[0];
 		p++;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.