- some steps towards cross compile

- add option to force rebuilds even if they were previously ok
- add option to build on target only
- play around


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1746 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2004-11-05 00:25:19 +00:00
parent 9562049df5
commit d87ce961f6
1 changed files with 115 additions and 27 deletions

View File

@ -11,13 +11,6 @@
# archive for more details. # archive for more details.
# #
LBROOT=$1
# /path/to/freebios2/
if [ -z "$LBROOT" ] ; then
LBROOT=$( cd ../..; pwd )
fi
# Where shall we place all the build trees? # Where shall we place all the build trees?
TARGET=$( pwd )/linuxbios-builds TARGET=$( pwd )/linuxbios-builds
@ -73,16 +66,20 @@ function create_config
target VENDOR_MAINBOARD target VENDOR_MAINBOARD
mainboard VENDOR/MAINBOARD mainboard VENDOR/MAINBOARD
option CC="CROSSCC"
# not supported yet
# option LD="CROSSLD"
romimage "normal" romimage "normal"
option USE_FALLBACK_IMAGE=0 option USE_FALLBACK_IMAGE=0
option ROM_IMAGE_SIZE=0x13000 option ROM_IMAGE_SIZE=0x12000
option LINUXBIOS_EXTRA_VERSION=".0-normal" option LINUXBIOS_EXTRA_VERSION=".0-normal"
payload PAYLOAD payload PAYLOAD
end end
romimage "fallback" romimage "fallback"
option USE_FALLBACK_IMAGE=1 option USE_FALLBACK_IMAGE=1
option ROM_IMAGE_SIZE=0x13000 option ROM_IMAGE_SIZE=0x12000
option LINUXBIOS_EXTRA_VERSION=".0-fallback" option LINUXBIOS_EXTRA_VERSION=".0-fallback"
payload PAYLOAD payload PAYLOAD
end end
@ -92,6 +89,8 @@ EOF
) | sed -e s,VENDOR,$VENDOR,g \ ) | sed -e s,VENDOR,$VENDOR,g \
-e s,MAINBOARD,$MAINBOARD,g \ -e s,MAINBOARD,$MAINBOARD,g \
-e s,PAYLOAD,$PAYLOAD,g \ -e s,PAYLOAD,$PAYLOAD,g \
-e s,CROSSCC,"$CC",g \
-e s,CROSSLD,"$LD",g \
> $TARGET/Config-${VENDOR}_${MAINBOARD}.lb > $TARGET/Config-${VENDOR}_${MAINBOARD}.lb
echo " ok" echo " ok"
} }
@ -167,13 +166,15 @@ function compile_target
function built_successfully function built_successfully
{ {
CURR=`pwd` CURR=`pwd`
cd $TARGET/${VENDOR}_${MAINBOARD}
status="fail" status="fail"
if [ -r compile.status ] ; then if [ -d "$TARGET/${VENDOR}_${MAINBOARD}" ]; then
status=`cat compile.status` cd $TARGET/${VENDOR}_${MAINBOARD}
if [ -r compile.status ] ; then
status=`cat compile.status`
fi
cd $CURR
fi fi
cd $CURR [ "$buildall" != "true" -a "$status" == "ok" ]
[ "$status" == "ok" ]
} }
function build_target function build_target
{ {
@ -181,28 +182,115 @@ function build_target
MAINBOARD=$2 MAINBOARD=$2
TARCH=$( architecture $VENDOR $MAINBOARD ) TARCH=$( architecture $VENDOR $MAINBOARD )
# default setting
CC="gcc"
LD="ld"
echo -n "Processing mainboard/$VENDOR/$MAINBOARD" echo -n "Processing mainboard/$VENDOR/$MAINBOARD"
if [ "$ARCH" == "$TARCH" ]; then if [ "$ARCH" == "$TARCH" ]; then
echo " ($TARCH: ok)" echo " ($TARCH: ok)"
if ! built_successfully $VENDOR $MAINBOARD ; then else
create_buildenv $VENDOR $MAINBOARD found_crosscompiler=false
if [ $? -eq 0 ]; then if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then
compile_target $VENDOR $MAINBOARD CC="gcc -m32"
fi found_crosscompiler=true
else echo " ($TARCH: subset of $ARCH)"
echo " ( mainboard/$VENDOR/$MAINBOARD previously ok )" fi
if [ "$ARCH" == ppc64 -a "$TARCH" == ppc ]; then
CC="gcc -m32"
found_crosscompiler=true
echo " ($TARCH: subset of $ARCH)"
fi fi
# TBD: look for suitable cross compiler suite
# cross-$TARCH-gcc and cross-$TARCH-ld
# Check result:
if [ $found_crosscompiler == "false" ]; then
echo " ($TARCH: skipped, we're $ARCH)"
return 0
fi
fi
if ! built_successfully $VENDOR $MAINBOARD ; then
create_buildenv $VENDOR $MAINBOARD
if [ $? -eq 0 ]; then
compile_target $VENDOR $MAINBOARD
fi
else else
# cross compiling not supported yet. echo " ( mainboard/$VENDOR/$MAINBOARD previously ok )"
echo " ($TARCH: skipped, we're $ARCH)"
fi fi
echo echo
} }
for VENDOR in $( vendors ); do function myhelp
for MAINBOARD in $( mainboards $VENDOR ); do {
build_target $VENDOR $MAINBOARD echo "Usage: $0 [-v|--verbose] [-a|--all] [-t|--target vendor/board] [lbroot]"
done echo " $0 [-V|--version]"
echo " $0 [-h|--help]"
exit 0
}
function myversion
{
cat << EOF
LinuxBIOS autobuild: V0.1.
Copyright (C) 2004 by Stefan Reinauer, <stepan@openbios.org>
This program is free software; you may redistribute it under the terms
of the GNU General Public License. This program has absolutely no
warranty.
EOF
myhelp
exit 0
}
# default options
target=""
buildall=false
# parse parameters
args=`getopt -l version,verbose,help,all,target: Vvhat: $*`
if [ $? != 0 ]; then
myhelp
exit 1
fi
set -- $args
for arg
do
case $arg in
-t|--target) shift;target=$1;shift;;
-a|--all) shift;buildall=true;;
-v|--verbose) shift;verbose=true;;
-V|--version) shift;myversion;;
-h|--help) shift;myhelp;;
esac
done done
# -- is $1
LBROOT=$2
# /path/to/freebios2/
if [ -z "$LBROOT" ] ; then
LBROOT=$( cd ../..; pwd )
fi
if [ $target != "" ]; then
# build a single board
VENDOR=`echo $target|tr -d \'|cut -f1 -d/`
MAINBOARD=`echo $target|tr -d \'|cut -f2 -d/`
build_target $VENDOR $MAINBOARD
else
# build all boards per default
for VENDOR in $( vendors ); do
for MAINBOARD in $( mainboards $VENDOR ); do
build_target $VENDOR $MAINBOARD
done
done
fi