Bug#752410: libdebian-installer: ppc64el support
Package: libdebian-installer
Version: 0.91
Severity: normal
Tags: patch
User: debian-powerpc@lists.debian.org
Usertags: ppc64el
Dear Maintainer,
here is a patch from Ubuntu for ppc64el support in libdebian-installer.
F.
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: ppc64el (ppc64le)
Kernel: Linux 3.14-1-powerpc64le (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru libdebian-installer-0.91/src/system/Makefile.am libdebian-installer-0.91/src/system/Makefile.am
--- libdebian-installer-0.91/src/system/Makefile.am 2013-12-28 08:51:24.000000000 +0000
+++ libdebian-installer-0.91/src/system/Makefile.am 2014-05-20 10:28:31.000000000 +0000
@@ -21,6 +21,7 @@
subarch-mips-linux.c \
subarch-mipsel-linux.c \
subarch-powerpc-linux.c \
+ subarch-ppc64el-linux.c \
subarch-sh4-linux.c \
subarch-sparc-linux.c \
subarch-x86-linux.c \
diff -Nru libdebian-installer-0.91/src/system/subarch-ppc64el-linux.c libdebian-installer-0.91/src/system/subarch-ppc64el-linux.c
--- libdebian-installer-0.91/src/system/subarch-ppc64el-linux.c 1970-01-01 00:00:00.000000000 +0000
+++ libdebian-installer-0.91/src/system/subarch-ppc64el-linux.c 2014-05-20 10:28:31.000000000 +0000
@@ -0,0 +1,92 @@
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+
+#include <debian-installer/system/subarch.h>
+
+struct map {
+ char *entry;
+ char *ret;
+};
+
+static struct map map_generation[] = {
+ { "OldWorld", "powermac_oldworld" },
+ { "NewWorld", "powermac_newworld" },
+ { "NuBus", "powermac_nubus" },
+ { NULL, NULL }
+};
+
+static struct map map_machine[] = {
+ { "PReP", "prep" },
+ { "CHRP Pegasos", "chrp_pegasos" },
+ { "EFIKA", "chrp_pegasos" },
+ { "CHRP IBM", "chrp_rs6k" },
+ { "CHRP", "chrp" },
+ { "Amiga", "amiga" },
+ { "64-bit iSeries Logical Partition", "iseries" },
+ { NULL, NULL }
+};
+
+static struct map map_platform[] = {
+ { "PS3", "ps3" },
+ { "Cell", "cell" },
+ { "PA Semi", "pasemi" },
+ { "Maple", "chrp_ibm" },
+ { "pSeries", "chrp_ibm" },
+ { "P4080 DS", "fsl" },
+ { "QEMU e500", "fsl" },
+ { NULL, NULL }
+};
+
+static char *check_map(struct map map[], const char *entry)
+{
+ for (; map->entry; map++)
+ if (!strncasecmp(map->entry, entry, strlen(map->entry)))
+ return map->ret;
+
+ return NULL;
+}
+
+const char *di_system_subarch_analyze(void)
+{
+ FILE *cpuinfo;
+ char line[1024];
+ char cpuinfo_platform[256], cpuinfo_machine[256], cpuinfo_generation[256];
+ char *ret, *pos;
+
+ cpuinfo = fopen("/proc/cpuinfo", "r");
+ if (cpuinfo == NULL)
+ return "unknown";
+
+ while (fgets(line, sizeof(line), cpuinfo) != NULL) {
+ pos = strchr(line, ':');
+ if (pos == NULL)
+ continue;
+ while (*++pos && (*pos == '\t' || *pos == ' '));
+
+ if (strstr(line, "platform") == line)
+ strncpy(cpuinfo_platform, pos, sizeof(cpuinfo_platform));
+
+ if (strstr(line, "machine") == line)
+ strncpy(cpuinfo_machine, pos, sizeof(cpuinfo_machine));
+
+ if (strstr(line, "pmac-generation") == line)
+ strncpy(cpuinfo_generation, pos, sizeof(cpuinfo_generation));
+ }
+
+ fclose(cpuinfo);
+
+ ret = check_map(map_platform, cpuinfo_platform);
+ if (ret)
+ return ret;
+ ret = check_map(map_machine, cpuinfo_machine);
+ if (ret)
+ return ret;
+ ret = check_map(map_generation, cpuinfo_generation);
+ if (ret)
+ return ret;
+
+ return "unknown";
+}
Reply to: