forked from BPI-SINOVOIP/BPI-F2S-bsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·114 lines (96 loc) · 2.08 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
110
111
112
113
114
#!/bin/bash
set -e
TOPDIR=`pwd`
MACH=
ARCH=
BOARD=
uboot_config=
kernel_dtb=
kernel_config=
kernel_modules=
kernel_headers=
TOOLCHAIN=gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf
CROSS_COMPILE=$TOPDIR/toolchains/$TOOLCHAIN/bin
list_boards() {
for chipdir in $(find sp-pack/ -mindepth 1 -maxdepth 1 -type d | grep "sp") ;
do
packchip=`basename ${chipdir}`
echo "${packchip}"
for boarddir in $(find sp-pack/${packchip} -mindepth 1 -maxdepth 1 -type d | grep "bpi") ;
do
packboard=`basename ${boarddir}`
echo " ${packboard}"
done
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
UBOOT_CONFIG=$uboot_config
KERNEL_CONFIG=$kernel_config
EOT
}
generate_board_envsh() {
cat <<-EOT
export MACH=$MACH
export ARCH=$ARCH
export BOARD=$BOARD
export UBOOT_CONFIG=$uboot_config
export KERNEL_DTB=$kernel_dtb
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-f2s)
MACH=sp7021
ARCH=arm
BOARD=bpi-f2s
uboot_config=sp7021_bpi_f2s_defconfig
kernel_dtb=sp7021-bpi-f2s.dtb
kernel_config=sp7021_chipC_bpi-f2s_defconfig
kernel_modules="5.4.35-BPI-F2S-Kernel"
kernel_headers="linux-headers-5.4.35-BPI-F2S-Kernel"
;;
bpi-f2p)
MACH=sp7021
ARCH=arm
BOARD=bpi-f2p
kernel_dtb=sp7021-bpi-f2p.dtb
uboot_config=${MACH}_bpi_f2p_defconfig
kernel_config=sp7021_chipC_bpi-f2p_defconfig
kernel_modules="5.4.35-BPI-F2P-Kernel"
kernel_headers="linux-headers-5.4.35-BPI-F2P-Kernel"
;;
esac
if [ ! -d ${TOPDIR}/sp-pack/${MACH}/${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