-
Notifications
You must be signed in to change notification settings - Fork 10
/
configure
executable file
·100 lines (81 loc) · 1.68 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
#!/bin/bash
set -e
SOC=a64
MACH=sun50iw1p1
BOARD=
board=
kernel_modules=
kernel_headers=
TOPDIR=`pwd`
CUR_DIR=$PWD
U_CROSS_COMPILE=$CUR_DIR/toolchain/gcc-linaro/bin
K_CROSS_COMPILE=$CUR_DIR/toolchain/gcc-aarch64/bin
list_boards() {
(cd sunxi-pack/${MACH}/configs ; ls -1d BPI* )
}
# keep the output `sh` friendly
# i.e., no spaces around the '='
generate_board_mk() {
cat <<-EOT
BOARD=$BOARD
SOC=$SOC
MACH=$MACH
U_COMPILE_TOOL=$U_CROSS_COMPILE
K_COMPILE_TOOL=$K_CROSS_COMPILE
UBOOT_CONFIG=$MACH
KERNEL_CONFIG=${MACH}smp_${board}_defconfig
EOT
}
generate_board_envsh() {
cat <<-EOT
export BOARD=$BOARD
export SOC=$SOC
export MACH=$MACH
export UBOOT_CONFIG=${MACH}_config
export KERNEL_CONFIG=${MACH}smp_${board}_defconfig
export KERNEL_MODULES=${kernel_modules}
export KERNEL_HEADERS=${kernel_headers}
export LICHEE_PLATFORM="linux"
export GPU_TYPE="mali400"
export TOPDIR=${TOPDIR}
EOT
}
usage() {
cat <<-EOT >&2
Usage: $0 <board>
supported boards:
EOT
list_boards
}
if [ $# -eq 0 ]; then
usage
exit 1
fi
BOARD=$1
if [ ! -d ${TOPDIR}/sunxi-pack/${MACH}/configs/${BOARD} ]; then
echo -e "\033[31m ${BOARD} not support, exit \033[0m"
exit 1
fi
case $BOARD in
BPI-M64*)
MACH=sun50iw1p1
board="bpi-m64"
kernel_modules="4.4.89-BPI-M64-Kernel"
kernel_headers="linux-headers-4.4.89-BPI-M64-Kernel"
;;
BPI-NOMA*)
MACH=sun50iw1p1
board="bpi-noma"
kernel_modules="4.4.89-BPI-NOMA-Kernel"
kernel_headers="linux-headers-4.4.89-BPI-NOMA-Kernel"
;;
esac
generate_board_envsh "$1" > env.sh
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