-
Notifications
You must be signed in to change notification settings - Fork 3
/
Android.mk
82 lines (64 loc) · 3.17 KB
/
Android.mk
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
#Android makefile to build kernel as a part of Android Build
#ifeq ($(TARGET_PREBUILT_KERNEL),)
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
KERNEL_CONFIG := $(KERNEL_OUT)/.config
TARGET_PREBUILT_KERNEL := $(KERNEL_OUT)/arch/arm/boot/zImage
KERNEL_ARCH_ARM_CONFIGS := kernel/arch/arm/configs
KERNEL_GEN_CONFIG_FILE := huawei_hi3630_$(HW_PRODUCT)_defconfig
KERNEL_GEN_CONFIG_PATH := $(KERNEL_ARCH_ARM_CONFIGS)/$(KERNEL_GEN_CONFIG_FILE)
KERNEL_COMMON_DEFCONFIG := $(KERNEL_ARCH_ARM_CONFIGS)/$(KERNEL_DEFCONFIG)
KERNEL_PRODUCT_CONFIGS := device/hisi/customize/hsad/config/$(HW_PRODUCT)/product_config/kernel_config
KERNEL_DEBUG_CONFIGS := $(KERNEL_ARCH_ARM_CONFIGS)/debug
KERNEL_MODULES_INSTALL := system
KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules
ifeq ($(TARGET_BUILD_TYPE),release)
KERNEL_DEBUG_CONFIGFILE := $(KERNEL_COMMON_DEFCONFIG)
$(KERNEL_DEBUG_CONFIGFILE):FORCE
echo "do nothing"
else
KERNEL_DEBUG_CONFIGFILE := $(KERNEL_ARCH_ARM_CONFIGS)/huawei_hi3630_$(HW_PRODUCT)_debug_defconfig
$(KERNEL_DEBUG_CONFIGFILE):FORCE
@device/hisi/hi3630/kernel-config.sh -f $(KERNEL_COMMON_DEFCONFIG) -d $(KERNEL_DEBUG_CONFIGS) -o $(KERNEL_DEBUG_CONFIGFILE)
endif
ifeq ($(KERNEL_DEBUG_CONFIGFILE),$(KERNEL_COMMON_DEFCONFIG))
KERNEL_TOBECLEAN_CONFIGFILE :=
else
KERNEL_TOBECLEAN_CONFIGFILE := $(KERNEL_DEBUG_CONFIGFILE)
endif
define mv-modules
mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.dep`;\
if [ "$$mdpath" != "" ];then\
mpath=`dirname $$mdpath`;\
ko=`find $$mpath/kernel -type f -name *.ko`;\
for i in $$ko; do mv $$i $(KERNEL_MODULES_OUT)/; done;\
fi
endef
define clean-module-folder
mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.dep`;\
if [ "$$mdpath" != "" ];then\
mpath=`dirname $$mdpath`; rm -rf $$mpath;\
fi
endef
DTS_PARSE_CONFIG:
@-rm -f $(PRODUCT_OUT)/dt.img
@-rm -rf $(KERNEL_OUT)/arch/arm/boot/dts/auto-generate/
@cd device/hisi/customize/hsad/build_scripts; ./auto_dts_gen.sh
$(KERNEL_OUT):
mkdir -p $(KERNEL_OUT)
$(KERNEL_GEN_CONFIG_PATH): $(KERNEL_DEBUG_CONFIGFILE)
@device/hisi/hi3630/kernel-config.sh -f $(KERNEL_DEBUG_CONFIGFILE) -d $(KERNEL_PRODUCT_CONFIGS) -o $(KERNEL_GEN_CONFIG_PATH)
$(KERNEL_CONFIG): $(KERNEL_OUT) $(KERNEL_GEN_CONFIG_PATH)
@if [ "$(HIDE_PRODUCT_INFO)" == "true" ]; then echo CONFIG_HIDE_PRODUCT_INFO=y >> $(KERNEL_GEN_CONFIG_PATH); fi
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-eabi- $(KERNEL_GEN_CONFIG_FILE)
@rm -frv $(KERNEL_GEN_CONFIG_PATH)
@rm -frv $(KERNEL_TOBECLEAN_CONFIGFILE)
$(TARGET_PREBUILT_KERNEL): $(KERNEL_CONFIG) DTS_PARSE_CONFIG
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-eabi-
$(hide) $(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-eabi- -j 18
$(hide) $(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-eabi- -j 18 zImage
$(MAKE) -C kernel O=../$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) INSTALL_MOD_STRIP=1 ARCH=arm CROSS_COMPILE=arm-eabi- modules_install
$(mv-modules)
$(clean-module-folder)
kernelconfig: $(KERNEL_OUT) $(KERNEL_GEN_CONFIG_PATH)
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-eabi- $(KERNEL_GEN_CONFIG_FILE) menuconfig
@rm -frv $(KERNEL_GEN_CONFIG_PATH)