summaryrefslogtreecommitdiff
path: root/scripts/create-sys
blob: 9227a5a14b4dde37e07b8c084f0a01d07537786a (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
#!/usr/bin/env bash
topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
systems=$(grep -h config target/*/sys-available/*|cut -d " " -f 2)

while read arch; do
	count=1
	mkdir -p $topdir/target/$arch/sys-enabled &&
	cd $topdir/target/$arch/sys-enabled &&
	ln -sf ../sys-available/toolchain-$arch 0-toolchain-$arch
	for i in $(ls $topdir/target/$arch/sys-available/|grep -v toolchain);do
		cd $topdir/target/$arch/sys-enabled/ &&
		ln -sf ../sys-available/$i $count-$i
		count=$((count+1))
	done
done <${topdir}/target/arch.lst

echo '' > $topdir/target/config/Config.in.system.default

for j in $systems;do
	system=${j#ADK_TARGET_SYSTEM_}
	systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
	printf "config ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
	printf "\tboolean\n\n" >> $topdir/target/config/Config.in.system.default
done

cat >> $topdir/target/config/Config.in.system.default << EOD
config ADK_TARGET_SYSTEM
	string
EOD
for i in $systems;do
	system=${i#ADK_TARGET_SYSTEM_}
	systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
	system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
	system=$(echo $system|sed 's#x86-64#x86_64#')
	if [ "${system%-*}" = "toolchain" ];then
		printf "\tdefault \"${system%-*}\" if ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
	else
		printf "\tdefault \"${system}\" if ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
	fi
done
exit 0