[OpenBIOS] [commit] r1347 - trunk/openbios-devel/config/scripts

repository service svn at openbios.org
Sun Jul 12 14:24:12 CEST 2015


Author: mcayland
Date: Sun Jul 12 14:24:11 2015
New Revision: 1347
URL: http://tracker.coreboot.org/trac/openbios/changeset/1347

Log:
switch-arch: select 64bit compiler if 32bit compiler is not found

On Fedora, powerpc64 cross-compiler is part of the distro, not
the powerpc32 compiler.

As I'm lazy and powerpc64 cross-compiler is able to generate
32bit binaries, this patch modifies switch-arch to allow
to use cross-compiler from a list of architectures instead of
only the target architecture.

I've modified only the powerpc32 target, as I'm not able to test
the other architectures (and Fedora provides only cross-compiler
for powerpc).

Signed-off-by: Laurent Vivier <laurent at vivier.eu>
Sigend-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/config/scripts/switch-arch

Modified: trunk/openbios-devel/config/scripts/switch-arch
==============================================================================
--- trunk/openbios-devel/config/scripts/switch-arch	Sun Jun 21 20:52:51 2015	(r1346)
+++ trunk/openbios-devel/config/scripts/switch-arch	Sun Jul 12 14:24:11 2015	(r1347)
@@ -99,23 +99,25 @@
 
 select_prefix()
 {
-    TARGETS="${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-"
+    for target_arch ; do
+        TARGETS="${target_arch}-unknown-linux-gnu- ${target_arch}-linux-gnu- ${target_arch}-linux- ${target_arch}-elf- ${target_arch}-eabi-"
 
-    if [ x"$CROSS_COMPILE" != "x" ]; then
-        TARGETS=$CROSS_COMPILE
-    fi
+        if [ x"$CROSS_COMPILE" != "x" ]; then
+            TARGETS=$CROSS_COMPILE
+        fi
 
-    for TARGET in $TARGETS
-    do
-        if type ${TARGET}gcc > /dev/null 2>&1
-        then
+        for TARGET in $TARGETS
+        do
+            if type ${TARGET}gcc > /dev/null 2>&1
+            then
+                return
+            fi
+        done
+        if [ "$ARCH" = "$HOSTARCH" ]; then
             return
         fi
     done
-    if [ "$ARCH" = "$HOSTARCH" ]; then
-        return
-    fi
-    echo "ERROR: no ${1} cross-compiler found !" 1>&2
+    echo "ERROR: no $* cross-compiler found !" 1>&2
     exit 1
 }
 
@@ -251,7 +253,7 @@
         ;;
 
         ppc)
-        select_prefix powerpc
+        select_prefix powerpc powerpc64
         if [ "$unix" = "no" ]; then
             CFLAGS="-m32 -msoft-float -fno-builtin-bcopy -fno-builtin-log2"
             AS_FLAGS="-m32"



More information about the OpenBIOS mailing list