-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure
114 lines (94 loc) · 2.12 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=
BOARD=
ARCH=
uboot_config=
kernel_dtb=
kernel_config=
kernel_modules=
kernel_headers=
FIP_TOOLCHAIN=gcc-linaro-arm-none-eabi-4.8-2014.04_linux
U_TOOLCHAIN=gcc-linaro-aarch64-none-elf-4.8-2013.11_linux
K_TOOLCHAIN=gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu
FIP_CROSS_COMPILE=$TOPDIR/toolchains/$FIP_TOOLCHAIN/bin
U_CROSS_COMPILE=$TOPDIR/toolchains/$U_TOOLCHAIN/bin
K_CROSS_COMPILE=$TOPDIR/toolchains/$K_TOOLCHAIN/bin
list_boards() {
for chipdir in $(find aml-pack/ -mindepth 1 -maxdepth 1 -type d) ;
do
packchip=`basename ${chipdir}`
echo "${packchip}"
for boarddir in $(find aml-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
K_COMPILE_TOOL=$K_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-m5)
MACH=sm1
ARCH=arm64
BOARD=bpi-m5
uboot_config=bananapi_m5_defconfig
kernel_dtb=meson64_bananapi_*.dtb
kernel_config=bananapi_m5_defconfig
kernel_modules="4.9.312-BPI-M5"
kernel_headers="linux-headers-4.9.312-BPI-M5"
;;
*)
echo -e "\033[31mboard ${BOARD} is not support\033[0m"
exit 1
;;
esac
if [ ! -d ${TOPDIR}/aml-pack/${MACH}/${BOARD} ]; then
echo -e "\033[31mboard ${BOARD} is not support\033[0m"
usage
fi
export PATH=$FIP_CROSS_COMPILE:$U_CROSS_COMPILE:$PATH
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