blob: 1c2f92cb9f74ba382abac5cec4caabe92dda4aa3 [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)
72real_cc := REAL_CC=$(KERNEL_LLVM_BIN) CLANG_TRIPLE=aarch64-linux-gnu-
73else
Ameya Thakur300fae92016-08-10 11:33:55 -070074ifeq ($(strip $(KERNEL_GCC_NOANDROID_CHK)),0)
75KERNEL_CFLAGS := KCFLAGS=-mno-android
76endif
Prasad Sodagudic8de0c82017-10-04 14:44:24 -070077endif
Ameya Thakur300fae92016-08-10 11:33:55 -070078
79mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
80current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
81TARGET_KERNEL := msm-$(TARGET_KERNEL_VERSION)
82ifeq ($(TARGET_KERNEL),$(current_dir))
83 # New style, kernel/msm-version
84 BUILD_ROOT_LOC := ../../
85 TARGET_KERNEL_SOURCE := kernel/$(TARGET_KERNEL)
86 KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/kernel/$(TARGET_KERNEL)
87 KERNEL_SYMLINK := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
88 KERNEL_USR := $(KERNEL_SYMLINK)/usr
Neeraj Upadhyay368def72018-06-04 13:56:28 +053089 KERNEL_VM_OUT := $(TARGET_OUT_INTERMEDIATES)/kernel_vm/$(TARGET_KERNEL)
90 KERNEL_VM_SYMLINK := $(TARGET_OUT_INTERMEDIATES)/KERNEL_VM_OBJ
91 KERNEL_VM_USR := $(KERNEL_VM_SYMLINK)/usr
Ameya Thakur300fae92016-08-10 11:33:55 -070092else
93 # Legacy style, kernel source directly under kernel
94 KERNEL_LEGACY_DIR := true
95 BUILD_ROOT_LOC := ../
96 TARGET_KERNEL_SOURCE := kernel
97 KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
Neeraj Upadhyay368def72018-06-04 13:56:28 +053098 KERNEL_VM_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_VM_OBJ
Ameya Thakur300fae92016-08-10 11:33:55 -070099endif
100
101KERNEL_CONFIG := $(KERNEL_OUT)/.config
102
103ifeq ($(KERNEL_DEFCONFIG)$(wildcard $(KERNEL_CONFIG)),)
104$(error Kernel configuration not defined, cannot build kernel)
105else
106
107ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true)
108$(info Using uncompressed kernel)
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530109TARGET_PREBUILT_INT_KERNEL_ := arch/$(KERNEL_ARCH)/boot/Image
Ameya Thakur300fae92016-08-10 11:33:55 -0700110else
111ifeq ($(KERNEL_ARCH),arm64)
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530112TARGET_PREBUILT_INT_KERNEL_ := arch/$(KERNEL_ARCH)/boot/Image.gz
Ameya Thakur300fae92016-08-10 11:33:55 -0700113else
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530114TARGET_PREBUILT_INT_KERNEL_ := arch/$(KERNEL_ARCH)/boot/zImage
Ameya Thakur300fae92016-08-10 11:33:55 -0700115endif
116endif
117
118ifeq ($(TARGET_KERNEL_APPEND_DTB), true)
119$(info Using appended DTB)
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530120TARGET_PREBUILT_INT_KERNEL_ := $(TARGET_PREBUILT_INT_KERNEL_)-dtb
Rahul Shahare95ab7182019-06-26 15:45:29 +0530121else
122$(info Using DTB Image)
123INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
Ameya Thakur300fae92016-08-10 11:33:55 -0700124endif
125
Rahul Shahare95ab7182019-06-26 15:45:29 +0530126# Creating a dtb.img once the kernel is compiled if TARGET_KERNEL_APPEND_DTB is set to be false
127$(INSTALLED_DTBIMAGE_TARGET): $(INSTALLED_KERNEL_TARGET)
128 cat $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/qcom/*.dtb > $@
129
Ameya Thakur300fae92016-08-10 11:33:55 -0700130KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
Puja Gupta45445402017-03-24 12:56:52 -0700131KERNEL_MODULES_INSTALL ?= system
132KERNEL_MODULES_OUT ?= $(PRODUCT_OUT)/$(KERNEL_MODULES_INSTALL)/lib/modules
Ameya Thakur300fae92016-08-10 11:33:55 -0700133
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530134TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/$(TARGET_PREBUILT_INT_KERNEL_)
Ameya Thakur300fae92016-08-10 11:33:55 -0700135TARGET_PREBUILT_KERNEL := $(TARGET_PREBUILT_INT_KERNEL)
136
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530137KERNEL_VM_CONFIG := $(KERNEL_VM_OUT)/.config
138KERNEL_VM_HEADERS_INSTALL := $(KERNEL_VM_OUT)/usr
139TARGET_PREBUILT_INT_KERNEL_VM := $(KERNEL_VM_OUT)/$(TARGET_PREBUILT_INT_KERNEL_)
140TARGET_PREBUILT_KERNEL_VM := $(TARGET_PREBUILT_INT_KERNEL_VM)
141
Ameya Thakur300fae92016-08-10 11:33:55 -0700142define mv-modules
143mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.dep`;\
144if [ "$$mdpath" != "" ];then\
145mpath=`dirname $$mdpath`;\
146ko=`find $$mpath/kernel -type f -name *.ko`;\
147for i in $$ko; do mv $$i $(KERNEL_MODULES_OUT)/; done;\
148fi
149endef
150
151define clean-module-folder
152mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.dep`;\
153if [ "$$mdpath" != "" ];then\
154mpath=`dirname $$mdpath`; rm -rf $$mpath;\
155fi
156endef
157
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530158$(TARGET_PREBUILT_INT_KERNEL_VM): ;
159
Ameya Thakur300fae92016-08-10 11:33:55 -0700160ifneq ($(KERNEL_LEGACY_DIR),true)
161$(KERNEL_USR): $(KERNEL_HEADERS_INSTALL)
162 rm -rf $(KERNEL_SYMLINK)
163 ln -s kernel/$(TARGET_KERNEL) $(KERNEL_SYMLINK)
164
165$(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_USR)
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530166
167ifneq ($(KERNEL_VM_DEFCONFIG),)
168$(KERNEL_VM_USR): $(KERNEL_VM_HEADERS_INSTALL)
169 rm -rf $(KERNEL_VM_SYMLINK);
170 ln -s kernel_vm/$(TARGET_KERNEL) $(KERNEL_VM_SYMLINK);
171
172$(TARGET_PREBUILT_INT_KERNEL_VM): $(KERNEL_VM_USR)
173endif
174endif
175
176ifneq ($(KERNEL_VM_DEFCONFIG),)
177$(KERNEL_VM_OUT):
178 mkdir -p $(KERNEL_VM_OUT);
179
180$(KERNEL_VM_CONFIG): $(KERNEL_VM_OUT)
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700181 $(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 +0530182 if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
183 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
184 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_VM_OUT)/.config; \
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) oldconfig; fi;
Neeraj Upadhyay368def72018-06-04 13:56:28 +0530186
187$(TARGET_PREBUILT_INT_KERNEL_VM): $(KERNEL_VM_OUT) $(KERNEL_VM_HEADERS_INSTALL)
188 echo "Building vm kernel...";
189 rm -rf $(KERNEL_VM_OUT)/arch/$(KERNEL_ARCH)/boot/dts;
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700190 $(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 +0530191
192$(KERNEL_VM_HEADERS_INSTALL): $(KERNEL_VM_OUT)
193 rm -f $(BUILD_ROOT_LOC)$(KERNEL_VM_CONFIG);
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_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_VM_DEFCONFIG);
195 $(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 +0530196 if [ -d "$(KERNEL_VM_HEADERS_INSTALL)/include/bringup_headers" ]; then \
197 cp -Rf $(KERNEL_VM_HEADERS_INSTALL)/include/bringup_headers/* $(KERNEL_VM_HEADERS_INSTALL)/include/ ; fi ;
198 if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
199 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_VM_OUT)/.config; \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700200 $(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 -0700201endif
202
203$(KERNEL_OUT):
204 mkdir -p $(KERNEL_OUT)
205
206$(KERNEL_CONFIG): $(KERNEL_OUT)
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700207 $(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 -0700208 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
209 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
210 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
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) oldconfig; fi
Ameya Thakur300fae92016-08-10 11:33:55 -0700212
Tengfei Fan72dbad22019-07-17 09:17:53 +0800213ifeq ($(TARGET_KERNEL_APPEND_DTB), true)
214TARGET_PREBUILT_INT_KERNEL_IMAGE := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/Image
215$(TARGET_PREBUILT_INT_KERNEL_IMAGE): $(KERNEL_USR)
216$(TARGET_PREBUILT_INT_KERNEL_IMAGE): $(KERNEL_OUT) $(KERNEL_HEADERS_INSTALL)
217 $(hide) echo "Building kernel modules..."
218 $(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
219 $(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
220 $(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
221 $(mv-modules)
222 $(clean-module-folder)
223
224$(TARGET_PREBUILT_INT_KERNEL): $(TARGET_PREBUILT_INT_KERNEL_IMAGE)
Ameya Thakur300fae92016-08-10 11:33:55 -0700225 $(hide) echo "Building kernel..."
226 $(hide) rm -rf $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700227 $(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 +0800228else
229TARGET_PREBUILT_INT_KERNEL_IMAGE := $(TARGET_PREBUILT_INT_KERNEL)
230$(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_OUT) $(KERNEL_HEADERS_INSTALL)
231 $(hide) echo "Building kernel..."
232 $(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 -0700233 $(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
234 $(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 -0700235 $(mv-modules)
236 $(clean-module-folder)
Tengfei Fan72dbad22019-07-17 09:17:53 +0800237endif
Ameya Thakur300fae92016-08-10 11:33:55 -0700238
239$(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT)
240 $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \
241 rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG); \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700242 $(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); \
243 $(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 -0700244 if [ -d "$(KERNEL_HEADERS_INSTALL)/include/bringup_headers" ]; then \
245 cp -Rf $(KERNEL_HEADERS_INSTALL)/include/bringup_headers/* $(KERNEL_HEADERS_INSTALL)/include/ ;\
246 fi ;\
247 fi
248 $(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \
249 echo "Used a different defconfig for header generation"; \
250 rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG); \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700251 $(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 -0700252 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
253 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
254 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.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) oldconfig; fi
Ameya Thakur300fae92016-08-10 11:33:55 -0700256
Neeraj Upadhyayeff89ac2018-10-16 15:44:24 +0530257.PHONY: kerneltags
Ameya Thakur300fae92016-08-10 11:33:55 -0700258kerneltags: $(KERNEL_OUT) $(KERNEL_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) tags
Ameya Thakur300fae92016-08-10 11:33:55 -0700260
Neeraj Upadhyayeff89ac2018-10-16 15:44:24 +0530261.PHONY: kernelconfig
Ameya Thakur300fae92016-08-10 11:33:55 -0700262kernelconfig: $(KERNEL_OUT) $(KERNEL_CONFIG)
263 env KCONFIG_NOTIMESTAMP=true \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700264 $(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 -0700265 env KCONFIG_NOTIMESTAMP=true \
Prasad Sodagudic8de0c82017-10-04 14:44:24 -0700266 $(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 -0700267 cp $(KERNEL_OUT)/defconfig $(TARGET_KERNEL_SOURCE)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_DEFCONFIG)
268
269endif
270endif