summaryrefslogtreecommitdiff
path: root/targets/buildtarget
blob: 9f8cb316192d9ba5177305a2f96c5cf684917f99 (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
#!/bin/sh

# Target build script

if [ $# -lt 1 ]; then
	echo "usage: buildtarget target [path-to-linuxbios]"
	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
config_py=$config_dir/config.py

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

if [ ! -f $config_py ]; then
	echo "No linuxbios config script found. Rebuilding it.."
	( 
	  cd $config_dir 
	  make config.py
	)
	echo "done."
	# exit 1
fi

# make sure config.py is up-to-date

(cd $config_dir && make config.py)

python $config_py $config_lb $lbpath

exit $?