abuild:
- add configure only mode to easily and quickly check Config.lb and Option.lb files - fix up cross compiler handling - don't use in-place sed, not all sed versions can do it - use perl instead of date to avoid non-gnu date trouble Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Myles Watson <mylesgw@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3992 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
a8e1168064
commit
cc44b06d9d
|
@ -32,6 +32,9 @@ TESTSUBMISSION="http://qa.coreboot.org/deployment/send.php"
|
||||||
# Number of CPUs to compile on per default
|
# Number of CPUs to compile on per default
|
||||||
cpus=1
|
cpus=1
|
||||||
|
|
||||||
|
# Configure-only mode
|
||||||
|
configureonly=0
|
||||||
|
|
||||||
# One might want to adjust these in case of cross compiling
|
# One might want to adjust these in case of cross compiling
|
||||||
MAKE="make"
|
MAKE="make"
|
||||||
PYTHON=python
|
PYTHON=python
|
||||||
|
@ -47,6 +50,7 @@ silent=
|
||||||
stackprotect=false
|
stackprotect=false
|
||||||
|
|
||||||
ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
|
ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
|
||||||
|
-e s/i86pc/i386/ \
|
||||||
-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
|
-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
|
||||||
-e "s/Power Macintosh/ppc/"`
|
-e "s/Power Macintosh/ppc/"`
|
||||||
|
|
||||||
|
@ -183,14 +187,15 @@ EOF
|
||||||
COMPRESSION="# no compression"
|
COMPRESSION="# no compression"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i.pre -e s:VENDOR:$VENDOR:g \
|
cp $TARGET/Config-${VENDOR}_${MAINBOARD}.lb $TARGET/Config-${VENDOR}_${MAINBOARD}.lb.pre
|
||||||
|
sed -e s:VENDOR:$VENDOR:g \
|
||||||
-e s:MAINBOARD:$MAINBOARD:g \
|
-e s:MAINBOARD:$MAINBOARD:g \
|
||||||
-e s:payload\ __PAYLOAD__:payload\ $PAYLOAD:g \
|
-e s:payload\ __PAYLOAD__:payload\ $PAYLOAD:g \
|
||||||
-e s:CROSSCC:"$CC":g \
|
-e s:CROSSCC:"$CC":g \
|
||||||
-e s:CROSS_PREFIX:"$CROSS_COMPILE":g \
|
-e s:CROSS_PREFIX:"$CROSS_COMPILE":g \
|
||||||
-e s:CROSS_HOSTCC:"$HOSTCC":g \
|
-e s:CROSS_HOSTCC:"$HOSTCC":g \
|
||||||
-e s:__COMPRESSION__:"$COMPRESSION":g \
|
-e s:__COMPRESSION__:"$COMPRESSION":g \
|
||||||
$TARGET/Config-${VENDOR}_${MAINBOARD}.lb
|
$TARGET/Config-${VENDOR}_${MAINBOARD}.lb.pre > $TARGET/Config-${VENDOR}_${MAINBOARD}.lb
|
||||||
printf " ok\n"
|
printf " ok\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,10 +265,10 @@ function compile_target
|
||||||
|
|
||||||
CURR=$( pwd )
|
CURR=$( pwd )
|
||||||
cd $TARGET/${VENDOR}_${MAINBOARD}
|
cd $TARGET/${VENDOR}_${MAINBOARD}
|
||||||
stime=`date +%s`
|
stime=`perl -e 'print time();'`
|
||||||
eval $MAKE $silent -j $cpus &> make.log
|
eval $MAKE $silent -j $cpus &> make.log
|
||||||
ret=$?
|
ret=$?
|
||||||
etime=`date +%s`
|
etime=`perl -e 'print time();'`
|
||||||
duration=$(( $etime - $stime ))
|
duration=$(( $etime - $stime ))
|
||||||
if [ $ret -eq 0 ]; then
|
if [ $ret -eq 0 ]; then
|
||||||
xml " <compile>ok</compile>"
|
xml " <compile>ok</compile>"
|
||||||
|
@ -316,20 +321,22 @@ function build_target
|
||||||
|
|
||||||
# default setting
|
# default setting
|
||||||
|
|
||||||
if [ "`uname -s`" == Darwin ]; then
|
CC="${CROSS_COMPILE}gcc"
|
||||||
# Darwin requires i386-elf-[binuitils|gcc] from MacPorts
|
CROSS_COMPILE=""
|
||||||
# and a link from i386-elf-gcc-<version> to i386-elf-gcc
|
found_crosscompiler=false
|
||||||
CC="$TARCH-elf-gcc -Wa,--divide"
|
if which $TARCH-elf-gcc 2>/dev/null >/dev/null; then
|
||||||
CROSS_COMPILE="$TARCH-elf-"
|
# i386-elf target needs --divide, for i386-linux, that's the default
|
||||||
else
|
CC="$TARCH-elf-gcc"
|
||||||
CC='$(CROSS_COMPILE)gcc'
|
if [ "$TARCH" = "i386" ]; then
|
||||||
CROSS_COMPILE=''
|
CC="$CC -Wa,--divide"
|
||||||
|
fi
|
||||||
|
echo using $CC
|
||||||
|
CROSS_COMPILE="$TARCH-elf-"
|
||||||
|
found_crosscompiler=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$stackprotect" = "true" ]; then
|
if [ "$stackprotect" = "true" ]; then
|
||||||
CC="$CC -fno-stack-protector"
|
CC="$CC -fno-stack-protector"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
HOSTCC='gcc'
|
HOSTCC='gcc'
|
||||||
|
|
||||||
printf "Processing mainboard/$VENDOR/$MAINBOARD"
|
printf "Processing mainboard/$VENDOR/$MAINBOARD"
|
||||||
|
@ -345,7 +352,7 @@ function build_target
|
||||||
[ -r "$LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \
|
[ -r "$LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \
|
||||||
source $LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
|
source $LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
|
||||||
|
|
||||||
if [ "$ARCH" == "$TARCH" ]; then
|
if [ "$ARCH" = "$TARCH" -o $found_crosscompiler = true ]; then
|
||||||
printf " ($TARCH: ok)\n"
|
printf " ($TARCH: ok)\n"
|
||||||
else
|
else
|
||||||
found_crosscompiler=false
|
found_crosscompiler=false
|
||||||
|
@ -408,7 +415,7 @@ function build_target
|
||||||
}
|
}
|
||||||
|
|
||||||
create_buildenv $VENDOR $MAINBOARD
|
create_buildenv $VENDOR $MAINBOARD
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 -a $configureonly -eq 0 ]; then
|
||||||
compile_target $VENDOR $MAINBOARD &&
|
compile_target $VENDOR $MAINBOARD &&
|
||||||
xml " <status>ok</status>" ||
|
xml " <status>ok</status>" ||
|
||||||
xml "<status>broken</status>"
|
xml "<status>broken</status>"
|
||||||
|
@ -477,6 +484,7 @@ function myhelp
|
||||||
printf " [-c|--cpus <numcpus>] build on <numcpus> at the same time\n"
|
printf " [-c|--cpus <numcpus>] build on <numcpus> at the same time\n"
|
||||||
printf " [-s|--silent] omit compiler calls in logs\n"
|
printf " [-s|--silent] omit compiler calls in logs\n"
|
||||||
printf " [-ns|--nostackprotect] use gcc -fno-stack-protector option\n"
|
printf " [-ns|--nostackprotect] use gcc -fno-stack-protector option\n"
|
||||||
|
printf " [-C|--config] configure-only mode\n"
|
||||||
printf " [lbroot] absolute path to coreboot sources\n"
|
printf " [lbroot] absolute path to coreboot sources\n"
|
||||||
printf " (defaults to $LBROOT)\n\n"
|
printf " (defaults to $LBROOT)\n\n"
|
||||||
}
|
}
|
||||||
|
@ -507,11 +515,11 @@ verbose=false
|
||||||
getoptbrand="`getopt -V`"
|
getoptbrand="`getopt -V`"
|
||||||
if [ "${getoptbrand:0:6}" == "getopt" ]; then
|
if [ "${getoptbrand:0:6}" == "getopt" ]; then
|
||||||
# Detected GNU getopt that supports long options.
|
# Detected GNU getopt that supports long options.
|
||||||
args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml Vvhat:bp:Tc:sx -- "$@"`
|
args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config Vvhat:bp:Tc:sxC -- "$@"`
|
||||||
eval set "$args"
|
eval set "$args"
|
||||||
else
|
else
|
||||||
# Detected non-GNU getopt
|
# Detected non-GNU getopt
|
||||||
args=`getopt Vvhat:bp:Tc:sx $*`
|
args=`getopt Vvhat:bp:Tc:sxC $*`
|
||||||
set -- $args
|
set -- $args
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -534,6 +542,7 @@ while true ; do
|
||||||
-c|--cpus) shift; cpus="$1"; test "$cpus" == "max" && cpus=""; shift;;
|
-c|--cpus) shift; cpus="$1"; test "$cpus" == "max" && cpus=""; shift;;
|
||||||
-s|--silent) shift; silent="-s";;
|
-s|--silent) shift; silent="-s";;
|
||||||
-ns|--nostackprotect) shift; stackprotect=true;;
|
-ns|--nostackprotect) shift; stackprotect=true;;
|
||||||
|
-C|--config) shift; configureonly=1;;
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
-*) printf "Invalid option\n\n"; myhelp; exit 1;;
|
-*) printf "Invalid option\n\n"; myhelp; exit 1;;
|
||||||
*) break;;
|
*) break;;
|
||||||
|
|
Loading…
Reference in New Issue