mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
- I left LB_TAG_ intact because they are used by the payloads - file renames are still missing. see next commit - some lb_ renames might be missing. feel free to provide patches. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://coreboot.org/repository/coreboot-v3@564 f3766cd6-281f-0410-b1cd-43a5c92072e9
114 lines
3.3 KiB
Bash
Executable file
114 lines
3.3 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# This file is part of the coreboot project.
|
|
#
|
|
# Copyright (C) 2007 coresystems GmbH
|
|
# (Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH)
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
#
|
|
|
|
ARCH=`uname -m | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ \
|
|
-e s/arm.*/arm/ -e s/sa110/arm/ \
|
|
-e s/s390x/s390/ -e s/parisc64/parisc/ \
|
|
-e s/ppc.*/powerpc/ -e s/mips.*/mips/`
|
|
|
|
OS=`uname -s`
|
|
|
|
testcc()
|
|
{
|
|
TMP=".$$$$.tmp"
|
|
$1 $2 -S -xc /dev/null -o $TMP > /dev/null 2>&1
|
|
ret=$?
|
|
rm -rf $TMP
|
|
return $ret
|
|
}
|
|
|
|
searchgnu()
|
|
{
|
|
# $1 short name
|
|
# result: GNU version of that tool on stdout
|
|
# or no output if no GNU version was found
|
|
for i in "$1" "g$1" "gnu$1"; do
|
|
if test -x "`which $i 2>/dev/null`"; then
|
|
if test `$i --version 2>/dev/null |grep -c GNU` -gt 0; then
|
|
echo $i
|
|
return
|
|
fi
|
|
fi
|
|
done
|
|
echo "ERROR: Missing toolchain: $1" >&2
|
|
exit 1
|
|
}
|
|
|
|
case "$ARCH" in
|
|
"x86_64")
|
|
echo "CC_x86 := gcc -m32"
|
|
CC="gcc -m32"
|
|
|
|
searchgnu ar >/dev/null && echo "AR_x86 := $(searchgnu ar)"
|
|
searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as) --32"
|
|
searchgnu ld >/dev/null && echo "LD_x86 := $(searchgnu ld) -b elf32-i386 -melf_i386"
|
|
searchgnu nm >/dev/null && echo "NM_x86 := $(searchgnu nm)"
|
|
searchgnu objcopy >/dev/null && echo "OBJCOPY_x86 := $(searchgnu objcopy)"
|
|
;;
|
|
"x86")
|
|
if [ "$OS" != "Darwin" ]; then
|
|
echo "CC_x86 := gcc"
|
|
CC="gcc"
|
|
|
|
searchgnu ar >/dev/null && echo "AR_x86 := $(searchgnu ar)"
|
|
searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as)"
|
|
searchgnu ld >/dev/null && echo "LD_x86 := $(searchgnu ld)"
|
|
searchgnu nm >/dev/null && echo "NM_x86 := $(searchgnu nm)"
|
|
searchgnu objcopy >/dev/null && echo "OBJCOPY_x86 := $(searchgnu objcopy)"
|
|
else
|
|
CC=`find /opt/local/bin/ -name "i386-elf-gcc-*"`
|
|
if [ "$CC" == "" ]; then
|
|
echo "ERROR: Please install i386-elf-gcc from MacPorts" >&2
|
|
exit 1
|
|
fi
|
|
echo "CC_x86 := $CC"
|
|
echo "AR_x86 := i386-elf-ar"
|
|
echo "AS_x86 := i386-elf-as"
|
|
echo "LD_x86 := i386-elf-ld"
|
|
echo "NM_x86 := i386-elf-nm"
|
|
echo "OBJCOPY_x86 := i386-elf-objcopy"
|
|
echo "INTLCFLAGS := -I/opt/local/include"
|
|
echo "INTLLIBS := -L/opt/local/lib -lintl"
|
|
fi
|
|
;;
|
|
*)
|
|
# FIXME: This should be detected.
|
|
CC="i386-linux-gcc"
|
|
echo "CC_x86 := i386-linux-gcc"
|
|
echo "AR_x86 := i386-linux-ar"
|
|
echo "AS_x86 := i386-linux-as"
|
|
echo "LD_x86 := i386-linux-ld"
|
|
echo "NM_x86 := i386-linux-nm"
|
|
echo "OBJCOPY_x86 := i386-linux-objcopy"
|
|
;;
|
|
esac
|
|
|
|
# This is where we test for various flags and other things
|
|
|
|
CFLAGS=""
|
|
testcc "$CC" "-fno-stack-protector" && CFLAGS="$CFLAGS-fno-stack-protector "
|
|
|
|
echo "CFLAGS_x86 := $CFLAGS"
|
|
|
|
# TODO: The same as above for PowerPC, and other architectures
|
|
# as soon as they are supported by coreboot v3.
|
|
|