5 # This script builds LinuxBIOS images for all available targets.
7 # (C) 2004 by Stefan Reinauer <stepan@openbios.org>
9 # This file is subject to the terms and conditions of the GNU General
10 # Public License. See the file COPYING in the main directory of this
11 # archive for more details.
17 if [ -z "$LBROOT" ] ; then
18 LBROOT=$( cd ../..; pwd )
22 # Where shall we place all the build trees?
23 TARGET=$( pwd )/linuxbios-builds
25 # path to payload. Should be more generic
28 # Lines of error context to be printed in FAILURE case
31 # One might want to adjust these in case of cross compiling
35 ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
36 -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
37 -e "s/Power Macintosh/ppc/"`
41 # make this a function so we can easily select
42 # without breaking readability
43 ls -1 $LBROOT/src/mainboard | grep -v CVS
48 # make this a function so we can easily select
49 # without breaking readability
53 ls -1 $LBROOT/src/mainboard/$VENDOR | grep -v CVS
60 cat $LBROOT/src/mainboard/$VENDOR/$MAINBOARD/Config.lb | \
61 grep ^arch | cut -f 2 -d\
64 function create_config
68 echo -n " Creating config file..."
71 # This will make a target directory of ./VENDOR_MAINBOARD
73 target VENDOR_MAINBOARD
74 mainboard VENDOR/MAINBOARD
77 option USE_FALLBACK_IMAGE=0
78 option ROM_IMAGE_SIZE=0x13000
79 option LINUXBIOS_EXTRA_VERSION=".0-normal"
84 option USE_FALLBACK_IMAGE=1
85 option ROM_IMAGE_SIZE=0x13000
86 option LINUXBIOS_EXTRA_VERSION=".0-fallback"
90 buildrom ./VENDOR_MAINBOARD.rom ROM_SIZE "normal" "fallback"
92 ) | sed -e s,VENDOR,$VENDOR,g \
93 -e s,MAINBOARD,$MAINBOARD,g \
94 -e s,PAYLOAD,$PAYLOAD,g \
95 > $TARGET/Config-${VENDOR}_${MAINBOARD}.lb
99 function create_builddir
104 echo -n " Creating builddir..."
107 config_dir=$LBROOT/util/newconfig
108 yapps2_py=$config_dir/yapps2.py
109 config_g=$config_dir/config.g
110 config_lb=Config-${VENDOR}_${MAINBOARD}.lb
114 build_dir=${VENDOR}_${MAINBOARD}
115 config_py=$build_dir/config.py
117 if [ ! -d $build_dir ] ; then
120 if [ ! -f $config_py ]; then
121 $PYTHON $yapps2_py $config_g $config_py &> $build_dir/py.log
124 # make sure config.py is up-to-date
126 export PYTHONPATH=$config_dir
127 $PYTHON $config_py $config_lb $LBROOT &> $build_dir/config.log
128 if [ $? -eq 0 ]; then
131 echo "FAILED! Log excerpt:"
132 tail -n $CONTEXT $build_dir/config.log
137 function create_buildenv
141 create_config $VENDOR $MAINBOARD
142 create_builddir $VENDOR $MAINBOARD
145 function compile_target
150 echo -n " Compiling image .."
152 cd $TARGET/${VENDOR}_${MAINBOARD}
153 eval $MAKE &> make.log
154 if [ $? -eq 0 ]; then
155 echo "ok" > compile.status
160 echo "FAILED! Log excerpt:"
161 tail -n $CONTEXT make.log
167 function built_successfully
170 cd $TARGET/${VENDOR}_${MAINBOARD}
172 if [ -r compile.status ] ; then
173 status=`cat compile.status`
176 [ "$status" == "ok" ]
178 function build_target
182 TARCH=$( architecture $VENDOR $MAINBOARD )
184 echo -n "Processing mainboard/$VENDOR/$MAINBOARD"
185 if [ "$ARCH" == "$TARCH" ]; then
187 if ! built_successfully $VENDOR $MAINBOARD ; then
188 create_buildenv $VENDOR $MAINBOARD
189 if [ $? -eq 0 ]; then
190 compile_target $VENDOR $MAINBOARD
193 echo " ( mainboard/$VENDOR/$MAINBOARD previously ok )"
197 # cross compiling not supported yet.
198 echo " ($TARCH: skipped, we're $ARCH)"
203 for VENDOR in $( vendors ); do
204 for MAINBOARD in $( mainboards $VENDOR ); do
205 build_target $VENDOR $MAINBOARD