Skip to contentSkip to conversation

rt-tests: Makefile get machinetype from compiler instead of uname

RFC PATCH In review Frank Rowand 2 participants 3 messages May 2, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 rt-tests: Makefile get machinetype from compiler instead of uname

Fix the machinetype check for cross-compiling.

This has been tested on an x86_64 Fedora host for an x86_64 target and an ARM target. Additional testing would be greatly appreciated.

---
Makefile | 4 2 + 2 - 0 !

 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
Index: b/Makefile
===================================================================
@@ -14,8 +14,8 @@ bindir  ?= $(prefix)/bin
 mandir	?= $(prefix)/share/man
 srcdir	?= $(prefix)/src
 
-machinetype = $(shell uname -m | \
-    sed -e 's/i.86/i386/' -e 's/mips.*/mips/' -e 's/ppc.*/powerpc/')
+machinetype = $(shell $(CC) -dumpmachine | \
+    sed -e 's/-.*//' -e 's/i.86/i386/' -e 's/mips.*/mips/' -e 's/ppc.*/powerpc/')
 ifneq ($(filter x86_64 i386 ia64 mips powerpc,$(machinetype)),)
 NUMA 	:= 1
 endif
Tested-by on v1 1/1
#1 lore raw
Quoted 5 lines · Frank Rowand

Fix the machinetype check for cross-compiling.

This has been tested on an x86_64 Fedora host for an x86_64 target and an ARM target. Additional testing would be greatly appreciated.

Built in Yocto using an ARM cross compiler and ran cyclictest in qemuarm with the resulting image. Appears sane.

What problem manifested before?

Quoted 2 lines
Quoted 20 lines

---
Makefile | 4 2 + 2 - 0 !

 1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/Makefile
===================================================================

Makefile +2 -2
@@ -14,8 +14,8 @@ bindir  ?= $(prefix)/bin
 mandir	?= $(prefix)/share/man
 srcdir	?= $(prefix)/src
 
-machinetype = $(shell uname -m | \
-    sed -e 's/i.86/i386/' -e 's/mips.*/mips/' -e 's/ppc.*/powerpc/')
+machinetype = $(shell $(CC) -dumpmachine | \
+    sed -e 's/-.*//' -e 's/i.86/i386/' -e 's/mips.*/mips/' -e 's/ppc.*/powerpc/')
 ifneq ($(filter x86_64 i386 ia64 mips powerpc,$(machinetype)),)
 NUMA 	:= 1
 endif
Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
#2 lore raw
Quoted 11 lines · Darren Hart
Quoted 5 lines · Frank Rowand

Fix the machinetype check for cross-compiling.

This has been tested on an x86_64 Fedora host for an x86_64 target and an ARM target. Additional testing would be greatly appreciated.

Built in Yocto using an ARM cross compiler and ran cyclictest in qemuarm with the resulting image. Appears sane.

Quoted 6 lines

What problem manifested before?

Quoted 2 lines

Thanks!

As you and jkacur surmised, the problem I'm trying to fix is that the machinetype got the host machine type instead of the target machine type. Could definitely word the description better...

-Frank