make.sh
2.2 KB
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
#!/bin/sh
set -e
SCRIPT_WORKING_DIR=`dirname ${0}`
if [ "${SCRIPT_WORKING_DIR}" != "." ]; then
cd ${SCRIPT_WORKING_DIR}
fi
. ../../package.env
DIR_NAME=$(basename $(realpath .))
build_path="../output-${DIR_NAME}"
output_path="../out"
module_install=$output_path
firmware_install=$output_path
if [ -z "${CP_DIR}" ]
then
CP_DIR="/tftpboot/${FA_CHIPSET}/${FA_PRODUCT} /nfs/${FA_CHIPSET}/${FA_PRODUCT}"
fi
image_filename="arch/arm/boot/uImage"
dtb_filename="arch/arm/boot/dts/${FA_CHIPSET}-${FA_PRODUCT}.dtb"
image_target_filename="uImage${FA_TAG}"
dtb_target_filename="${FA_CHIPSET}-${FA_PRODUCT}${FA_TAG}.dtb"
if [ -f .config ]; then
echo ".....mrproper"
make mrproper
fi
if [ ! -d $build_path ]; then
mkdir $build_path
chmod 777 $build_path
fi
if [ ! -d $output_path ]; then
mkdir $output_path
chmod 777 $output_path
fi
if [ ! -f $build_path/.config ]; then
echo ".....${FA_CHIPSET}_${FA_PRODUCT}_defconfig"
ARCH=arm make arm=ARM O=$build_path distclean
ARCH=arm make arm=ARM O=$build_path ${FA_CHIPSET}_${FA_PRODUCT}_defconfig
fi
if [ "$1" = "" ]; then
ARCH=arm make arm=ARM O=$build_path uImage LOADADDR=0x80008000
ARCH=arm make arm=ARM O=$build_path dtbs
else
ARCH=arm make arm=ARM O=$build_path $1 $2 $3
ARCH=arm make arm=ARM O=$build_path dtbs
fi
if [ "$1" = "dtb" ]; then
ARCH=arm make arm=ARM O=$build_path dtbs
fi
# build kernel modules
if [ "$1" = "modules" ] ; then
ARCH=arm INSTALL_MOD_PATH=$module_install make arm=ARM O=$build_path modules
ARCH=arm INSTALL_MOD_PATH=$module_install make arm=ARM O=$build_path modules_install
ARCH=arm INSTALL_MOD_PATH=$firmware_install make arm=ARM O=$build_path firmware_install
fi
if [ -f $build_path/$image_filename ]; then
for DEST_DIR in ${CP_DIR}
do
mkdir -p ${DEST_DIR}
echo "copy from image $build_path/$image_filename to ${DEST_DIR}/$image_target_filename"
cp $build_path/$image_filename ${DEST_DIR}/$image_target_filename
done
fi
if [ -f $build_path/$dtb_filename ]; then
for DEST_DIR in ${CP_DIR}
do
mkdir -p ${DEST_DIR}
echo "copy from dtb $build_path/$dtb_filename to ${DEST_DIR}/$dtb_target_filename"
cp $build_path/$dtb_filename ${DEST_DIR}/$dtb_target_filename
done
fi