summaryrefslogtreecommitdiff
path: root/scripts/update-sys
blob: bbbfcdbf8ea8ceab13774477d1110a7ca95bbe9e (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
#!/usr/bin/env bash
# 1. create Config.in.systems with all available target systems for each architecture
# 2. if ADK configuration exist, create Config.in.arch/Config.in.system with fixed values

topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))

defaults() {
	echo 'source "target/config/Config.in.arch.default"' > $topdir/target/config/Config.in.arch
	echo 'source "target/config/Config.in.arch.choice"' >> $topdir/target/config/Config.in.arch
	echo 'source "target/config/Config.in.system.default"' > $topdir/target/config/Config.in.system
	echo 'source "target/config/Config.in.system.choice"' >> $topdir/target/config/Config.in.system
	exit 0
}

check_native() {
	native=$(grep ^ADK_LINUX_NATIVE $topdir/.config)
	if [ ! -z "$native" ];then
		exit 0
	fi
}

for i in $(ls $topdir/target/);do
	if [ -d "$topdir/target/$i/sys-enabled" ];then
		cat $topdir/target/$i/sys-enabled/* > $topdir/target/$i/Config.in.systems 2>/dev/null
	fi
done
if [ -f $topdir/.config ];then

check_native

arch=$(grep ^ADK_TARGET_ARCH $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
systemsym=$(grep ^ADK_TARGET_SYSTEM_ $topdir/.config|cut -f 1 -d =) 
system=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
systems=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g'|sed -e 's#-#_#g')
archsym=$(echo ADK_LINUX_$arch|tr '[:lower:]-' '[:upper:]')

if [ -z "$arch" -o -z "$system" ];then
	defaults
fi

cat > $topdir/target/config/Config.in.arch << EOF 	
source "target/config/Config.in.arch.default"
config $archsym
	bool
EOF

cat > $topdir/target/config/Config.in.system << EOF 	
source "target/config/Config.in.system.default"
comment "Architecture: $arch"
comment "System: $system"

config $systemsym
	boolean
	select $archsym
$(grep select $topdir/target/$arch/sys-available/$system)
	default y
EOF
else
	defaults
fi
exit 0