Patrick Georgi (patrick@georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3530
-gerrit
commit 2e9d0b340b671cabd2684d95b2edfa5d6cb1bebf Author: Patrick Georgi patrick.georgi@secunet.com Date: Thu Feb 21 14:33:25 2013 +0100
libpayload: Make lpgcc wrapper usable for in-tree builds
Teach lpgcc to look in the in-coreboot tree directory structure, too.
Change-Id: I3809456d072ce2f91542b0edb3fd39f536298cc2 Signed-off-by: Patrick Georgi patrick.georgi@secunet.com --- payloads/libpayload/bin/lp.functions | 4 +- payloads/libpayload/bin/lpgcc | 71 ++++++++++++++++++++++++------------ 2 files changed, 50 insertions(+), 25 deletions(-)
diff --git a/payloads/libpayload/bin/lp.functions b/payloads/libpayload/bin/lp.functions index 21b6e91..31f005d 100644 --- a/payloads/libpayload/bin/lp.functions +++ b/payloads/libpayload/bin/lp.functions @@ -49,11 +49,13 @@ fi
if [ -f $BASE/../lib/libpayload.a ]; then _LIBDIR=$BASE/../lib +elif [ -f $BASE/../build/libpayload.a ]; then + _LIBDIR=$BASE/../build else _LIBDIR=$LIBPAYLOAD_PREFIX/lib fi
-if [ -d $BASE/../include/ ]; then +if [ -d $BASE/../include ]; then _INCDIR=$BASE/../include else _INCDIR=$LIBPAYLOAD_PREFIX/include diff --git a/payloads/libpayload/bin/lpgcc b/payloads/libpayload/bin/lpgcc index 06b9021..f0b2417 100755 --- a/payloads/libpayload/bin/lpgcc +++ b/payloads/libpayload/bin/lpgcc @@ -59,9 +59,42 @@ BASE=`dirname $0` . $BASE/lp.functions
# include libpayload config -. $BASE/../libpayload.config +if [ -f $BASE/../libpayload.config ]; then + . $BASE/../libpayload.config +elif [ -f $BASE/../.config ]; then + . $BASE/../.config +else + echo "Can't find config" + exit 1 +fi + +if [ "$CONFIG_ARCH_ARMV7" = "y" ]; then + _ARCHINCDIR=$_INCDIR/armv7 + _ARCHLIBDIR=$_LIBDIR/armv7 + _ARCHEXTRA="" + _ARCH=armv7 +fi + +if [ "$CONFIG_ARCH_POWERPC" = "y" ]; then + _ARCHINCDIR=$_INCDIR/powerpc + _ARCHLIBDIR=$_LIBDIR/powerpc + _ARCHEXTRA="" + _ARCH=powerpc +fi + +if [ "$CONFIG_ARCH_X86" = "y" ]; then + _ARCHINCDIR=$_INCDIR/x86 + _ARCHLIBDIR=$_LIBDIR/x86 + _ARCHEXTRA="-m32 " + _ARCH=x86 +fi
-_LDSCRIPT="-Wl,-T,$_LIBDIR/libpayload.ldscript" +if [ -f $_LIBDIR/libpayload.ldscript ]; then + _LDDIR=$_LIBDIR +elif [ -f $BASE/../arch/$_ARCH/libpayload.ldscript ]; then + _LDDIR=$BASE/../arch/$_ARCH +fi +_LDSCRIPT="-Wl,-T,$_LDDIR/libpayload.ldscript"
trygccoption() { $DEFAULT_CC $1 -S -xc /dev/null -o /dev/null &> /dev/null @@ -107,25 +140,7 @@ while [ $# -gt 0 ]; do shift done
-if [ "$CONFIG_ARCH_ARMV7" = "y" ]; then - _ARCHINCDIR=$_INCDIR/armv7 - _ARCHLIBDIR=$_LIBDIR/armv7 - _ARCHEXTRA="" -fi - -if [ "$CONFIG_ARCH_POWERPC" = "y" ]; then - _ARCHINCDIR=$_INCDIR/powerpc - _ARCHLIBDIR=$_LIBDIR/powerpc - _ARCHEXTRA="" -fi - -if [ "$CONFIG_ARCH_X86" = "y" ]; then - _ARCHINCDIR=$_INCDIR/x86 - _ARCHLIBDIR=$_LIBDIR/x86 - _ARCHEXTRA="-m32 " -fi - -_CFLAGS="$_ARCHEXTRA -nostdinc -nostdlib -I$_INCDIR -I$_ARCHINCDIR -D__LIBPAYLOAD__=1" +_CFLAGS="$_ARCHEXTRA -nostdinc -nostdlib -I$BASE/../build -I$_INCDIR -I$_ARCHINCDIR -D__LIBPAYLOAD__=1"
# Check for the -fno-stack-protector silliness
@@ -134,7 +149,7 @@ trygccoption -fno-stack-protector
_CFLAGS="$_CFLAGS -I`$DEFAULT_CC $_ARCHEXTRA -print-search-dirs | head -n 1 | cut -d' ' -f2`include"
-_LDFLAGS="-L$BASE/../lib $_LDSCRIPT -static" +_LDFLAGS="-L$BASE/../lib -L$_LIBDIR $_LDSCRIPT -static"
if [ $DOLINK -eq 0 ]; then if [ $DEBUGME -eq 1 ]; then @@ -144,8 +159,16 @@ if [ $DOLINK -eq 0 ]; then $DEFAULT_CC $_CFLAGS $CMDLINE else _LIBGCC=`$DEFAULT_CC $_ARCHEXTRA -print-libgcc-file-name` + if [ -f $_ARCHLIBDIR/head.o ]; then + HEAD_O=$_ARCHLIBDIR/head.o + elif [ -f $BASE/../build/head.o ]; then + HEAD_O=$BASE/../build/head.o + else + echo "Could not find head.o" + exit 1 + fi if [ $DEBUGME -eq 1 ]; then - echo "$DEFAULT_CC $_CFLAGS $_LDFLAGS $_ARCHLIBDIR/head.o $CMDLINE -lpayload $_LIBGCC" + echo "$DEFAULT_CC $_CFLAGS $_LDFLAGS $HEAD_O $CMDLINE -lpayload $_LIBGCC" fi
# Note: $_ARCHLIBDIR/head.o must be the first object being linked, because it @@ -153,5 +176,5 @@ else # header to be placed below 0x2000 in the resulting image. See: # http://www.gnu.org/software/grub/manual/multiboot/html_node/OS-image-format....
- $DEFAULT_CC $_CFLAGS $_LDFLAGS $_ARCHLIBDIR/head.o $CMDLINE -lpayload $_LIBGCC + $DEFAULT_CC $_CFLAGS $_LDFLAGS $HEAD_O $CMDLINE -lpayload $_LIBGCC fi