Changeset 5066


Ignore:
Timestamp:
Jan 30, 2010 11:44:28 AM (3 years ago)
Author:
stepan
Message:

add Kbuild support to abuild and enable it per default;
use -o/--oldconfig to get the old behavior (and use that
option in kbuildall to get the old config)

I changed the qa.coreboot.org autobuild system to use -o
for now so we get build reports from the old and new config,
still.

Signed-off-by: Stefan Reinauer <stepan@…>
Acked-by: Myles Watson <mylesgw@…>

Location:
trunk/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/util/abuild/abuild

    r4712 r5066  
    66# 
    77#  (C) 2004 by Stefan Reinauer <stepan@openbios.org> 
    8 #  (C) 2006-2009 by coresystems GmbH <info@coresystems.de> 
     8#  (C) 2006-2010 by coresystems GmbH <info@coresystems.de> 
    99# 
    1010#  This file is subject to the terms and conditions of the GNU General 
     
    1515#set -x # Turn echo on.... 
    1616 
    17 ABUILD_DATE="April 10th, 2009" 
    18 ABUILD_VERSION="0.8.1" 
     17ABUILD_DATE="January 29th, 2010" 
     18ABUILD_VERSION="0.9" 
    1919 
    2020# Where shall we place all the build trees? 
     
    3535# Configure-only mode 
    3636configureonly=0 
     37# use old config method "newconfig" 
     38oldconfig=0 
    3739 
    3840# One might want to adjust these in case of cross compiling 
     
    104106        # make this a function so we can easily select 
    105107        # without breaking readability 
    106         ls -1 "$LBROOT/src/mainboard" | grep -v Kconfig | grep -v Makefile 
     108        ls -1 "$ROOT/src/mainboard" | grep -v Kconfig | grep -v Makefile 
    107109} 
    108110 
     
    114116        VENDOR=$1 
    115117         
    116         ls -1 $LBROOT/src/mainboard/$VENDOR | grep -v Kconfig 
     118        ls -1 $ROOT/src/mainboard/$VENDOR | grep -v Kconfig 
    117119} 
    118120 
     
    121123        VENDOR=$1 
    122124        MAINBOARD=$2 
    123         ARCH=`cat $LBROOT/src/mainboard/$VENDOR/$MAINBOARD/Config.lb | \ 
    124                 grep ^arch | cut -f 2 -d\ ` 
    125         echo $ARCH | sed s/ppc/powerpc/ 
    126 } 
    127  
    128 function create_config 
     125        if [ $oldconfig -eq 1 ]; then 
     126                ARCH=`cat $ROOT/src/mainboard/$VENDOR/$MAINBOARD/Config.lb | \ 
     127                        grep ^arch | cut -f 2 -d\ ` 
     128                echo $ARCH | sed s/ppc/powerpc/ 
     129        else 
     130                ARCH=`cat $ROOT/src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \ 
     131                        grep "select ARCH_"|cut -f2- -d_` 
     132                echo $ARCH | sed s/X86/i386/ 
     133        fi 
     134} 
     135 
     136function create_config_old 
    129137{ 
    130138        VENDOR=$1 
     
    132140        CONFIG=$3 
    133141        TARCH=$( architecture $VENDOR $MAINBOARD ) 
    134         TARGCONFIG=$LBROOT/targets/$VENDOR/$MAINBOARD/Config-abuild.lb 
     142        TARGCONFIG=$ROOT/targets/$VENDOR/$MAINBOARD/Config-abuild.lb 
    135143 
    136144        if [ "$CONFIG" != "" ]; then 
    137                 TARGCONFIG=$LBROOT/targets/$VENDOR/$MAINBOARD/$CONFIG 
     145                TARGCONFIG=$ROOT/targets/$VENDOR/$MAINBOARD/$CONFIG 
    138146        fi 
    139147 
     
    156164                xml "  <config>$TARGCONFIG</config>" 
    157165        else 
    158  
    159166                printf "  Creating config file..." 
    160167                xml "  <config>autogenerated</config>" 
     
    229236} 
    230237 
    231 function create_builddir 
    232 {        
    233         VENDOR=$1 
    234         MAINBOARD=$2 
    235          
    236         printf "  Creating builddir..." 
    237  
    238         target_dir=$TARGET 
    239         config_dir=$LBROOT/util/newconfig 
    240         yapps2_py=$config_dir/yapps2.py 
    241         config_g=$config_dir/config.g 
    242         config_lb=Config-${VENDOR}_${MAINBOARD}.lb 
    243  
    244         cd $target_dir 
    245  
    246         build_dir=${VENDOR}_${MAINBOARD} 
    247         config_py=$build_dir/config.py 
    248  
    249         if [ ! -d $build_dir ] ; then 
    250                 mkdir -p $build_dir 
    251         fi 
    252         if [ ! -f $config_py ]; then 
    253                 $PYTHON $yapps2_py $config_g $config_py &> $build_dir/py.log 
    254         fi 
    255  
    256         # make sure config.py is up-to-date 
    257  
    258         export PYTHONPATH=$config_dir 
    259         $PYTHON $config_py $config_lb $LBROOT &> $build_dir/config.log 
    260         if [ $? -eq 0 ]; then 
     238function create_config 
     239{ 
     240        VENDOR=$1 
     241        MAINBOARD=$2 
     242        CONFIG=$3 
     243 
     244        build_dir=$TARGET/${VENDOR}_${MAINBOARD} 
     245 
     246        # get a working payload for the board if we have one. 
     247        # the --payload option expects a directory containing  
     248        # a shell script payload.sh 
     249        #   Usage: payload.sh [VENDOR] [DEVICE] 
     250        # the script returns an absolute path to the payload binary. 
     251 
     252        if [ -f $payloads/payload.sh ]; then 
     253                PAYLOAD=`sh $payloads/payload.sh $VENDOR $MAINBOARD` 
     254                printf "Using payload $PAYLOAD\n" 
     255        fi 
     256 
     257        $MAKE distclean obj=${build_dir} 
     258        mkdir -p ${build_dir} 
     259 
     260        if [ "$CONFIG" != "" ]; then 
     261                printf "  Using existing configuration $CONFIG ... " 
     262                xml "  <config>$CONFIG</config>" 
     263                cp $CONFIG .config 
     264        else 
     265                printf "  Creating config file... " 
     266                xml "  <config>autogenerated</config>" 
     267                grep "depends[\t ]on[\t ]*VENDOR" src/mainboard/$VENDOR/$MAINBOARD/../Kconfig | \ 
     268                        sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > .config 
     269                grep "config[\t ]*BOARD" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \ 
     270                        sed "s,^.*\(BOARD_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config 
     271                grep "select[\t ]*ARCH" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \ 
     272                        sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config 
     273                echo "CONFIG_MAINBOARD_DIR=\"$VENDOR/$MAINBOARD\"" >> .config 
     274                if [ "$PAYLOAD" != "/dev/null" ]; then 
     275                        echo "# CONFIG_PAYLOAD_NONE is not set" >> .config 
     276                        echo "CONFIG_PAYLOAD_ELF=\"$PAYLOAD\"" >> .config 
     277                fi 
     278 
     279                if [ "$loglevel" != "default" ]; then 
     280                        printf "(loglevel override) " 
     281                        echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL_$loglevel=y" 
     282                        echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL=$loglevel" 
     283                        echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$loglevel=y" 
     284                        echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" 
     285                fi 
     286        fi 
     287 
     288        yes "" | $MAKE oldconfig obj=${build_dir} > ${build_dir}/config.log 
     289        ret=$? 
     290        mv .config.old $TARGET/${VENDOR}_${MAINBOARD}/config.in 
     291        if [ $ret -eq 0 ]; then 
    261292                printf "ok\n" 
    262293                xml "  <builddir>ok</builddir>" 
     
    278309} 
    279310 
     311function create_builddir 
     312{        
     313        VENDOR=$1 
     314        MAINBOARD=$2 
     315         
     316        printf "  Creating builddir..." 
     317 
     318        target_dir=$TARGET 
     319        config_dir=$ROOT/util/newconfig 
     320        yapps2_py=$config_dir/yapps2.py 
     321        config_g=$config_dir/config.g 
     322        config_lb=Config-${VENDOR}_${MAINBOARD}.lb 
     323 
     324        cd $target_dir 
     325 
     326        build_dir=${VENDOR}_${MAINBOARD} 
     327        config_py=$build_dir/config.py 
     328 
     329        if [ ! -d $build_dir ] ; then 
     330                mkdir -p $build_dir 
     331        fi 
     332        if [ ! -f $config_py ]; then 
     333                $PYTHON $yapps2_py $config_g $config_py &> $build_dir/py.log 
     334        fi 
     335 
     336        # make sure config.py is up-to-date 
     337 
     338        export PYTHONPATH=$config_dir 
     339        $PYTHON $config_py $config_lb $ROOT &> $build_dir/config.log 
     340        if [ $? -eq 0 ]; then 
     341                printf "ok\n" 
     342                xml "  <builddir>ok</builddir>" 
     343                xml "  <log>" 
     344                xmlfile $build_dir/config.log 
     345                xml "  </log>" 
     346                xml "" 
     347                return 0 
     348        else 
     349                printf "FAILED! Log excerpt:\n" 
     350                xml "  <builddir>failed</builddir>" 
     351                xml "  <log>" 
     352                xmlfile $build_dir/config.log 
     353                xml "  </log>" 
     354                xml "" 
     355                tail -n $CONTEXT $build_dir/config.log 2> /dev/null || tail -$CONTEXT $build_dir/config.log 
     356                return 1 
     357        fi 
     358} 
     359 
    280360function create_buildenv 
    281361{ 
     
    283363        MAINBOARD=$2 
    284364        CONFIG=$3 
    285         create_config $VENDOR $MAINBOARD $CONFIG 
    286         create_builddir $VENDOR $MAINBOARD 
     365        if [ $oldconfig -eq 1 ]; then 
     366                create_config_old $VENDOR $MAINBOARD $CONFIG 
     367                create_builddir $VENDOR $MAINBOARD 
     368        else 
     369                create_config $VENDOR $MAINBOARD $CONFIG 
     370                cp .config $TARGET/${VENDOR}_${MAINBOARD}/coreboot.config 
     371        fi 
    287372} 
    288373 
     
    298383 
    299384        CURR=$( pwd ) 
    300         cd $TARGET/${VENDOR}_${MAINBOARD} 
    301385        stime=`perl -e 'print time();'` 
    302         eval $MAKE $silent -j $cpus &> make.log 
    303         ret=$? 
     386        if [ $oldconfig -eq 1 ]; then 
     387                cd $TARGET/${VENDOR}_${MAINBOARD} 
     388                eval $MAKE $silent -j $cpus &> make.log 
     389                ret=$? 
     390        else 
     391                build_dir=$TARGET/${VENDOR}_${MAINBOARD} 
     392                eval $MAKE $silent -j $cpus obj=${build_dir} \ 
     393                        &> ${build_dir}/make.log 
     394                ret=$? 
     395                mv .config ${build_dir}/config.build 
     396                mv .xcompile ${build_dir}/xcompile.build 
     397                mv ..config.tmp ${build_dir}/config.deps 
     398                cd $TARGET/${VENDOR}_${MAINBOARD} 
     399        fi 
    304400        etime=`perl -e 'print time();'` 
    305401        duration=$(( $etime - $stime )) 
     
    346442        CURR=`pwd` 
    347443        status="yes" 
    348         [ -r "$LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/BROKEN" ] && status="no" 
     444        [ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/BROKEN" ] && status="no" 
    349445        [ "$buildbroken" == "true" -o "$status" == "yes" ] 
    350446} 
     
    360456        # This is used for the Motorola Sandpoint, which is not a real target 
    361457        # but a skeleton target for the Sandpoint X3. 
    362         [ -r "$LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \ 
    363                 source $LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info 
     458        [ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \ 
     459                source $ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info 
    364460 
    365461        # default setting 
     
    574670        printf "    [-l|--loglevel <num>]         set loglevel\n" 
    575671        printf "    [lbroot]                      absolute path to coreboot sources\n" 
    576         printf "                                  (defaults to $LBROOT)\n\n" 
     672        printf "                                  (defaults to $ROOT)\n\n" 
    577673} 
    578674 
     
    584680 
    585681Copyright (C) 2004 by Stefan Reinauer <stepan@openbios.org> 
    586 Copyright (C) 2006-2008 by coresystems GmbH <info@coresystems.de> 
     682Copyright (C) 2006-2010 by coresystems GmbH <info@coresystems.de> 
    587683 
    588684This program is free software; you may redistribute it under the terms 
     
    598694verbose=false 
    599695 
    600 test -f util/newconfig/config.g && LBROOT=$( pwd ) 
    601 test -f ../util/newconfig/config.g && LBROOT=$( cd ..; pwd ) 
    602 test "$LBROOT" = "" && LBROOT=$( cd ../..; pwd ) 
     696test -f util/newconfig/config.g && ROOT=$( pwd ) 
     697test -f ../util/newconfig/config.g && ROOT=$( cd ..; pwd ) 
     698test "$ROOT" = "" && ROOT=$( cd ../..; pwd ) 
    603699 
    604700# parse parameters.. try to find out whether we're running GNU getopt 
     
    606702if [ "${getoptbrand:0:6}" == "getopt" ]; then 
    607703        # Detected GNU getopt that supports long options. 
    608         args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel Vvhat:bp:Tc:sxCl: -- "$@"` 
     704        args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,oldconfig Vvhat:bp:Tc:sxCl:o -- "$@"` 
    609705        eval set "$args" 
    610706else 
    611707        # Detected non-GNU getopt 
    612         args=`getopt Vvhat:bp:Tc:sxCl: $*` 
     708        args=`getopt Vvhat:bp:Tc:sxCl:o $*` 
    613709        set -- $args 
    614710fi 
     
    637733                -C|--config)    shift; configureonly=1;; 
    638734                -l|--loglevel)  shift; loglevel="$1"; shift;; 
     735                -o|--oldconfig) shift; oldconfig=1;; 
    639736                --)             shift; break;; 
    640737                -*)             printf "Invalid option\n\n"; myhelp; exit 1;; 
     
    644741 
    645742# /path/to/freebios2/ 
    646 test -z "$1" || LBROOT=$1 
    647  
    648 debug "LBROOT=$LBROOT" 
     743test -z "$1" || ROOT=$1 
     744 
     745debug "ROOT=$ROOT" 
    649746 
    650747xml '<?xml version="1.0" encoding="utf-8"?>' 
  • trunk/util/kbuildall/kbuildall

    r4982 r5066  
    6262        echo "$result." 
    6363        if [ "$result" = "ok" ]; then 
    64                 util/abuild/abuild -C -t $dir 
     64                util/abuild/abuild -o -C -t $dir 
    6565                sh util/compareboard/compareboard $dir | tee $TARGETDIR/$name.variables.txt 
    6666        fi 
Note: See TracChangeset for help on using the changeset viewer.