blob: 70456f527d765fbb1075d486fa6d811d1eee5af7 (
plain)
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
115
116
117
118
119
120
121
|
#!/bin/bash
function usage() {
cat >&2 <<- EOF
******************************************************
make tool for kernel source .
Usage: ${0} [OPTIONS] [PLATFORM] [TARGET]
OPTIONS:
-h: this help message .
PLATFORM:
target platform : [mx35|mx35-linux|x86|m166e|mx50|mx50-linux|mx6|mx6-linux]
TARGET:
make target of kernel source .
---------------------
example:
${0} mx35
${0} mx35 clean
${0} mx35 menuconfig
${0} mx50 uImage
${0} mx50 menuconfig
${0} mx50 modules
${0} mx50 modules_install
******************************************************
EOF
}
. kfunc.sh
WORK_DIR="$(pwd)"
PLATFORM_NAME="${1}"
MAKE_TARGET="${2}"
platform_arch=""
platform_cross=""
_tmp_file="/tmp/${USER}_tmp"
echo -n "" > "${_tmp_file}"
while getopts ":h" opt
do
case ${opt} in
h )
usage
exit 0 ;;
* )
echo -n "${opt} ${OPTARG} " >> "${_tmp_file}"
;;
esac
done
shift "$(expr ${OPTIND} - 1)"
setup_platform "${PLATFORM_NAME}"
#obj_dir="$(get_obj_dir)"
#if [ "${obj_dir}" ];then
# O_OPT="O=${obj_dir}"
#fi
#make ${O_OPT} ARCH="${platform_arch}" CROSS_COMPILE="${platform_cross}"
if [ "${MAKE_TARGET}" = "modules_install" ];then
MOD_DIR="${WORK_DIR}/_root_modules"
OUT_MOD_DIR="${WORK_DIR}/root_modules"
if [ ! -d "${MOD_DIR}" ];then
mkdir -p "${MOD_DIR}"
fi
INSTALL_MOD_PATH_OPT="INSTALL_MOD_PATH=${MOD_DIR}"
fi
OTHER_MAKE_OPTIONS="$(cat "${_tmp_file}")"
#echo "make ${OTHER_MAKE_OPTIONS} ARCH="${platform_arch}" CROSS_COMPILE="${platform_cross}" ${INSTALL_MOD_PATH_OPT} ${MAKE_TARGET} |tee make.log"
echo "===================================="
echo "PLATFORM=${PLATFORM_NAME}"
echo "CROSS_COMPILE=${platform_cross}"
echo "ARCH=${platform_arch}"
echo "TARGET=${MAKE_TARGET}"
echo "===================================="
if [ "${MAKE_TARGET}" = "menuconfig" ];then
make ${OTHER_MAKE_OPTIONS} ARCH="${platform_arch}" CROSS_COMPILE="${platform_cross}" ${INSTALL_MOD_PATH_OPT} ${MAKE_TARGET} |tee make.log
else
make ${OTHER_MAKE_OPTIONS} ARCH="${platform_arch}" CROSS_COMPILE="${platform_cross}" ${INSTALL_MOD_PATH_OPT} ${MAKE_TARGET} 2>&1|tee make.log
fi
if [ "${MAKE_TARGET}" = "modules_install" ];then
if [ -d "${OUT_MOD_DIR}" ];then
pushd "${OUT_MOD_DIR}"
find -type f |grep -v \.svn |
while read fname
do
rm "${fname}"
done
popd
pushd "${MOD_DIR}"
cp -a * "${OUT_MOD_DIR}/"
popd
rm -fr "${MOD_DIR}"
else
mv "${MOD_DIR}" "${OUT_MOD_DIR}"
fi
fi
|