Skip to contentSkip to conversation

Architecture detection code

PATCH New Marc Andre Tanner 3 participants 6 messages Nov 20, 2009 – Nov 27, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I recently had the same problem as Magnus and came up with the following patch. It changes the architecture detection code to also accept partiall matches. Which means and "arm" entry in arch_map_entry will work for all arm* versions.

Please consider applying this patch and reverting the two from Magnus.

Thanks,
Marc

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw

PATCH 1/1 Accept architectures which partially match

It doesn't make sense to add every possible architecture family / endianness combination.

---
 kexec/phys_arch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kexec/phys_arch.c +1 -1
index ff8c28b..2b3cbf9 100644
@@ -14,7 +14,7 @@ long physical_arch(void)
 	}
 
 	for (i = 0; arches[i].machine; ++i)
-		if (strcmp(utsname.machine, arches[i].machine) == 0)
+		if (strncmp(utsname.machine, arches[i].machine, strlen(arches[i].machine)) == 0)
 			return arches[i].arch;
 
 	fprintf(stderr, "Unsupported machine type: %s\n",
Signature · 7 lines
1.6.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw
In reply to Marc Andre Tanner
Quoted 7 lines · Marc Andre Tanner

I recently had the same problem as Magnus and came up with the following patch. It changes the architecture detection code to also accept partiall matches. Which means and "arm" entry in arch_map_entry will work for all arm* versions.

Please consider applying this patch and reverting the two from Magnus.

Sure, I'm happy to see that the arm supports gets more attention! =)

/ magnus

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw
Quoted 10 lines · Magnus Damm
Quoted 7 lines · Marc Andre Tanner

I recently had the same problem as Magnus and came up with the following patch. It changes the architecture detection code to also accept partiall matches. Which means and "arm" entry in arch_map_entry will work for all arm* versions.

Please consider applying this patch and reverting the two from Magnus.

Sure, I'm happy to see that the arm supports gets more attention! =)

Hi,

I'd like to apply the following patch. Let me know if I've botched things.

--------------------------------------------------------------------------

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 <[email protected]>
Cc Marc Andre Tanner <[email protected]>
Cc Magnus Damm <[email protected]>
---
 kexec/arch/arm/kexec-arm.c |    2 --
 kexec/phys_arch.c          |    7 ++++++-
 2 files changed, 6 insertions(+), 3 deletions(-)
kexec/arch/arm/kexec-arm.c +0 -2
index 3fdf839..4b4a659 100644
@@ -113,8 +113,6 @@ int arch_process_options(int argc, char **argv)
 
 const struct arch_map_entry arches[] = {
 	{ "arm", KEXEC_ARCH_ARM },
-	{ "armv6l", KEXEC_ARCH_ARM },
-	{ "armv7l", KEXEC_ARCH_ARM },
 	{ 0 },
 };
 
kexec/phys_arch.c +6 -1
index ff8c28b..1571a0f 100644
@@ -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);
Signature · 7 lines
1.6.5.3


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#4 lore raw
Quoted 7 lines · Simon Horman
Quoted 6 lines · Magnus Damm
Quoted 5 lines · Marc Andre Tanner

I recently had the same problem as Magnus and came up with the following patch. It changes the architecture detection code to also accept partiall matches. Which means and "arm" entry in arch_map_entry will work for all arm* versions.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Please consider applying this patch and reverting the two from Magnus.

Sure, I'm happy to see that the arm supports gets more attention! =)

Hi,

I'd like to apply the following patch. Let me know if I've botched things.

Looks good.

Thanks,
Marc

Signature · 6 lines
 Marc Andre Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#5 lore raw
Quoted 11 lines · Marc Andre Tanner
Quoted 10 lines · Simon Horman
Quoted 9 lines · Magnus Damm
Quoted 7 lines · Marc Andre Tanner

I recently had the same problem as Magnus and came up with the following patch. It changes the architecture detection code to also accept partiall matches. Which means and "arm" entry in arch_map_entry will work for all arm* versions.

Please consider applying this patch and reverting the two from Magnus.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Sure, I'm happy to see that the arm supports gets more attention! =)

Hi,

I'd like to apply the following patch. Let me know if I've botched things.

Looks good.

Thanks, I've applied it.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec