kexec-tools build on powerpc
Khalid Aziz
khalid at gonehiking.org
Tue Oct 21 14:11:47 PDT 2025
Has anyone been able to build kexec-tools 2.0.32 on ppc successfully?
powerpc build for kexec-tools debian package has been failing in
automated builds. I reproduced these build failures in a cross-build
environment. I found there were a few mismatches in variable types in
ppc code. Following changes made sense and they allowed build to
complete successfully but I do not have the hardware to test if the
final binary works:
diff --git a/kexec/arch/ppc/fs2dt.c b/kexec/arch/ppc/fs2dt.c
index fed499b..a239fd2 100644
--- a/kexec/arch/ppc/fs2dt.c
+++ b/kexec/arch/ppc/fs2dt.c
@@ -292,10 +292,10 @@ 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;
+ char *str1 = (*dentry1)->d_name;
+ char *str2 = (*dentry2)->d_name;
char *p1, *p2;
int res = 0, max_len;
diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
index d3dad0f..6d49239 100644
--- a/kexec/arch/ppc/kexec-ppc.c
+++ b/kexec/arch/ppc/kexec-ppc.c
@@ -109,7 +109,7 @@ int read_memory_region_limits(int fd, unsigned long long *start,
p++;
} else if (dt_address_cells == sizeof(unsigned long long)) {
*start = ((unsigned long long *)p)[0];
- p = (unsigned long long *)p + 1;
+ p = (unsigned long *)((unsigned long long *)p + 1);
} else {
fprintf(stderr, "Unsupported value for #address-cells : %ld\n",
dt_address_cells);
@@ -733,7 +733,7 @@ static int get_devtree_details(unsigned long kexec_flags)
perror(fname);
goto error_opencdir;
}
- if (read_memory_region_limits(fd, &rmo_base, &rmo_top) != 0)
+ if (read_memory_region_limits(fd, (unsigned long long *)&rmo_base, (unsigned long long *)&rmo_top) != 0)
goto error_openfile;
if (rmo_top > 0x30000000UL)
If these changes look right and someone with hardware can test these changes, I can send this as a patch.
---
Khalid
More information about the kexec
mailing list