[OpenBIOS] [PATCH] Fix configuration issues on Mac OS X

Programmingkid programmingkidx at gmail.com
Wed Dec 12 17:53:35 CET 2012


This patch fixes the problem of not correctly configuring for Mac OS X. 

On Mac OS X, the compiler is simply called gcc, so the names the switch-arch script would look for were not available. Also uname -m returns i386 on Mac OS X. This value doesn't change on 32bit or 64bit intel processors. On Linux, the value would be x86_64 for 64bit processors and i686 for 32bit processors. The 6 in 686 might be 3,4, or 5 depending on your processor type. 

With this patch I was actually able to go pretty far in the building process of making OpenBIOS. I stopped at an issue in elf_info.c. This is another issue to be solved for another time. 

signed-off-by: John Arbuckle <programmingkidx at gmail.com>

Index: config/scripts/switch-arch
===================================================================
--- config/scripts/switch-arch	(revision 1078)
+++ config/scripts/switch-arch	(working copy)
@@ -89,15 +89,25 @@
 
 archname()
 {
-    HOSTARCH=`uname -m | sed -e s/i.86/x86/ -e s/i86pc/x86/ \
-	-e s/sun4u/sparc64/ -e s/sparc$/sparc32/ \
-	-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
-	-e "s/Power Macintosh/ppc/"`
+	OS_NAME=`uname`
+	if test "$OS_NAME" = "Darwin"; then     # Can't depend on uname -m on Mac OS X
+		IS_64BIT=`sysctl hw.cpu64bit_capable`
+		if test "$IS_64BIT" = "hw.cpu64bit_capable: 1"; then
+			HOSTARCH="amd64"
+		else
+			HOSTARCH="x86"
+		fi
+	else
+		 HOSTARCH=`uname -m | sed -e s/i.86/x86/ -e s/i86pc/x86/ \
+		-e s/sun4u/sparc64/ -e s/sparc$/sparc32/ \
+		-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
+		-e "s/Power Macintosh/ppc/"`
+	fi
 }
 
 select_prefix()
 {
-    for TARGET in ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-
+    for TARGET in ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi- ''
     do
         if type ${TARGET}gcc > /dev/null 2>&1
         then




More information about the OpenBIOS mailing list