Martin tells me this is necessary for d-i to pick the correct kernel while installing. I believe him ;-)
As with flash-kernel I needed to make libdebian-installer use /proc/device-tree/model if it exists (and continue to use /proc/cpuinfo:Hardware if it does not). Pull request is below, followed by the patch. I tested with the attached simple test program, works on my dreamplug and FWIW does the expected thing in an armel chroot my (non-DT) mx5 board (i.e. it reads proc/cpuinfo but eventually returns "unknown"). I didn't try with a real install image. Should I file a bug with this too? Ian. The following changes since commit ae2565e660e2d80b0b4d1373b8152b9cf239ca6c: Releasing version 0.81 (2012-06-01 18:51:10 +0200) are available in the git repository at: git://gitorious.org/ijc-debian/libdebian-installer.git dreamplug for you to fetch changes up to 4ac8107d9338cd0ff48c1223529516359c32fec6: Add Dreamplug device (Kirkwood) (2012-07-10 21:20:51 +0000) ---------------------------------------------------------------- Ian Campbell (1): Add Dreamplug device (Kirkwood) debian/changelog | 8 +++++++ src/system/subarch-arm-linux.c | 41 +++++++++++++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 5 deletions(-) >From 4ac8107d9338cd0ff48c1223529516359c32fec6 Mon Sep 17 00:00:00 2001 From: Ian Campbell <i...@hellion.org.uk> Date: Tue, 10 Jul 2012 21:20:51 +0000 Subject: [PATCH] Add Dreamplug device (Kirkwood) --- debian/changelog | 8 +++++++ src/system/subarch-arm-linux.c | 41 +++++++++++++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 11a4b32..03ea18f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +libdebian-installer (0.82) unstable; urgency=low + + [ Ian Campbell ] + * Support for reading hardware model from Device Tree (armel). + * Add Dreamplug device (Kirkwood) + + -- Ian Campbell <i...@hellion.org.uk> Tue, 10 Jul 2012 21:15:56 +0000 + libdebian-installer (0.81) unstable; urgency=low [ Simon Guinot ] diff --git a/src/system/subarch-arm-linux.c b/src/system/subarch-arm-linux.c index af315ea..3ff3d16 100644 --- a/src/system/subarch-arm-linux.c +++ b/src/system/subarch-arm-linux.c @@ -41,6 +41,7 @@ static struct map map_hardware[] = { { "Marvell OpenRD Ultimate Board", "kirkwood" }, { "Marvell SheevaPlug Reference Board", "kirkwood" }, { "Marvell eSATA SheevaPlug Reference Board", "kirkwood" }, + { "Globalscale Technologies Dreamplug", "kirkwood" }, { "QNAP TS-119/TS-219", "kirkwood" }, { "QNAP TS-41x", "kirkwood" }, { "Seagate FreeAgent DockStar", "kirkwood" }, @@ -89,17 +90,30 @@ static struct map map_hardware[] = { { NULL, NULL } }; -const char *di_system_subarch_analyze(void) +static int read_dt_model(char *entry, int entry_len) +{ + FILE *model; + int ret; + + model = fopen("/proc/device-tree/model", "r"); + if (model == NULL) + return 1; + + ret = fgets(entry, entry_len, model) == NULL; + fclose(model); + return ret; +} + +static int read_cpuinfo(char *entry, int entry_len) { FILE *cpuinfo; char line[1024]; - char entry[256]; char *pos; - int i; + int ret = 1; cpuinfo = fopen("/proc/cpuinfo", "r"); if (cpuinfo == NULL) - return "unknown"; + return 1; while (fgets(line, sizeof(line), cpuinfo) != NULL) { @@ -110,12 +124,29 @@ const char *di_system_subarch_analyze(void) continue; while (*++pos && (*pos == '\t' || *pos == ' ')); - strncpy(entry, pos, sizeof(entry)); + strncpy(entry, pos, entry_len); + ret = 0; break; } } fclose(cpuinfo); + return ret; +} + +const char *di_system_subarch_analyze(void) +{ + char entry[256]; + int i; + int ret; + + entry[0] = '\0'; + + ret = read_dt_model(entry, sizeof(entry)); + if (ret) + ret = read_cpuinfo(entry, sizeof(entry)); + if (ret) + return "unknown"; for (i = 0; map_hardware[i].entry; i++) { -- 1.7.9.1
#include <stdio.h> #include <debian-installer/system/subarch.h> int main(int argc, char **argv) { printf("di_system_subarch_analyze = %s\n", di_system_subarch_analyze()); printf("di_system_subarch_analyze_guess = %s\n", di_system_subarch_analyze_guess()); return 0; }