在MAKEFILE适当位置增加如下定义:
LINUXINCLUDE := \
-I$(srctree)/arch/$(hdr-arch)/include \
-Iarch/$(hdr-arch)/include/generated \
$(if $(KBUILD_SRC), -I$(srctree)/include) \
-Iinclude \
$(USERINCLUDE)
KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-fno-delete-null-pointer-checks \
-Werror=format -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
KBUILD_AFLAGS_KERNEL :=
KBUILD_CFLAGS_KERNEL :=
KBUILD_AFLAGS := -D__ASSEMBLY__
KBUILD_AFLAGS_MODULE := -DMODULE
KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
###########333
#zheng add macro define
include $(srctree)/vendor_define_gen.mk
KBUILD_CFLAGS += $(KERNEL_CDEFS)
KBUILD_CPPFLAGS += $(KERNEL_CDEFS)
$(error ++++++kingberry custom defines: $(KERNEL_CDEFS))
#kingberry.end
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP
export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
vendor_define_gen.mk这个文件定义如下:
MY_PROJECT := $(subst full_,,$(TARGET_PRODUCT))
include $(srctree)/../device/eastaeon/$(MY_PROJECT)/vendor/vendor_config.mk
-include $(srctree)/../device/eastaeon/$(MY_PROJECT)/vendor/vendor_config_$(XXXXXXXX_VENDOR).mk
include $(srctree)/../device/eastaeon/$(MY_PROJECT)/ProjectConfig.mk
include $(srctree)/../build/core/my_add_mtk_macro_def.mk
KERNEL_CDEFS=$(call mtk.custom.generate-macros)
#$(info *******************test zheng ************************** )
#$(error $(KERNEL_CDEFS) )
/
lk中增加宏定义:
# When the host arch is ARM, ensure stack protection code is not emitted since
# it's not supported by the bootloader's libc
ifneq ($(shell uname -m | grep "arm.*"),)
CFLAGS += -fno-stack-protector
endif
CPPFLAGS := -fno-exceptions -fno-rtti -fno-threadsafe-statics
#CPPFLAGS += -Weffc++
ASMFLAGS := -DASSEMBLY
LDFLAGS :=
CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS += -gc-sections
#xxxxxx.zheng add for COMDEF
include make/vendor_define_gen.mk
#kingberry.end
# top level rule
all:: $(OUTBIN) $(OUTELF).lst $(OUTELF).debug.lst $(OUTELF).sym $(OUTELF).size APPSBOOTHEADER
# the following three object lists are identical except for the ordering
# which is bootobjs, kobjs, objs
BOOTOBJS :=
OBJS :=
# a linker script needs to be declared in one of the project/target/platform files
LINKER_SCRIPT :=
# anything you add here will be deleted in make clean
GENERATED := $(CONFIGHEADER)
对应make下文件:
MY_PROJECT := $(subst full_,,$(TARGET_PRODUCT))
include $(srctree)/../device/eastaeon/$(MY_PROJECT)/vendor/vendor_config.mk
-include $(srctree)/../device/eastaeon/$(MY_PROJECT)/vendor/vendor_config_$(XXXXXX_VENDOR).mk
include $(srctree)/../device/eastaeon/$(MY_PROJECT)/ProjectConfig.mk
include $(srctree)/../build/core/my_add_mtk_macro_def.mk
MTK_CDEFS += $(call mtk.custom.generate-macros)
#$(error ******************* XXXXX.zheng ************************** )
#$(error $(MTK_CDEFS) )
CPPFLAGS +=
CFLAGS += $(MTK_CDEFS)
ASMFLAGS += $(MTK_CDEFS)