forked from linux-sunxi/sunxi-bsp
-
Notifications
You must be signed in to change notification settings - Fork 9
/
configure
executable file
·80 lines (71 loc) · 1.32 KB
/
configure
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
#!/bin/sh
set -e
if [ ! -d sunxi-boards/sys_config/ ]; then
git submodule init
git submodule update sunxi-boards
fi
list_boards() {
ls -1 sunxi-boards/sys_config/*/*.fex |
sed -n -e 's|.*/\([^/]\+\)\.fex$|\1|p' | sort -V |
sed -e 's|.*|\t* \0 \0-android|'
}
# keep the output `sh` friendly
# i.e., no spaces around the '='
generate_board_mk() {
local board="${1%-android}" android= soc=
[ "$board" = "$1" ] || android=yes
soc=$(ls -1 sunxi-boards/sys_config/*/$board.fex 2> /dev/null | cut -d/ -f3)
cat <<-EOT
BOARD=$board
ANDROID=$android
SOC=$soc
UBOOT_CONFIG=$board
EOT
case "$soc" in
a10)
cat <<-EOT
MACH=sun4i
KERNEL_CONFIG=sun4i${android:+_crane}_defconfig
EOT
;;
a13)
cat <<-EOT
MACH=sun5i
KERNEL_CONFIG=sun5i${android:+_nuclear}_defconfig
EOT
;;
a20)
cat <<-EOT
MACH=sun7i
KERNEL_CONFIG=sun7i${android:+_wing}_defconfig
EOT
;;
*)
echo "$soc: unsupported SoC" >&2
return 1
;;
esac
}
usage() {
cat <<-EOT >&2
Usage: $0 <board>
supported boards:
EOT
list_boards
}
if [ $# -eq 0 ]; then
usage
elif ls -1 sunxi-boards/sys_config/*/${1%-android}.fex 2> /dev/null 1>&2; then
out=chosen_board.mk
if generate_board_mk "$1" > $out~; then
mv $out~ $out
echo "$1 configured. Now run \`make\`"
else
rm $out~
exit 1
fi
else
echo "$1: invalid board name" >&2
usage
exit 1
fi