12 if [ "${KBUILD_OUTPUT_SUPPORT}" == "yes" ];then
13 outdir
=..
/${MTK_ROOT_OUT}/KERNEL_OBJ
15 mkdir
-p mediatek
/custom
16 ln -fns ..
/..
/..
/${MTK_ROOT_CUSTOM_OUT} mediatek
/custom
/out
20 echo "Usage: $0 {release|rebuild|clean|silent|verbose|single} [config-xxx]"
21 echo " config file will be generated if build with TARGET_PRODUCT"
26 echo "**** Cleaning ****"
27 nice
make ${makeflags} ${makedefs} distclean
32 while test -n "$1"; do
58 export TARGET_PRODUCT
=$1
64 source ..
/mediatek
/build
/shell.sh ..
/ kernel
65 defcfg
="${MTK_ROOT_GEN_CONFIG}/kconfig"
66 if [ "${KBUILD_OUTPUT_SUPPORT}" == "yes" ]; then
67 makeflags
+=" O=$outdir"
70 if [ ! -z $KMOD_PATH ]; then
71 if [ ! -e $KMOD_PATH ]; then
72 echo "Invalid KMOD_PATH:$KMOD_PATH"
78 # clean if it is necessary
79 if [ "${clean}" == "y" ]; then
80 if [ ! -z $KMOD_PATH ]; then
81 echo "Clean kernel module PROJECT=$MTK_PROJECT PATH=$KMOD_PATH";
82 if [ "${KBUILD_OUTPUT_SUPPORT}" == "yes" ]; then
83 make M
="$KMOD_PATH" O
=$outdir clean
85 make M
="$KMOD_PATH" clean
93 if [ "${mrproper}" == "y" ]; then
94 make mrproper
; exit $?
;
97 if [ "${rebuild}" == "y" ]; then make_clean
; fi
99 echo "**** Configuring / $defcfg / ****"
100 # select correct configuration file
101 if [ "${KBUILD_OUTPUT_SUPPORT}" == "yes" ]; then
102 make mediatek-configs O
=$outdir
104 make mediatek-configs
107 # Config DRAM size according to central Project Configuration file setting
109 # Need a robust mechanism to control Kconfig content by central Config setting
110 # Move below segment to a configuration file for extension
111 if [ "$CUSTOM_DRAM_SIZE" == "3G" ]; then
112 # Config DRAM size as 3G (0x18000000).
113 sed --in-place=.orig \
114 -e 's/\(CONFIG_MAX_DRAM_SIZE_SUPPORT=\).*/\10x18000000/' \
117 if [ "$CUSTOM_DRAM_SIZE" == "2G" ]; then
118 # Config DRAM size as 2G (0x10000000).
119 sed --in-place=.orig \
120 -e 's/\(CONFIG_MAX_DRAM_SIZE_SUPPORT=\).*/\10x10000000/' \
121 -e 's/\(CONFIG_RESERVED_MEM_SIZE_FOR_PMEM=\).*/\10x1700000/' \
124 if [ "$CUSTOM_DRAM_SIZE" == "4G" ]; then
125 # Config DRAM size as 4G (0x20000000).
126 sed --in-place=.orig \
127 -e 's/\(CONFIG_MAX_DRAM_SIZE_SUPPORT=\).*/\10x20000000/' \
130 if [ "$CUSTOM_DRAM_SIZE" == "6G" ]; then
131 # Config DRAM size as 6G (0x30000000).
132 sed --in-place=.orig \
133 -e 's/\(CONFIG_MAX_DRAM_SIZE_SUPPORT=\).*/\10x30000000/' \
134 -e 's/\(CONFIG_CMDLINE=.*\)"/\1 vmalloc=280M"/' \
135 -e 's/.*\(CONFIG_HIGHMEM\).*/\1=y/' \
136 -e '$ a\# CONFIG_HIGHPTE is not set' \
137 -e '$ a\# CONFIG_DEBUG_HIGHMEM is not set' \
140 if [ "$CUSTOM_DRAM_SIZE" == "8G" ]; then
141 # Config DRAM size as 8G (0x40000000).
142 sed --in-place=.orig \
143 -e 's/\(CONFIG_MAX_DRAM_SIZE_SUPPORT=\).*/\10x40000000/' \
144 -e 's/\(CONFIG_CMDLINE=.*\)"/\1 vmalloc=280M"/' \
145 -e 's/.*\(CONFIG_HIGHMEM\).*/\1=y/' \
146 -e '$ a\# CONFIG_HIGHPTE is not set' \
147 -e '$ a\# CONFIG_DEBUG_HIGHMEM is not set' \
155 # update configuration
156 nice
make ${makeflags} ${makedefs} silentoldconfig
158 if [ ! -z $KMOD_PATH ]; then
159 echo "Build kernel module PROJECT=$MTK_PROJECT PATH=$KMOD_PATH";
160 if [ "${KBUILD_OUTPUT_SUPPORT}" == "yes" ]; then
161 make M
="$KMOD_PATH" O
=$outdir modules
163 make M
="$KMOD_PATH" modules
168 echo "**** Building ****"
169 make ${makeflags} ${makejobs} ${makedefs}
171 if [ $?
-ne 0 ]; then exit 1; fi
173 echo "**** Successfully built kernel ****"
175 mkimg
="${MTK_ROOT_BUILD}/tools/mkimage"
176 if [ "${KBUILD_OUTPUT_SUPPORT}" == "yes" ]; then
177 if [ "${TARGET_ARCH}" == "arm64" ]; then
178 kernel_img
="${outdir}/arch/arm64/boot/Image"
179 if [ "${MTK_APPENDED_DTB_SUPPORT}" == "yes" ]; then
180 kernel_zimg
="${outdir}/arch/arm64/boot/Image.gz-dtb"
182 kernel_zimg
="${outdir}/arch/arm64/boot/Image.gz"
184 kernel_img
="${outdir}/arch/arm/boot/Image"
185 if [ "${MTK_APPENDED_DTB_SUPPORT}" == "yes" ]; then
186 kernel_zimg
="${outdir}/arch/arm/boot/zImage-dtb"
188 kernel_zimg
="${outdir}/arch/arm/boot/zImage"
191 if [ "${TARGET_ARCH}" == "arm64" ]; then
192 kernel_img
="${curdir}/arch/arm64/boot/Image"
193 if [ "${MTK_APPENDED_DTB_SUPPORT}" == "yes" ]; then
194 kernel_zimg
="${curdir}/arch/arm64/boot/Image.gz-dtb"
196 kernel_zimg
="${curdir}/arch/arm64/boot/Image.gz"
198 kernel_img
="${curdir}/arch/arm/boot/Image"
199 if [ "${MTK_APPENDED_DTB_SUPPORT}" == "yes" ]; then
200 kernel_zimg
="${curdir}/arch/arm/boot/zImage-dtb"
202 kernel_zimg
="${curdir}/arch/arm/boot/zImage"
206 echo "**** Generate download images ****"
208 if [ ! -x ${mkimg} ]; then chmod a
+x
${mkimg}; fi
210 if [ "${KBUILD_OUTPUT_SUPPORT}" == "yes" ]; then
211 ${mkimg} ${kernel_zimg} KERNEL > $outdir/kernel_${MTK_PROJECT}.bin
213 ${mkimg} ${kernel_zimg} KERNEL > kernel_${MTK_PROJECT}.bin
216 copy_to_legacy_download_flash_folder
$outdir/kernel_
${MTK_PROJECT}.bin rootfs_
${MTK_PROJECT}.bin