blob: 04ae5ebe325b6a7d99c6e7aeb7fd6df507feee8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/bin/sh
PYTHON=python
# Target build script
if [ $# -lt 1 ]; then
echo "usage: buildtarget target [path-to-coreboot]"
exit 1
fi
if [ $# -gt 1 ]; then
lbpath=$2
else
lbpath=`pwd`
lbpath=`dirname $lbpath`
fi
target_dir=$lbpath/targets
config_lb=$1
config_dir=$lbpath/util/newconfig
yapps2_py=$config_dir/yapps2.py
config_g=$config_dir/config.g
if [ ! -d $target_dir ]; then
echo "Target directory not found"
exit 1
fi
cd $target_dir
if [ ! -f $config_lb ]; then
config_lb=$1/Config.lb
fi
if [ ! -f $config_lb ]; then
echo "No target config file found"
echo "Tried both $1 and $config_lb"
exit 1
fi
build_dir=`dirname $config_lb`/`sed -n -e 's/^target \(.*\)$/\1/p' $config_lb`
echo "build_dir=$build_dir"
config_py=$build_dir/config.py
if [ ! -d $build_dir ] ; then
mkdir -p $build_dir
fi
if [ ! -f $config_py ]; then
echo "No coreboot config script found. Rebuilding it.."
$PYTHON $yapps2_py $config_g $config_py
fi
# make sure config.py is up-to-date
export PYTHONPATH=$config_dir
$PYTHON $config_py $config_lb $lbpath
# now start checking for distro-specific breakage.
## This check is for the no stack protector mess.
EXTRA_CFLAGS=
if [ -z "$CC" ]; then
CC=gcc
fi
$CC -fno-stack-protector -S -xc /dev/null -o .$$.tmp
if [ $? -eq 0 ]; then
EXTRA_CFLAGS=-fno-stack-protector
fi
rm -rf .$$.tmp
ld --help | awk '{for (i=1;i<=NF;i++) if ($i ~ /build-id/){n++} }; END {exit n}'
build_id=$?
if [ $build_id -ge 1 ] ; then
EXTRA_LFLAGS+=" -Wl,--build-id=none"
fi
for i in $build_dir/Makefile.settings $build_dir/*/Makefile.settings
do
echo DISTRO_CFLAGS+=$EXTRA_CFLAGS >>$i
echo DISTRO_LFLAGS+=$EXTRA_LFLAGS >>$i
done
exit $?
|