blob: d48eecd6cb04ba377ac26e0f84101de2f662d73e [file] [log] [blame]
Ameya Thakur300fae92016-08-10 11:33:55 -07001#Android makefile to build kernel as a part of Android Build
2PERL = perl
3
4KERNEL_TARGET := $(strip $(INSTALLED_KERNEL_TARGET))
5ifeq ($(KERNEL_TARGET),)
6INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
7endif
8
Neeraj Upadhyay368def72018-06-04 13:56:28 +05309INSTALLED_KERNEL_VM_TARGET := $(PRODUCT_OUT)/kernel_vm
10
Puja Guptae5df4f32017-02-24 14:21:40 -080011TARGET_KERNEL_MAKE_ENV := $(strip $(TARGET_KERNEL_MAKE_ENV))
12ifeq ($(TARGET_KERNEL_MAKE_ENV),)
13KERNEL_MAKE_ENV :=
14else
15KERNEL_MAKE_ENV := $(TARGET_KERNEL_MAKE_ENV)
16endif
17
Ameya Thakur300fae92016-08-10 11:33:55 -070018TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH))
19ifeq ($(TARGET_KERNEL_ARCH),)
20KERNEL_ARCH := arm
21else
22KERNEL_ARCH := $(TARGET_KERNEL_ARCH)
23endif
24
25TARGET_KERNEL_HEADER_ARCH := $(strip $(TARGET_KERNEL_HEADER_ARCH))
26ifeq ($(TARGET_KERNEL_HEADER_ARCH),)
27KERNEL_HEADER_ARCH := $(KERNEL_ARCH)
28else
29$(warning Forcing kernel header generation only for '$(TARGET_KERNEL_HEADER_ARCH)')
30KERNEL_HEADER_ARCH := $(TARGET_KERNEL_HEADER_ARCH)
31endif
32
33KERNEL_HEADER_DEFCONFIG := $(strip $(KERNEL_HEADER_DEFCONFIG))
34ifeq ($(KERNEL_HEADER_DEFCONFIG),)
35KERNEL_HEADER_DEFCONFIG := $(KERNEL_DEFCONFIG)
36endif
37
38# Force 32-bit binder IPC for 64bit kernel with 32bit userspace
39ifeq ($(KERNEL_ARCH),arm64)
40ifeq ($(TARGET_ARCH),arm)
41KERNEL_CONFIG_OVERRIDE := CONFIG_ANDROID_BINDER_IPC_32BIT=y
42endif
43endif
44
45TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX))
46ifeq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),)
47KERNEL_CROSS_COMPILE := arm-eabi-
48else
Mukesh Ojha72378c442018-11-23 16:32:02 +053049KERNEL_CROSS_COMPILE := $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)
Ameya Thakur300fae92016-08-10 11:33:55 -070050endif
51
Raghavendra Rao Anantacea6fa82018-04-16 19:14:44 -070052ifeq ($(KERNEL_LLVM_SUPPORT), true)
53 ifeq ($(KERNEL_SD_LLVM_SUPPORT), true) #Using sd-llvm compiler
Raghavendra Rao Ananta4b0f86a2018-04-17 16:50:06 -070054 ifeq ($(shell echo $(SDCLANG_PATH) | head -c 1),/)
55 KERNEL_LLVM_BIN := $(SDCLANG_PATH)/clang
Raghavendra Rao Anantacea6fa82018-04-16 19:14:44 -070056 else
Divya Sharma9ad4116a2018-09-25 14:43:30 -070057 KERNEL_LLVM_BIN := $(shell pwd)/$(SDCLANG_PATH)/clang
Raghavendra Rao Anantacea6fa82018-04-16 19:14:44 -070058 endif
59 $(warning "Using sdllvm" $(KERNEL_LLVM_BIN))
60 else
Divya Sharma9ad4116a2018-09-25 14:43:30 -070061 KERNEL_LLVM_BIN := $(shell pwd)/$(CLANG) #Using aosp-llvm compiler
Raghavendra Rao Anantacea6fa82018-04-16 19:14:44 -070062 $(warning "Using aosp-llvm" $(KERNEL_LLVM_BIN))
63 endif
64endif
65
Ameya Thakur300fae92016-08-10 11:33:55 -070066ifeq ($(TARGET_PREBUILT_KERNEL),)
67
68KERNEL_GCC_NOANDROID_CHK := $(shell (echo "int main() {return 0;}" | $(KERNEL_CROSS_COMPILE)gcc -E -mno-android - > /dev/null 2>&1 ; echo $$?))
Prasad Sodagudic8de0c82017-10-04 14:44:24 -070069
70real_cc :=
71ifeq ($(KERNEL_LLVM_SUPPORT),true)
lijuang148fe3c2019-10-30 11:09:32 +080072 ifeq ($(KERNEL_ARCH), arm64)
73 real_cc := REAL_CC=$(KERNEL_LLVM_BIN) CLANG_TRIPLE=aarch64-linux-gnu-
74 else
75 real_cc := REAL_CC=$(KERNEL_LLVM_BIN) CLANG_TRIPLE=arm-linux-gnueabihf
76 endif
Prasad Sodagudic8de0c82017-10-04 14:44:24 -070077else
Ameya Thakur300fae92016-08-10 11:33:55 -070078ifeq ($(strip $(KERNEL_GCC_NOANDROID_CHK)),0)
79KERNEL_CFLAGS := KCFLAGS=-mno-android
80endif
Prasad Sodagudic8de0c82017-10-04 14:44:24 -070081endif
Ameya Thakur300fae92016-08-10 11:33:55 -070082
83mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
84current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
85TARGET_KERNEL := msm-$(TARGET_KERNEL_VERSION)
86ifeq ($(TARGET_KERNEL),$(current_dir))
87 # New style, kernel/msm-version
88 BUILD_ROOT_LOC := ../../
89 TARGET_KERNEL_SOURCE := kernel/$(TARGET_KERNEL)
90 KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/kernel/$(TARGET_KERNEL)
91 KERNEL_SYMLINK := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
92 KERNEL_USR := $(KERNEL_SYMLINK)/usr
Neeraj Upadhyay368def72018-06-04 13:56:28 +053093 KERNEL_VM_OUT := $(TARGET_OUT_INTERMEDIATES)/kernel_vm/$(TARGET_KERNEL)
94 KERNEL_VM_SYMLINK := $(TARGET_OUT_INTERMEDIATES)/KERNEL_VM_OBJ
95 KERNEL_VM_USR := $(KERNEL_VM_SYMLINK)/usr
Ameya Thakur300fae92016-08-10 11:33:55 -070096else
97 # Legacy style, kernel source directly under kernel
98 KERNEL_LEGACY_DIR := true
99 BUILD_ROOT_LOC := ../
100 TARGET_KERNEL_SOURCE := kernel
101 KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530102 KERNEL_VM_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_VM_OBJ
Ameya Thakur300fae92016-08-10 11:33:55 -0700103endif
104
105KERNEL_CONFIG := $(KERNEL_OUT)/.config
106
107ifeq ($(KERNEL_DEFCONFIG)$(wildcard $(KERNEL_CONFIG)),)
108$(error Kernel configuration not defined, cannot build kernel)
109else
110
111ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true)
112$(info Using uncompressed kernel)
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530113TARGET_PREBUILT_INT_KERNEL_ := arch/$(KERNEL_ARCH)/boot/Image
Ameya Thakur300fae92016-08-10 11:33:55 -0700114else
115ifeq ($(KERNEL_ARCH),arm64)
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530116TARGET_PREBUILT_INT_KERNEL_ := arch/$(KERNEL_ARCH)/boot/Image.gz
Ameya Thakur300fae92016-08-10 11:33:55 -0700117else
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530118TARGET_PREBUILT_INT_KERNEL_ := arch/$(KERNEL_ARCH)/boot/zImage
Ameya Thakur300fae92016-08-10 11:33:55 -0700119endif
120endif
121
122ifeq ($(TARGET_KERNEL_APPEND_DTB), true)
123$(info Using appended DTB)
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530124TARGET_PREBUILT_INT_KERNEL_ := $(TARGET_PREBUILT_INT_KERNEL_)-dtb
Rahul Shahare95ab7182019-06-26 15:45:29 +0530125else
126$(info Using DTB Image)
127INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
Ameya Thakur300fae92016-08-10 11:33:55 -0700128endif
129
Rahul Shahare95ab7182019-06-26 15:45:29 +0530130# Creating a dtb.img once the kernel is compiled if TARGET_KERNEL_APPEND_DTB is set to be false
131$(INSTALLED_DTBIMAGE_TARGET): $(INSTALLED_KERNEL_TARGET)
132 cat $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/qcom/*.dtb > $@
133
Ameya Thakur300fae92016-08-10 11:33:55 -0700134KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
Puja Gupta45445402017-03-24 12:56:52 -0700135KERNEL_MODULES_INSTALL ?= system
136KERNEL_MODULES_OUT ?= $(PRODUCT_OUT)/$(KERNEL_MODULES_INSTALL)/lib/modules
Ameya Thakur300fae92016-08-10 11:33:55 -0700137
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530138TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/$(TARGET_PREBUILT_INT_KERNEL_)
Ameya Thakur300fae92016-08-10 11:33:55 -0700139TARGET_PREBUILT_KERNEL := $(TARGET_PREBUILT_INT_KERNEL)
140
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530141KERNEL_VM_CONFIG := $(KERNEL_VM_OUT)/.config
142KERNEL_VM_HEADERS_INSTALL := $(KERNEL_VM_OUT)/usr
143TARGET_PREBUILT_INT_KERNEL_VM := $(KERNEL_VM_OUT)/$(TARGET_PREBUILT_INT_KERNEL_)
144TARGET_PREBUILT_KERNEL_VM := $(TARGET_PREBUILT_INT_KERNEL_VM)
145
Ameya Thakur300fae92016-08-10 11:33:55 -0700146define mv-modules
147mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.dep`;\
148if [ "$$mdpath" != "" ];then\
149mpath=`dirname $$mdpath`;\
150ko=`find $$mpath/kernel -type f -name *.ko`;\
151for i in $$ko; do mv $$i $(KERNEL_MODULES_OUT)/; done;\
152fi
153endef
154
155define clean-module-folder
156mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.dep`;\
157if [ "$$mdpath" != "" ];then\
158mpath=`dirname $$mdpath`; rm -rf $$mpath;\
159fi
160endef
161
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530162$(TARGET_PREBUILT_INT_KERNEL_VM): ;
163
Ameya Thakur300fae92016-08-10 11:33:55 -0700164ifneq ($(KERNEL_LEGACY_DIR),true)
165$(KERNEL_USR): $(KERNEL_HEADERS_INSTALL)
166 rm -rf $(KERNEL_SYMLINK)
167 ln -s kernel/$(TARGET_KERNEL) $(KERNEL_SYMLINK)
168
169$(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_USR)
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530170
171ifneq ($(KERNEL_VM_DEFCONFIG),)
172$(KERNEL_VM_USR): $(KERNEL_VM_HEADERS_INSTALL)
173 rm -rf $(KERNEL_VM_SYMLINK);
174 ln -s kernel_vm/$(TARGET_KERNEL) $(KERNEL_VM_SYMLINK);
175
176$(TARGET_PREBUILT_INT_KERNEL_VM): $(KERNEL_VM_USR)
177endif
178endif
179
180ifneq ($(KERNEL_VM_DEFCONFIG),)
181$(KERNEL_VM_OUT):
182 mkdir -p $(KERNEL_VM_OUT);
183
184$(KERNEL_VM_CONFIG): $(KERNEL_VM_OUT)
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700185 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_VM_DEFCONFIG);
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530186 if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
187 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
188 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_VM_OUT)/.config; \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700189 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi;
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530190
191$(TARGET_PREBUILT_INT_KERNEL_VM): $(KERNEL_VM_OUT) $(KERNEL_VM_HEADERS_INSTALL)
192 echo "Building vm kernel...";
193 rm -rf $(KERNEL_VM_OUT)/arch/$(KERNEL_ARCH)/boot/dts;
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700194 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS);
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530195
196$(KERNEL_VM_HEADERS_INSTALL): $(KERNEL_VM_OUT)
197 rm -f $(BUILD_ROOT_LOC)$(KERNEL_VM_CONFIG);
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700198 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_VM_DEFCONFIG);
199 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) headers_install;
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530200 if [ -d "$(KERNEL_VM_HEADERS_INSTALL)/include/bringup_headers" ]; then \
201 cp -Rf $(KERNEL_VM_HEADERS_INSTALL)/include/bringup_headers/* $(KERNEL_VM_HEADERS_INSTALL)/include/ ; fi ;
202 if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
203 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_VM_OUT)/.config; \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700204 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi;
Ameya Thakur300fae92016-08-10 11:33:55 -0700205endif
206
207$(KERNEL_OUT):
208 mkdir -p $(KERNEL_OUT)
209
210$(KERNEL_CONFIG): $(KERNEL_OUT)
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700211 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_DEFCONFIG)
Ameya Thakur300fae92016-08-10 11:33:55 -0700212 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
213 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
214 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700215 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi
Ameya Thakur300fae92016-08-10 11:33:55 -0700216
Tengfei Fan72dbad22019-07-17 09:17:53 +0800217ifeq ($(TARGET_KERNEL_APPEND_DTB), true)
218TARGET_PREBUILT_INT_KERNEL_IMAGE := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/Image
219$(TARGET_PREBUILT_INT_KERNEL_IMAGE): $(KERNEL_USR)
220$(TARGET_PREBUILT_INT_KERNEL_IMAGE): $(KERNEL_OUT) $(KERNEL_HEADERS_INSTALL)
221 $(hide) echo "Building kernel modules..."
222 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS) Image
223 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS) modules
224 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) INSTALL_MOD_PATH=$(BUILD_ROOT_LOC)../$(KERNEL_MODULES_INSTALL) INSTALL_MOD_STRIP=1 $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) modules_install
225 $(mv-modules)
226 $(clean-module-folder)
227
228$(TARGET_PREBUILT_INT_KERNEL): $(TARGET_PREBUILT_INT_KERNEL_IMAGE)
Ameya Thakur300fae92016-08-10 11:33:55 -0700229 $(hide) echo "Building kernel..."
230 $(hide) rm -rf $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700231 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS)
Tengfei Fan72dbad22019-07-17 09:17:53 +0800232else
233TARGET_PREBUILT_INT_KERNEL_IMAGE := $(TARGET_PREBUILT_INT_KERNEL)
234$(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_OUT) $(KERNEL_HEADERS_INSTALL)
235 $(hide) echo "Building kernel..."
236 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS)
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700237 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS) modules
238 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) INSTALL_MOD_PATH=$(BUILD_ROOT_LOC)../$(KERNEL_MODULES_INSTALL) INSTALL_MOD_STRIP=1 $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) modules_install
Ameya Thakur300fae92016-08-10 11:33:55 -0700239 $(mv-modules)
240 $(clean-module-folder)
Tengfei Fan72dbad22019-07-17 09:17:53 +0800241endif
Ameya Thakur300fae92016-08-10 11:33:55 -0700242
243$(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT)
244 $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \
245 rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG); \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700246 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_HEADER_DEFCONFIG); \
247 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) headers_install;\
Ameya Thakur300fae92016-08-10 11:33:55 -0700248 if [ -d "$(KERNEL_HEADERS_INSTALL)/include/bringup_headers" ]; then \
249 cp -Rf $(KERNEL_HEADERS_INSTALL)/include/bringup_headers/* $(KERNEL_HEADERS_INSTALL)/include/ ;\
250 fi ;\
251 fi
252 $(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \
253 echo "Used a different defconfig for header generation"; \
254 rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG); \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700255 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_DEFCONFIG); fi
Ameya Thakur300fae92016-08-10 11:33:55 -0700256 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
257 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
258 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700259 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi
Ameya Thakur300fae92016-08-10 11:33:55 -0700260
Neeraj Upadhyayeff89ac2018-10-16 15:44:24 +0530261.PHONY: kerneltags
Ameya Thakur300fae92016-08-10 11:33:55 -0700262kerneltags: $(KERNEL_OUT) $(KERNEL_CONFIG)
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700263 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) tags
Ameya Thakur300fae92016-08-10 11:33:55 -0700264
Neeraj Upadhyayeff89ac2018-10-16 15:44:24 +0530265.PHONY: kernelconfig
Ameya Thakur300fae92016-08-10 11:33:55 -0700266kernelconfig: $(KERNEL_OUT) $(KERNEL_CONFIG)
267 env KCONFIG_NOTIMESTAMP=true \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700268 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) menuconfig
Ameya Thakur300fae92016-08-10 11:33:55 -0700269 env KCONFIG_NOTIMESTAMP=true \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700270 $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) savedefconfig
Ameya Thakur300fae92016-08-10 11:33:55 -0700271 cp $(KERNEL_OUT)/defconfig $(TARGET_KERNEL_SOURCE)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_DEFCONFIG)
272
273endif
274endif