forked from BlurOS/android_kernel_pantech_msm8x74
-
Notifications
You must be signed in to change notification settings - Fork 1
/
AndroidKernel.mk
162 lines (143 loc) · 6.22 KB
/
AndroidKernel.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#Android makefile to build kernel as a part of Android Build
PERL = perl
KERNEL_TARGET := $(strip $(INSTALLED_KERNEL_TARGET))
ifeq ($(KERNEL_TARGET),)
INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
endif
ifeq ($(TARGET_PREBUILT_KERNEL),)
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
KERNEL_CONFIG := $(KERNEL_OUT)/.config
ifeq ($(TARGET_KERNEL_APPEND_DTB), true)
TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/arm/boot/zImage-dtb
else
TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/arm/boot/zImage
endif
KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
KERNEL_MODULES_INSTALL := system
KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules
KERNEL_IMG=$(KERNEL_OUT)/arch/arm/boot/Image
DTS_NAMES ?= $(shell $(PERL) -e 'while (<>) {$$a = $$1 if /CONFIG_ARCH_((?:MSM|QSD|MPQ)[a-zA-Z0-9]+)=y/; $$r = $$1 if /CONFIG_MSM_SOC_REV_(?!NONE)(\w+)=y/; $$arch = $$arch.lc("$$a$$r ") if /CONFIG_ARCH_((?:MSM|QSD|MPQ)[a-zA-Z0-9]+)=y/} print $$arch;' $(KERNEL_CONFIG))
KERNEL_USE_OF ?= $(shell $(PERL) -e '$$of = "n"; while (<>) { if (/CONFIG_USE_OF=y/) { $$of = "y"; break; } } print $$of;' kernel/arch/arm/configs/$(KERNEL_DEFCONFIG))
ifeq "$(KERNEL_USE_OF)" "y"
ifeq ($(OEM_PRODUCT_MANUFACTURER),PANTECH)
PANTECH_PRODUCT_MODEL := $(shell echo $(PROJECT_NAME) | tr A-Z a-z)
PANTECH_BOARD_VERSION := $(shell echo $(PANTECH_BOARD_VER) | tr A-Z a-z)
ifeq ($(MSM_VER),V30)
ifeq ($(PANTECH_BOARD_VERSION),)
DTS_FILES = $(wildcard $(TOP)/kernel/arch/arm/boot/dts/msm8974pro-ab-pm8941-$(PANTECH_PRODUCT_MODEL).dts)
else
DTS_FILES = $(wildcard $(TOP)/kernel/arch/arm/boot/dts/msm8974pro-ab-pm8941-$(PANTECH_PRODUCT_MODEL)-$(PANTECH_BOARD_VERSION).dts)
endif
else
ifeq ($(PANTECH_BOARD_VERSION),)
DTS_FILES = $(wildcard $(TOP)/kernel/arch/arm/boot/dts/msm8974-v2.2-$(PANTECH_PRODUCT_MODEL).dts)
else
DTS_FILES = $(wildcard $(TOP)/kernel/arch/arm/boot/dts/msm8974-v2.2-$(PANTECH_PRODUCT_MODEL)-$(PANTECH_BOARD_VERSION).dts)
endif
endif
else
DTS_FILES = $(wildcard $(TOP)/kernel/arch/arm/boot/dts/$(DTS_NAME)*.dts)
endif
DTS_FILE = $(lastword $(subst /, ,$(1)))
DTB_FILE = $(addprefix $(KERNEL_OUT)/arch/arm/boot/,$(patsubst %.dts,%.dtb,$(call DTS_FILE,$(1))))
ZIMG_FILE = $(addprefix $(KERNEL_OUT)/arch/arm/boot/,$(patsubst %.dts,%-zImage,$(call DTS_FILE,$(1))))
KERNEL_ZIMG = $(KERNEL_OUT)/arch/arm/boot/zImage
DTC = $(KERNEL_OUT)/scripts/dtc/dtc
define append-dtb
mkdir -p $(KERNEL_OUT)/arch/arm/boot;\
$(foreach DTS_NAME, $(DTS_NAMES), \
$(foreach d, $(DTS_FILES), \
$(DTC) -p 1024 -O dtb -o $(call DTB_FILE,$(d)) $(d); \
cat $(KERNEL_ZIMG) $(call DTB_FILE,$(d)) > $(call ZIMG_FILE,$(d));))
endef
else
define append-dtb
endef
endif
ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true)
$(info Using uncompressed kernel)
TARGET_PREBUILT_KERNEL := $(KERNEL_OUT)/piggy
else
TARGET_PREBUILT_KERNEL := $(TARGET_PREBUILT_INT_KERNEL)
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
# 20131223 LS1-p13795 modified for exFAT file system
ifeq ($(PANTECH_SDXC_EXFAT_FS),true)
ifeq ($(PANTECH_SDXC_EXFAT_BUILD),true)
define exfat-module
if test -e kheaders*.tar.bz2;then\
rm -rf kheaders*.tar.bz2;\
fi
if test -e tuxera-exfat-3012.4.9.2-apq8064.tgz;then\
rm -rf tuxera-exfat-3012.4.9.2-apq8064.tgz;\
rm -rf tuxera-exfat-3012.4.9.2-apq8064;\
fi
if test -e tuxera-exfat-*-msm8974*.tgz;then\
rm -rf tuxera_exfat_hash;\
rm -rf tuxera-exfat-*-msm8974*.tgz;\
rm -rf tuxera-exfat-*-msm8974*;\
fi
./tuxera_update.sh --source-dir $(TOP)/kernel --output-dir $(KERNEL_OUT) -a --target target/pantech.d/msm8974 --user pantech --pass feke57aze93ni --use-cache --cache-dir $(TOP)/tuxera_exfat_hash
tar -xvzf tuxera-exfat-*-msm8974*.tgz
cp tuxera-exfat-*-msm8974*/exfat/kernel-module/texfat.ko $(KERNEL_MODULES_OUT)
mpath=`find $(TARGET_OUT) -type d -name bin`;\
if [ "$$mdpath" == "" ];then\
mkdir -p $(TARGET_OUT)/bin;\
fi
cp tuxera-exfat-*-msm8974*/exfat/tools/* $(TARGET_OUT)/bin
endef
else
define exfat-module
cp tuxera-exfat-*-msm8974*/exfat/kernel-module/texfat.ko $(KERNEL_MODULES_OUT)
cp tuxera-exfat-*-msm8974*/exfat/tools/* $(TARGET_OUT)/bin
endef
endif
else
define exfat-module
endef
endif
$(KERNEL_OUT):
mkdir -p $(KERNEL_OUT)
ifeq ($(PANTECH_PERF_BUILD),true)
$(KERNEL_CONFIG): $(KERNEL_OUT)
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-linux-androideabi- $(KERNEL_DEFCONFIG) PERF_DEFCONFIG=msm8974_pantech_perf_defconfig
else
$(KERNEL_CONFIG): $(KERNEL_OUT)
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-linux-androideabi- $(KERNEL_DEFCONFIG)
endif
$(KERNEL_OUT)/piggy : $(TARGET_PREBUILT_INT_KERNEL)
$(hide) gunzip -c $(KERNEL_OUT)/arch/arm/boot/compressed/piggy.gzip > $(KERNEL_OUT)/piggy
$(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL)
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-linux-androideabi-
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-linux-androideabi- modules
$(MAKE) -C kernel O=../$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) INSTALL_MOD_STRIP=1 ARCH=arm CROSS_COMPILE=arm-linux-androideabi- modules_install
$(mv-modules)
$(clean-module-folder)
$(append-dtb)
$(exfat-module)
$(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT) $(KERNEL_CONFIG)
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-linux-androideabi- headers_install
kerneltags: $(KERNEL_OUT) $(KERNEL_CONFIG)
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-linux-androideabi- tags
kernelconfig: $(KERNEL_OUT) $(KERNEL_CONFIG)
env KCONFIG_NOTIMESTAMP=true \
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-linux-androideabi- xconfig
# env KCONFIG_NOTIMESTAMP=true \ #20130225 jylee modify menuconfig -> xconfig
# $(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-linux-androideabi- menuconfig
env KCONFIG_NOTIMESTAMP=true \
$(MAKE) -C kernel O=../$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=arm-linux-androideabi- savedefconfig
cp $(KERNEL_OUT)/defconfig kernel/arch/arm/configs/$(KERNEL_DEFCONFIG)
endif