📄 makefile
字号:
# ############################################################################ Makefile - generation of hardhat (kernel) component# Copyright 2006-2007 Motorola, Inc.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA## Date Author Comment# =========== ============== ==============================================# 09-Nov-2006 Motorola Initial revision.# 22-Nov-2006 Motorola TOOLPREFIX dump functionality.# 06-Dec-2006 Motorola Added FEAT_ETM check.# 15-Dec-2006 Motorola Added memory dump support (DBG_MEMDUMP)# 01-Jan-2007 Motorola Removed an inccorect export# 01-Jan-2007 Motorola Fixed API rebuild issues, added -j4 to kernel# 24-Jan-2007 Motorola Added FEAT_PTRACE# 07-Feb-2007 Motorola Export light_sensor.h.# 02-Mar-2007 Motorola Exported motfb.h and mxcfb.h# 05-May-2007 Motorola Added TURBO_INDICATOR# ###########################################################################include $(BOOTSTRAP)# ############################################################################ Variable Setup# ###########################################################################KERNEL_VERSION = 2.6LINUXROOT = $(COMPTOP)/linux-$(KERNEL_VERSION).xPRODUCT_DIR := $(BUILDTOP)/$(ARCH)/$(PROC_TYPE)/$(PRODUCT)PRODUCT_ROOTFS := $(PRODUCT_DIR)/fsLINUXBUILD = $(PRODUCT_DIR)/linux_buildLINUXBUILD_KERNEL = $(PRODUCT_DIR)/kernel/linux_buildAPI_INCS = $(COMPTOP)/linux-2.6.x/include//linux/moto_accy.h \ $(COMPTOP)/linux-2.6.x/include//linux/camera.h \ $(COMPTOP)/linux-2.6.x/include//linux/videodev.h \ $(COMPTOP)/linux-2.6.x/include//linux/lights_funlights.h \ $(COMPTOP)/linux-2.6.x/include//linux/light_sensor.h \ $(COMPTOP)/linux-2.6.x/include//linux/power_ic.h \ $(COMPTOP)/linux-2.6.x/include//linux/lights_backlight.h \ $(COMPTOP)/linux-2.6.x/include//linux/usr_blk_dev.h \ $(COMPTOP)/linux-2.6.x/include//linux/keypad.h \ $(COMPTOP)/linux-2.6.x/include//linux/sdhc_user.h \ $(COMPTOP)/linux-2.6.x/include//linux/keyv.h \ $(COMPTOP)/linux-2.6.x/include//linux/sahara/sahara.h \ $(COMPTOP)/linux-2.6.x/include//linux/sahara/fsl_shw.h \ $(COMPTOP)/linux-2.6.x/include//linux/sahara/fsl_platform.h \ $(COMPTOP)/linux-2.6.x/include//linux/sahara/sah_kernel.h \ $(COMPTOP)/linux-2.6.x/include//linux/sahara/sf_util.h \ $(COMPTOP)/linux-2.6.x/include//linux/sahara/adaptor.h \ $(COMPTOP)/linux-2.6.x/drivers/mxc/apal/apal_driver.h \ $(COMPTOP)/linux-2.6.x/include/asm-arm/arch-mxc//linux/mxc_mu.h \ $(COMPTOP)/linux-2.6.x/include/asm-arm/arch-mxc//linux/mxc_ipc.h \ $(COMPTOP)/linux-2.6.x/include//asm-arm/setup.h \ $(COMPTOP)/linux-2.6.x/include//linux/motfb.h \ $(COMPTOP)/linux-2.6.x/include//linux/mxcfb.h# don't build kernel for x86ifneq($(HW_ARCH),i686)API_DIRS = $(LINUXBUILD) $(COMPTOP)/kernel_includeDOTCONFIG = $(LINUXBUILD)/.config# Parse the full path and prefix for the cross compiler prefixTOOLPREFIX = $(patsubst %-gcc,%-,$(CC))TOOLPREFIX_DUMP = $(LINUXBUILD)/toolprefix.mk# ############################################################################ DYNAMIC GENERATION OF KERNEL CONFIGURATION FILE (defconfig)## For more information, see:# /vobs/jem/hardhat/linux-2.6.x/arch/arm/configs/motorola_ljap/README.txt# ###########################################################################TARGET_DEFCONFIG := ${PRODUCT_DIR}/${PRODUCT}_defconfigDEFCONFIGSRC := ${LINUXROOT}/arch/${ARCH}/configsLJAPDEFCONFIGSRC := ${DEFCONFIGSRC}/motorola_ljap# build list of files to be concatenated together to make the linux defconfigPRODUCT_SPECIFIC_DEFCONFIGS := \ ${DEFCONFIGSRC}/motorola_ljap_defconfig \ ${LJAPDEFCONFIGSRC}/product-family/${PRODUCT_FAMILY}.config \ ${LJAPDEFCONFIGSRC}/product/${PRODUCT}.config \ ${DEFCONFIGSRC}/${PRODUCT}_defconfig# Build the small page NAND YAFFS module or the Large Page NAND YAFFS module.PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/nand_${MEM_MAP_PAGE_SIZE}.config# compile USBOTG drivers statically to support NFS-over-USBifeq($(FEAT_USBOTG),static) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/usbotgstatic.config \ ${LJAPDEFCONFIGSRC}/feature/usbotgstatic.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/usbotgstatic.${PRODUCT}_configendif# allow MXC internal UART3 to be used as a serial consoleifeq($(FEAT_CONSOLE),serial) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/serialconsole.config \ ${LJAPDEFCONFIGSRC}/feature/serialconsole.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/serialconsole.${PRODUCT}_configendif# SiERRA: Linear Vibratorifneq($(HW_LINEARVIBRATOR),0) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/linearvibrator.config \ ${LJAPDEFCONFIGSRC}/feature/linearvibrator.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/linearvibrator.${PRODUCT}_configendif# SiERRA: Capacitive Touchifneq($(HW_CAPTOUCH),0) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/captouch.config \ ${LJAPDEFCONFIGSRC}/feature/captouch.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/captouch.${PRODUCT}_configendif# SiERRA: Ceramic Speakerifneq($(HW_CERAMICSPEAKER),0) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/ceramicspeaker.config \ ${LJAPDEFCONFIGSRC}/feature/ceramicspeaker.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/ceramicspeaker.${PRODUCT}_configendififeq($(DBG_OPROFILE),1) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/oprofile.configendififeq($(DBG_MEMDUMP),1) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/memdump.configendififeq($(FEAT_PTRACE),1) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/ptrace.config \ ${LJAPDEFCONFIGSRC}/feature/ptrace.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/ptrace.${PRODUCT}_configendif# SiERRA: Proximity Sensorifneq($(HW_PROXSENSOR),0) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/proxsensor.config \ ${LJAPDEFCONFIGSRC}/feature/proxsensor.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/proxsensor.${PRODUCT}_configendif# Enable ETM IOMUX configurationifneq($(FEAT_ETM),0) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/etm.config \ ${LJAPDEFCONFIGSRC}/feature/etm.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/etm.${PRODUCT}_configendififeq($(TEST_I2CDEV),1) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/i2cdev.config \ ${LJAPDEFCONFIGSRC}/feature/i2cdev.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/i2cdev.${PRODUCT}_configendififeq($(DBG_TURBO_INDICATOR),1) PRODUCT_SPECIFIC_DEFCONFIGS += \ ${LJAPDEFCONFIGSRC}/feature/turbo.config \ ${LJAPDEFCONFIGSRC}/feature/turbo.${PRODUCT_FAMILY}_config \ ${LJAPDEFCONFIGSRC}/feature/turbo.${PRODUCT}_configendif # filter out any non-existent filesPRODUCT_SPECIFIC_DEFCONFIGS := \ $(strip $(foreach FILE, $(PRODUCT_SPECIFIC_DEFCONFIGS), \ $(wildcard $(FILE))))# Allow user to specify arbitrary files to be concatenated from the command# line. Do this after filtering for non-existent files so that an error# will be returned if a specified file doesn't exist.ifneq($(TEST_LNXOS_DEFCONFIGS),) PRODUCT_SPECIFIC_DEFCONFIGS += ${strip ${TEST_LNXOS_DEFCONFIGS}}endif# generate a defconfig file${TARGET_DEFCONFIG}: ${PRODUCT_SPECIFIC_DEFCONFIGS} # generate an error message if no config files are definedifeq($(PRODUCT_SPECIFIC_DEFCONFIGS),) @echo "No defconfig file defined for PRODUCT=$(PRODUCT))" falseendif mkdir -p $(PRODUCT_DIR) @( perl -le 'print "# This file was automatically generated from:\n#\t" . join("\n#\t", @ARGV) . "\n"' $(PRODUCT_SPECIFIC_DEFCONFIGS) && cat $(PRODUCT_SPECIFIC_DEFCONFIGS) ) > $@ || ( rm -f $@ && false )# ############################################################################ Kernel Build Targets# ###########################################################################.PHONY: distclean kernel modules kernel_clean# don't build anything in parallel, needed for kernel_clean and $(DOTCONFIG).NOTPARALLEL: # kernel clean must come first, but cannot be a dependencyapi_build: $(DOTCONFIG)impl: kernel modules# avoid partial winkins of .config when kernel is not properly cleanedifneq(_$(NO_KERNEL_CLEAN),_yes).NO_CONFIG_REC: kernel moduleselse.NO_CONFIG_REC: kernel modules $(DOTCONFIG)endif$(DOTCONFIG): $(TARGET_DEFCONFIG)ifneq(_$(NO_KERNEL_CLEAN),_yes) # clean out config area to prevent partial builds from winking in rm -rf $(LINUXBUILD)endif mkdir -p $(LINUXBUILD) cd $(LINUXROOT) && env -u MAKECMDGOALS make MAKE=make ARCH=$(ARCH) CROSS_COMPILE=$(TOOLPREFIX) O=$(@D) MOT_KBUILD_DEFCONFIG=$(TARGET_DEFCONFIG) defconfig modules_prepare # Build Environment sends the regular, non-metric-collecting compiler, # so we can skim off the the toolprefix for kernel and module builds. # For other components building modules, we need to save off this value # and bring it into the generated Makefile @echo "TOOLPREFIX=$(TOOLPREFIX)" > $(TOOLPREFIX_DUMP)kernel: $(DOTCONFIG) # Kernel must make a copy of the config area to prevent the api step from rebuilding unnecessarilyifneq(_$(NO_KERNEL_CLEAN),_yes) # Clean out kernel build area for safety rm -rf $(LINUXBUILD_KERNEL)endif mkdir -p $(LINUXBUILD_KERNEL) cp -a $(LINUXBUILD) $(dir $(LINUXBUILD_KERNEL)) # JOBS tells gnumake to use the j option. cd $(LINUXBUILD_KERNEL) && $(MAKE) JOBS=-j4 ARCH=$(ARCH) zImagemodules: kernel mkdir -p $(PRODUCT_ROOTFS) # Build the modules in the kernel area, so that the LINUXBUILD area is not contaminated. cd $(LINUXBUILD_KERNEL) && $(MAKE) ARCH=$(ARCH) INSTALL_MOD_PATH=${PRODUCT_ROOTFS} modules modules_installdistclean: cleanendif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -