blob: 705bebb3e107ee37169ba1cd24188b506102e013 [file] [log] [blame]
Matthias Maennich6652d742019-02-01 22:20:44 +00001#!/bin/bash
2
3# Copyright (C) 2019 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Usage:
18# build/build.sh <make options>*
19# or:
20# OUT_DIR=<out dir> DIST_DIR=<dist dir> build/build.sh <make options>*
21#
22# Example:
23# OUT_DIR=output DIST_DIR=dist build/build.sh -j24
24#
25#
26# The following environment variables are considered during execution:
27#
28# BUILD_CONFIG
29# Build config file to initialize the build environment from. The location
30# is to be defined relative to the repo root directory.
31# Defaults to 'build.config'.
32#
33# OUT_DIR
34# Base output directory for the kernel build.
35# Defaults to <REPO_ROOT>/out/<BRANCH>.
36#
37# DIST_DIR
38# Base output directory for the kernel distribution.
39# Defaults to <OUT_DIR>/dist
40#
41# EXT_MODULES
42# Space separated list of external kernel modules to be build.
43#
44# UNSTRIPPED_MODULES
45# Space separated list of modules to be copied to <DIST_DIR>/unstripped
46# for debugging purposes.
47#
48# CC
Matthias Maennich0646c8d2019-03-20 11:03:51 +000049# Override compiler to be used. (e.g. CC=clang) Specifying CC=gcc
50# effectively unsets CC to fall back to the default gcc detected by kbuild
51# (including any target triplet). To use a custom 'gcc' from PATH, use an
52# absolute path, e.g. CC=/usr/local/bin/gcc
Matthias Maennich6652d742019-02-01 22:20:44 +000053#
54# LD
55# Override linker (flags) to be used.
56#
Matthias Maennich44509b02019-05-28 12:26:58 +010057# ABI_DEFINITION
58# Location of the abi definition file relative to <REPO_ROOT>/KERNEL_DIR
59# If defined (usually in build.config), also copy that abi definition to
Matthias Maennichd46fd322019-05-29 09:05:38 +010060# <OUT_DIR>/dist/abi.xml when creating the distribution.
Matthias Maennich44509b02019-05-28 12:26:58 +010061#
Matthias Maennich6652d742019-02-01 22:20:44 +000062# Environment variables to influence the stages of the kernel build.
63#
64# SKIP_MRPROPER
65# if defined, skip `make mrproper`
66#
67# SKIP_DEFCONFIG
68# if defined, skip `make defconfig`
69#
Matthias Maenniche4edd6f2019-02-13 12:36:27 +000070# PRE_DEFCONFIG_CMDS
71# Command evaluated before `make defconfig`
72#
Matthias Maennich6652d742019-02-01 22:20:44 +000073# POST_DEFCONFIG_CMDS
74# Command evaluated after `make defconfig` and before `make`.
75#
Matthias Maenniche4edd6f2019-02-13 12:36:27 +000076# POST_KERNEL_BUILD_CMDS
77# Command evaluated after `make`.
78#
Matthias Maennich6652d742019-02-01 22:20:44 +000079# IN_KERNEL_MODULES
80# if defined, install kernel modules
81#
82# SKIP_EXT_MODULES
83# if defined, skip building and installing of external modules
84#
85# EXTRA_CMDS
86# Command evaluated after building and installing kernel and modules.
87#
88# SKIP_CP_KERNEL_HDR
89# if defined, skip installing kernel headers.
90#
Hridya Valsarajue46a9372019-05-13 16:38:14 -070091# BUILD_BOOT_IMG
92# if defined, build a boot.img binary that can be flashed into the 'boot'
93# partition of an Android device. The boot image contains a header as per the
94# format defined by https://source.android.com/devices/bootloader/boot-image-header
95# followed by several components like kernel, ramdisk, DTB etc. The ramdisk
96# component comprises of a GKI ramdisk cpio archive concatenated with a
97# vendor ramdisk cpio archive which is then gzipped. It is expected that
98# all components are present in ${DIST_DIR}.
99#
100# When the BUILD_BOOT_IMG flag is defined, the following flags that point to the
101# various components needed to build a boot.img also need to be defined.
102# - MKBOOTIMG_PATH=<path to the mkbootimg.py script which builds boot.img>
103# - GKI_RAMDISK_PREBUILT_BINARY=<Name of the GKI ramdisk prebuilt which includes
104# the generic ramdisk components like init and the non-device-specific rc files>
105# - VENDOR_RAMDISK_BINARY=<Name of the vendor ramdisk binary which includes the
106# device-specific components of ramdisk like the fstab file and the
107# device-specific rc files.>
108# - KERNEL_BINARY=<name of kernel binary, eg. Image.lz4, Image.gz etc>
109# - BOOT_IMAGE_HEADER_VERSION=<version of the boot image header>
110#
Ram Muthiah3a869ac2019-08-08 21:11:56 -0700111# BUILD_INITRAMFS
112# if defined, build a ramdisk containing all .ko files and resulting depmod artifacts
113#
Matthias Maennich6652d742019-02-01 22:20:44 +0000114# Note: For historic reasons, internally, OUT_DIR will be copied into
115# COMMON_OUT_DIR, and OUT_DIR will be then set to
116# ${COMMON_OUT_DIR}/${KERNEL_DIR}. This has been done to accommodate existing
117# build.config files that expect ${OUT_DIR} to point to the output directory of
118# the kernel build.
119#
120# The kernel is built in ${COMMON_OUT_DIR}/${KERNEL_DIR}.
121# Out-of-tree modules are built in ${COMMON_OUT_DIR}/${EXT_MOD} where
122# ${EXT_MOD} is the path to the module source code.
123
124set -e
125
126# rel_path <to> <from>
127# Generate relative directory path to reach directory <to> from <from>
128function rel_path() {
129 local to=$1
130 local from=$2
131 local path=
132 local stem=
133 local prevstem=
134 [ -n "$to" ] || return 1
135 [ -n "$from" ] || return 1
136 to=$(readlink -e "$to")
137 from=$(readlink -e "$from")
138 [ -n "$to" ] || return 1
139 [ -n "$from" ] || return 1
140 stem=${from}/
141 while [ "${to#$stem}" == "${to}" -a "${stem}" != "${prevstem}" ]; do
142 prevstem=$stem
143 stem=$(readlink -e "${stem}/..")
144 [ "${stem%/}" == "${stem}" ] && stem=${stem}/
145 path=${path}../
146 done
147 echo ${path}${to#$stem}
148}
149
150export ROOT_DIR=$(readlink -f $(dirname $0)/..)
151
152# For module file Signing with the kernel (if needed)
153FILE_SIGN_BIN=scripts/sign-file
154SIGN_SEC=certs/signing_key.pem
155SIGN_CERT=certs/signing_key.x509
156SIGN_ALGO=sha512
157
158source "${ROOT_DIR}/build/envsetup.sh"
159
160export MAKE_ARGS=$@
Matthias Maennich6652d742019-02-01 22:20:44 +0000161export MODULES_STAGING_DIR=$(readlink -m ${COMMON_OUT_DIR}/staging)
162export MODULES_PRIVATE_DIR=$(readlink -m ${COMMON_OUT_DIR}/private)
Matthias Maennich6652d742019-02-01 22:20:44 +0000163export UNSTRIPPED_DIR=${DIST_DIR}/unstripped
164export KERNEL_UAPI_HEADERS_DIR=$(readlink -m ${COMMON_OUT_DIR}/kernel_uapi_headers)
Ram Muthiah3a869ac2019-08-08 21:11:56 -0700165export INITRAMFS_STAGING_DIR=${MODULES_STAGING_DIR}/initramfs_staging
Matthias Maennich6652d742019-02-01 22:20:44 +0000166
167cd ${ROOT_DIR}
168
169export CLANG_TRIPLE CROSS_COMPILE CROSS_COMPILE_ARM32 ARCH SUBARCH
170
Matthias Maennich0646c8d2019-03-20 11:03:51 +0000171# CC=gcc is effectively a fallback to the default gcc including any target
Alessio Balsini280a1922019-08-01 20:04:12 +0000172# triplets. If the user wants to use a custom compiler, they are still able to
173# pass an absolute path, e.g. CC=/usr/bin/gcc.
174[ "${CC}" == "gcc" ] && unset CC
Matthias Maennich0646c8d2019-03-20 11:03:51 +0000175
Matthias Maennich151047e2019-03-18 15:01:03 +0000176if [ -n "${CC}" ]; then
Matthias Maennich2eb25cc2019-06-24 17:45:18 +0100177 CC_ARG="CC=${CC} HOSTCC=${CC}"
Matthias Maennich151047e2019-03-18 15:01:03 +0000178fi
179
180if [ -n "${LD}" ]; then
181 LD_ARG="LD=${LD}"
182fi
183
184CC_LD_ARG="${CC_ARG} ${LD_ARG}"
185
Matthias Maennich6652d742019-02-01 22:20:44 +0000186mkdir -p ${OUT_DIR}
187echo "========================================================"
188echo " Setting up for build"
189if [ -z "${SKIP_MRPROPER}" ] ; then
190 set -x
Matthias Maennich151047e2019-03-18 15:01:03 +0000191 (cd ${KERNEL_DIR} && make ${CC_LD_ARG} O=${OUT_DIR} mrproper)
Matthias Maennich6652d742019-02-01 22:20:44 +0000192 set +x
193fi
194
Petri Gynther0172f352019-02-12 11:52:50 -0800195if [ "${PRE_DEFCONFIG_CMDS}" != "" ]; then
196 echo "========================================================"
197 echo " Running pre-defconfig command(s):"
198 set -x
199 eval ${PRE_DEFCONFIG_CMDS}
200 set +x
201fi
202
Matthias Maennich6652d742019-02-01 22:20:44 +0000203if [ -z "${SKIP_DEFCONFIG}" ] ; then
204set -x
Matthias Maennich151047e2019-03-18 15:01:03 +0000205(cd ${KERNEL_DIR} && make ${CC_LD_ARG} O=${OUT_DIR} ${DEFCONFIG})
Matthias Maennich6652d742019-02-01 22:20:44 +0000206set +x
207
208if [ "${POST_DEFCONFIG_CMDS}" != "" ]; then
209 echo "========================================================"
210 echo " Running pre-make command(s):"
211 set -x
212 eval ${POST_DEFCONFIG_CMDS}
213 set +x
214fi
215fi
216
217echo "========================================================"
218echo " Building kernel"
219
Matthias Maennich6652d742019-02-01 22:20:44 +0000220set -x
221(cd ${OUT_DIR} && \
Matthias Maennich151047e2019-03-18 15:01:03 +0000222 make O=${OUT_DIR} ${CC_LD_ARG} -j$(nproc) $@)
Matthias Maennich6652d742019-02-01 22:20:44 +0000223set +x
224
Petri Gynther0172f352019-02-12 11:52:50 -0800225if [ "${POST_KERNEL_BUILD_CMDS}" != "" ]; then
226 echo "========================================================"
227 echo " Running post-kernel-build command(s):"
228 set -x
229 eval ${POST_KERNEL_BUILD_CMDS}
230 set +x
231fi
232
Matthias Maennich6652d742019-02-01 22:20:44 +0000233rm -rf ${MODULES_STAGING_DIR}
234mkdir -p ${MODULES_STAGING_DIR}
235
Ram Muthiah3a869ac2019-08-08 21:11:56 -0700236if [ -n "${BUILD_INITRAMFS}" -o -n "${IN_KERNEL_MODULES}" ]; then
Matthias Maennich6652d742019-02-01 22:20:44 +0000237 echo "========================================================"
238 echo " Installing kernel modules into staging directory"
239
240 (cd ${OUT_DIR} && \
Matthias Maennich151047e2019-03-18 15:01:03 +0000241 make O=${OUT_DIR} ${CC_LD_ARG} INSTALL_MOD_STRIP=1 \
Matthias Maennich6652d742019-02-01 22:20:44 +0000242 INSTALL_MOD_PATH=${MODULES_STAGING_DIR} modules_install)
243fi
244
245if [[ -z "${SKIP_EXT_MODULES}" ]] && [[ "${EXT_MODULES}" != "" ]]; then
246 echo "========================================================"
247 echo " Building external modules and installing them into staging directory"
248
249 for EXT_MOD in ${EXT_MODULES}; do
250 # The path that we pass in via the variable M needs to be a relative path
251 # relative to the kernel source directory. The source files will then be
252 # looked for in ${KERNEL_DIR}/${EXT_MOD_REL} and the object files (i.e. .o
253 # and .ko) files will be stored in ${OUT_DIR}/${EXT_MOD_REL}. If we
254 # instead set M to an absolute path, then object (i.e. .o and .ko) files
255 # are stored in the module source directory which is not what we want.
256 EXT_MOD_REL=$(rel_path ${ROOT_DIR}/${EXT_MOD} ${KERNEL_DIR})
257 # The output directory must exist before we invoke make. Otherwise, the
258 # build system behaves horribly wrong.
259 mkdir -p ${OUT_DIR}/${EXT_MOD_REL}
260 set -x
261 make -C ${EXT_MOD} M=${EXT_MOD_REL} KERNEL_SRC=${ROOT_DIR}/${KERNEL_DIR} \
Matthias Maennich151047e2019-03-18 15:01:03 +0000262 O=${OUT_DIR} ${CC_LD_ARG} -j$(nproc) "$@"
Matthias Maennich6652d742019-02-01 22:20:44 +0000263 make -C ${EXT_MOD} M=${EXT_MOD_REL} KERNEL_SRC=${ROOT_DIR}/${KERNEL_DIR} \
Matthias Maennich151047e2019-03-18 15:01:03 +0000264 O=${OUT_DIR} ${CC_LD_ARG} INSTALL_MOD_STRIP=1 \
Matthias Maennich6652d742019-02-01 22:20:44 +0000265 INSTALL_MOD_PATH=${MODULES_STAGING_DIR} modules_install
266 set +x
267 done
268
269fi
270
271if [ "${EXTRA_CMDS}" != "" ]; then
272 echo "========================================================"
273 echo " Running extra build command(s):"
274 set -x
275 eval ${EXTRA_CMDS}
276 set +x
277fi
278
279OVERLAYS_OUT=""
280for ODM_DIR in ${ODM_DIRS}; do
281 OVERLAY_DIR=${ROOT_DIR}/device/${ODM_DIR}/overlays
282
283 if [ -d ${OVERLAY_DIR} ]; then
284 OVERLAY_OUT_DIR=${OUT_DIR}/overlays/${ODM_DIR}
285 mkdir -p ${OVERLAY_OUT_DIR}
286 make -C ${OVERLAY_DIR} DTC=${OUT_DIR}/scripts/dtc/dtc OUT_DIR=${OVERLAY_OUT_DIR}
287 OVERLAYS=$(find ${OVERLAY_OUT_DIR} -name "*.dtbo")
288 OVERLAYS_OUT="$OVERLAYS_OUT $OVERLAYS"
289 fi
290done
291
292mkdir -p ${DIST_DIR}
293echo "========================================================"
294echo " Copying files"
Alessio Balsiniac896332019-07-16 15:20:24 +0100295for FILE in $(cd ${OUT_DIR} && ls -1 ${FILES}); do
Matthias Maennich6652d742019-02-01 22:20:44 +0000296 if [ -f ${OUT_DIR}/${FILE} ]; then
297 echo " $FILE"
298 cp -p ${OUT_DIR}/${FILE} ${DIST_DIR}/
299 else
Alessio Balsiniac896332019-07-16 15:20:24 +0100300 echo " $FILE is not a file, skipping"
Matthias Maennich6652d742019-02-01 22:20:44 +0000301 fi
302done
303
304for FILE in ${OVERLAYS_OUT}; do
305 OVERLAY_DIST_DIR=${DIST_DIR}/$(dirname ${FILE#${OUT_DIR}/overlays/})
306 echo " ${FILE#${OUT_DIR}/}"
307 mkdir -p ${OVERLAY_DIST_DIR}
308 cp ${FILE} ${OVERLAY_DIST_DIR}/
309done
310
311MODULES=$(find ${MODULES_STAGING_DIR} -type f -name "*.ko")
312if [ -n "${MODULES}" ]; then
Matthias Maennich6652d742019-02-01 22:20:44 +0000313 if [ -n "${IN_KERNEL_MODULES}" -o "${EXT_MODULES}" != "" ]; then
Ram Muthiah3a869ac2019-08-08 21:11:56 -0700314 echo "========================================================"
315 echo " Copying modules files"
Matthias Maennich6652d742019-02-01 22:20:44 +0000316 for FILE in ${MODULES}; do
317 echo " ${FILE#${MODULES_STAGING_DIR}/}"
318 cp -p ${FILE} ${DIST_DIR}
319 done
320 fi
Ram Muthiah3a869ac2019-08-08 21:11:56 -0700321 if [ -n "${BUILD_INITRAMFS}" ]; then
322 echo "========================================================"
323 echo " Creating initramfs"
324 set -x
325 rm -rf ${INITRAMFS_STAGING_DIR}
326 mkdir -p ${INITRAMFS_STAGING_DIR}/lib/modules/kernel/
327 cp -r ${MODULES_STAGING_DIR}/lib/modules/*/kernel/* ${INITRAMFS_STAGING_DIR}/lib/modules/kernel/
328 cp ${MODULES_STAGING_DIR}/lib/modules/*/modules.* ${INITRAMFS_STAGING_DIR}/lib/modules/
329 cp ${MODULES_STAGING_DIR}/lib/modules/*/modules.order ${INITRAMFS_STAGING_DIR}/lib/modules/modules.load
330
331 (cd ${INITRAMFS_STAGING_DIR} && find . | cpio -H newc -o > ${MODULES_STAGING_DIR}/initramfs.cpio)
332 gzip -f ${MODULES_STAGING_DIR}/initramfs.cpio
333 mv ${MODULES_STAGING_DIR}/initramfs.cpio.gz ${DIST_DIR}/initramfs.img
334 set +x
335 fi
Matthias Maennich6652d742019-02-01 22:20:44 +0000336fi
337
338if [ "${UNSTRIPPED_MODULES}" != "" ]; then
339 echo "========================================================"
340 echo " Copying unstripped module files for debugging purposes (not loaded on device)"
341 mkdir -p ${UNSTRIPPED_DIR}
342 for MODULE in ${UNSTRIPPED_MODULES}; do
343 find ${MODULES_PRIVATE_DIR} -name ${MODULE} -exec cp {} ${UNSTRIPPED_DIR} \;
344 done
345fi
346
347if [ -z "${SKIP_CP_KERNEL_HDR}" ]; then
348 echo "========================================================"
349 echo " Installing UAPI kernel headers:"
350 mkdir -p "${KERNEL_UAPI_HEADERS_DIR}/usr"
Matthias Maennich151047e2019-03-18 15:01:03 +0000351 make -C ${OUT_DIR} O=${OUT_DIR} ${CC_LD_ARG} INSTALL_HDR_PATH="${KERNEL_UAPI_HEADERS_DIR}/usr" -j$(nproc) headers_install
Matthias Maennich6652d742019-02-01 22:20:44 +0000352 # The kernel makefiles create files named ..install.cmd and .install which
353 # are only side products. We don't want those. Let's delete them.
354 find ${KERNEL_UAPI_HEADERS_DIR} \( -name ..install.cmd -o -name .install \) -exec rm '{}' +
355 KERNEL_UAPI_HEADERS_TAR=${DIST_DIR}/kernel-uapi-headers.tar.gz
356 echo " Copying kernel UAPI headers to ${KERNEL_UAPI_HEADERS_TAR}"
357 tar -czf ${KERNEL_UAPI_HEADERS_TAR} --directory=${KERNEL_UAPI_HEADERS_DIR} usr/
358fi
359
360if [ -z "${SKIP_CP_KERNEL_HDR}" ] ; then
Matthias Maennichbec886a2019-04-15 07:23:47 +0100361 echo "========================================================"
362 KERNEL_HEADERS_TAR=${DIST_DIR}/kernel-headers.tar.gz
363 echo " Copying kernel headers to ${KERNEL_HEADERS_TAR}"
364 pushd $ROOT_DIR/$KERNEL_DIR
365 find arch include $OUT_DIR -name *.h -print0 \
366 | tar -czf $KERNEL_HEADERS_TAR \
367 --absolute-names \
368 --dereference \
369 --transform "s,.*$OUT_DIR,," \
370 --transform "s,^,kernel-headers/," \
371 --null -T -
372 popd
Matthias Maennich6652d742019-02-01 22:20:44 +0000373fi
374
Matthias Maennichd46fd322019-05-29 09:05:38 +0100375# Copy the abi_${arch}.xml file from the sources into the dist dir
Matthias Maennich44509b02019-05-28 12:26:58 +0100376if [ -n "${ABI_DEFINITION}" ]; then
377 echo "========================================================"
Matthias Maennichd46fd322019-05-29 09:05:38 +0100378 echo " Copying abi definition to ${DIST_DIR}/abi.xml"
Matthias Maennich44509b02019-05-28 12:26:58 +0100379 pushd $ROOT_DIR/$KERNEL_DIR
Matthias Maennichd46fd322019-05-29 09:05:38 +0100380 cp "${ABI_DEFINITION}" ${DIST_DIR}/abi.xml
Matthias Maennich44509b02019-05-28 12:26:58 +0100381 popd
382fi
383
Matthias Maennich6652d742019-02-01 22:20:44 +0000384echo "========================================================"
385echo " Files copied to ${DIST_DIR}"
386
Hridya Valsarajue46a9372019-05-13 16:38:14 -0700387if [ ! -z "${BUILD_BOOT_IMG}" ] ; then
388
389 DTB_FILE_LIST=$(find ${DIST_DIR} -name "*.dtb")
390 if [ -z "${DTB_FILE_LIST}" ]; then
391 echo "No *.dtb files found in ${DIST_DIR}"
392 exit 1
393 fi
394 cat $DTB_FILE_LIST > ${DIST_DIR}/dtb.img
395
396 if [ ! -f "${DIST_DIR}/$GKI_RAMDISK_PREBUILT_BINARY" ]; then
397 echo "GKI ramdisk prebuilt binary" \
398 "(GKI_RAMDISK_PREBUILT_BINARY = $GKI_RAMDISK_PREBUILT_BINARY)" \
399 "not present in ${DIST_DIR}"
400 exit 1
401 fi
402 if [ ! -f "${DIST_DIR}/$VENDOR_RAMDISK_BINARY" ]; then
403 echo "vendor ramdisk binary(VENDOR_RAMDISK_BINARY = $VENDOR_RAMDISK_BINARY)" \
404 "not present in ${DIST_DIR}"
405 exit 1
406 fi
407
408 cat ${DIST_DIR}/$GKI_RAMDISK_PREBUILT_BINARY ${DIST_DIR}/$VENDOR_RAMDISK_BINARY \
409 > ${DIST_DIR}/ramdisk.cpio
410 gzip -f ${DIST_DIR}/ramdisk.cpio > ${DIST_DIR}/ramdisk
411
412 if [ ! -x "$MKBOOTIMG_PATH" ]; then
413 echo "mkbootimg.py script not found or not executable. MKBOOTIMG_PATH = $MKBOOTIMG_PATH"
414 exit 1
415 fi
416
417 if [ ! -f "${DIST_DIR}/$KERNEL_BINARY" ]; then
418 echo "kernel binary(KERNEL_BINARY = $KERNEL_BINARY) not present in ${DIST_DIR}"
419 exit 1
420 fi
421
422 if [ -z "${BOOT_IMAGE_HEADER_VERSION}" ]; then
423 echo "BOOT_IMAGE_HEADER_VERSION must specify the boot image header version"
424 exit 1
425 fi
426
427 (set -x; $MKBOOTIMG_PATH --kernel ${DIST_DIR}/$KERNEL_BINARY \
428 --ramdisk ${DIST_DIR}/ramdisk \
429 --dtb ${DIST_DIR}/dtb.img --header_version $BOOT_IMAGE_HEADER_VERSION \
430 -o ${DIST_DIR}/boot.img
431 )
432 set +x
433 echo "boot image created at ${DIST_DIR}/boot.img"
434fi
435
436
Matthias Maennich6652d742019-02-01 22:20:44 +0000437# No trace_printk use on build server build
438if readelf -a ${DIST_DIR}/vmlinux 2>&1 | grep -q trace_printk_fmt; then
439 echo "========================================================"
440 echo "WARN: Found trace_printk usage in vmlinux."
441 echo ""
442 echo "trace_printk will cause trace_printk_init_buffers executed in kernel"
443 echo "start, which will increase memory and lead warning shown during boot."
444 echo "We should not carry trace_printk in production kernel."
445 echo ""
446 if [ ! -z "${STOP_SHIP_TRACEPRINTK}" ]; then
447 echo "ERROR: stop ship on trace_printk usage." 1>&2
448 exit 1
449 fi
450fi