6 echo "usage: buildtarget target [path-to-coreboot]"
14 lbpath=`dirname $lbpath`
17 target_dir=$lbpath/targets
19 config_dir=$lbpath/util/newconfig
20 yapps2_py=$config_dir/yapps2.py
21 config_g=$config_dir/config.g
23 if [ ! -d $target_dir ]; then
24 echo "Target directory not found"
30 if [ ! -f $config_lb ]; then
31 config_lb=$1/Config.lb
33 if [ ! -f $config_lb ]; then
34 echo "No target config file found"
35 echo "Tried both $1 and $config_lb"
39 build_dir=`dirname $config_lb`/`sed -n -e 's/^target \(.*\)$/\1/p' $config_lb`
40 echo "build_dir=$build_dir"
41 config_py=$build_dir/config.py
43 if [ ! -d $build_dir ] ; then
46 if [ ! -f $config_py ]; then
47 echo "No coreboot config script found. Rebuilding it.."
48 $PYTHON $yapps2_py $config_g $config_py
51 # make sure config.py is up-to-date
53 export PYTHONPATH=$config_dir
54 $PYTHON $config_py $config_lb $lbpath
56 # now start checking for distro-specific breakage.
57 ## This check is for the no stack protector mess.
64 $CC -fno-stack-protector -S -xc /dev/null -o .$$.tmp 2>/dev/null
67 EXTRA_CFLAGS=-fno-stack-protector
72 if $CC -Wl,--help | grep -q build-id; then
73 EXTRA_LFLAGS="$EXTRA_LFLAGS -Wl,--build-id=none"
76 for i in $build_dir/Makefile.settings $build_dir/*/Makefile.settings
78 echo DISTRO_CFLAGS+=$EXTRA_CFLAGS >>$i
79 echo DISTRO_LFLAGS+=$EXTRA_LFLAGS >>$i