-
Notifications
You must be signed in to change notification settings - Fork 48
/
configure
executable file
·109 lines (91 loc) · 1.95 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
set -e
TOPDIR=`pwd`
MACH=
ARCH=
BOARD=
board=
uboot_config=
kernel_config=
kernel_modules=
kernel_headers=
TOOLCHAIN=gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf
SPL_CROSS_COMPILE=$TOPDIR/toolchains/$SPL_TOOLCHAIN/bin
CROSS_COMPILE=$TOPDIR/toolchains/$TOOLCHAIN/bin
list_boards() {
for boarddir in $(find sunxi-pack/*/configs/ -mindepth 1 -maxdepth 1 -type d | grep "BPI") ;
do
packboard=`basename ${boarddir}`
echo " ${packboard}"
done
}
# keep the output `sh` friendly
# i.e., no spaces around the '='
generate_board_mk() {
cat <<-EOT
MACH=$MACH
ARCH=$ARCH
BOARD=$BOARD
COMPILE_TOOL=$CROSS_COMPILE
SPL_COMPILE_TOOL=$SPL_CROSS_COMPILE
UBOOT_CONFIG=$uboot_config
KERNEL_CONFIG=$kernel_config
EOT
}
generate_board_envsh() {
cat <<-EOT
export MACH=$MACH
export ARCH=$ARCH
export BOARD=$BOARD
export board=$board
export UBOOT_CONFIG=$uboot_config
export KERNEL_CONFIG=$kernel_config
export KERNEL_MODULES=${kernel_modules}
export KERNEL_HEADERS=${kernel_headers}
export TOPDIR=${TOPDIR}
EOT
}
usage() {
cat <<-EOT >&2
supported boards:
EOT
list_boards
}
if [ $# -eq 0 ]; then
usage
exit 1
fi
BOARD=$1
case $BOARD in
BPI-M2U*)
MACH=sun8iw11p1
ARCH=arm
board="bpi-m2u"
uboot_config=${MACH}_config
kernel_config=${MACH}smp_${board}_defconfig
kernel_modules="3.10.108-BPI-M2U-Kernel"
kernel_headers="linux-headers-3.10.108-BPI-M2U-Kernel"
;;
BPI-M2B*)
MACH=sun8iw11p1
ARCH=arm
board="bpi-m2b"
uboot_config=${MACH}_config
kernel_config=${MACH}smp_${board}_defconfig
kernel_modules="3.10.108-BPI-M2B-Kernel"
kernel_headers="linux-headers-3.10.108-BPI-M2B-Kernel"
;;
esac
if [ ! -d ${TOPDIR}/sunxi-pack/${MACH}/configs//${BOARD} ]; then
echo -e "\033[31m${BOARD} not support, exit \033[0m"
usage
exit 1
fi
if [ -e env.sh ]; then
rm env.sh
fi
generate_board_envsh "$1" > env.sh
if [ -e chosen_board.mk ]; then
rm chosen_board.mk
fi
generate_board_mk "$1" > chosen_board.mk