summaryrefslogtreecommitdiff
path: root/kexec/phys_arch.c
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2009-11-26 09:44:46 +1100
committerSimon Horman <horms@verge.net.au>2009-11-26 09:44:46 +1100
commit5545216da4360d6494cc7ba574e04620a826a332 (patch)
tree6b6135dca409276cac785d3bc2c7188deb0cada2 /kexec/phys_arch.c
parent90ddba23d1abdd727aabbf1070904ae172ebb273 (diff)
arm: fix architecture detection
There are many variants of arm and it seems to be impractical to add them all to the arches array. Instead just match on the leading "arm" portion of the utsname. I have made this specific to arm for now, as I'm not sure what fallout might occur if it was made more generic. e.g. arch ppc matching utsname ppc64 is a concern. Based on variants of this patch submitted by Andrea Adami and Marc Andre Tanner, and feedback from Magnus Damm. Cc: Andrea Adami <andrea.adami@gmail.com> Cc: Marc Andre Tanner <mat@brain-dump.org> Cc: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/phys_arch.c')
-rw-r--r--kexec/phys_arch.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/kexec/phys_arch.c b/kexec/phys_arch.c
index ff8c28b..1571a0f 100644
--- a/kexec/phys_arch.c
+++ b/kexec/phys_arch.c
@@ -13,9 +13,14 @@ long physical_arch(void)
return -1;
}
- for (i = 0; arches[i].machine; ++i)
+ for (i = 0; arches[i].machine; ++i) {
if (strcmp(utsname.machine, arches[i].machine) == 0)
return arches[i].arch;
+ if ((strcmp(arches[i].machine, "arm") == 0) &&
+ (strncmp(utsname.machine, arches[i].machine,
+ strlen(arches[i].machine)) == 0))
+ return arches[i].arch;
+ }
fprintf(stderr, "Unsupported machine type: %s\n",
utsname.machine);