blob: dc7735e3db11ddc6c63c94dc9687d6dbea64441f [file] [log] [blame]
Michael Bestas3952f6c2016-08-26 01:12:08 +03001# Copyright (C) 2012 The CyanogenMod Project
Dan Pasanen03447712016-12-19 11:22:55 -06002# (C) 2017 The LineageOS Project
Michael Bestas3952f6c2016-08-26 01:12:08 +03003#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
17# Android makefile to build kernel as a part of Android Build
18#
19# Configuration
20# =============
21#
22# These config vars are usually set in BoardConfig.mk:
23#
24# TARGET_KERNEL_SOURCE = Kernel source dir, optional, defaults
25# to kernel/$(TARGET_DEVICE_DIR)
26# TARGET_KERNEL_CONFIG = Kernel defconfig
27# TARGET_KERNEL_VARIANT_CONFIG = Variant defconfig, optional
28# TARGET_KERNEL_SELINUX_CONFIG = SELinux defconfig, optional
29# TARGET_KERNEL_ADDITIONAL_CONFIG = Additional defconfig, optional
30# TARGET_KERNEL_ARCH = Kernel Arch
31# TARGET_KERNEL_HEADER_ARCH = Optional Arch for kernel headers if
32# different from TARGET_KERNEL_ARCH
33# TARGET_USES_UNCOMPRESSED_KERNEL = 'true' if Kernel is uncompressed,
34# optional, defaults to false
35# TARGET_KERNEL_CROSS_COMPILE_PREFIX = Compiler prefix (e.g. arm-eabi-)
Michael Bestas1d55ece2016-09-28 20:16:25 +030036# defaults to arm-linux-androidkernel- for arm
37# aarch64-linux-androidkernel- for arm64
38# x86_64-linux-androidkernel- for x86
Michael Bestas3952f6c2016-08-26 01:12:08 +030039#
40# BOARD_KERNEL_IMAGE_NAME = Built image name, optional,
41# defaults to Image.gz on arm64
42# defaults to Image if TARGET_USES_UNCOMPRESSED_KERNEL
43# defaults to zImage otherwise
44#
45# KERNEL_TOOLCHAIN_PREFIX = Overrides TARGET_KERNEL_CROSS_COMPILE_PREFIX,
46# Set this var in shell to override
47# toolchain specified in BoardConfig.mk
48# KERNEL_TOOLCHAIN = Path to toolchain, if unset, assumes
49# TARGET_KERNEL_CROSS_COMPILE_PREFIX
50# is in PATH
51# USE_CCACHE = Enable ccache (global Android flag)
52#
53# NEED_KERNEL_MODULE_ROOT = Optional, if true, install kernel
54# modules in root instead of system
55
56
57TARGET_AUTO_KDIR := $(shell echo $(TARGET_DEVICE_DIR) | sed -e 's/^device/kernel/g')
58
59## Externally influenced variables
60# kernel location - optional, defaults to kernel/<vendor>/<device>
61TARGET_KERNEL_SOURCE ?= $(TARGET_AUTO_KDIR)
62KERNEL_SRC := $(TARGET_KERNEL_SOURCE)
63# kernel configuration - mandatory
64KERNEL_DEFCONFIG := $(TARGET_KERNEL_CONFIG)
65VARIANT_DEFCONFIG := $(TARGET_KERNEL_VARIANT_CONFIG)
66SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG)
67
68## Internal variables
69KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
70KERNEL_CONFIG := $(KERNEL_OUT)/.config
71KERNEL_OUT_STAMP := $(KERNEL_OUT)/.mkdir_stamp
72
73TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH))
74ifeq ($(TARGET_KERNEL_ARCH),)
75KERNEL_ARCH := $(TARGET_ARCH)
76else
77KERNEL_ARCH := $(TARGET_KERNEL_ARCH)
78endif
79
80ifeq ($(KERNEL_ARCH),x86_64)
81KERNEL_DEFCONFIG_ARCH := x86
82else
83KERNEL_DEFCONFIG_ARCH := $(KERNEL_ARCH)
84endif
85KERNEL_DEFCONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_DEFCONFIG_ARCH)/configs/$(KERNEL_DEFCONFIG)
86
87TARGET_KERNEL_HEADER_ARCH := $(strip $(TARGET_KERNEL_HEADER_ARCH))
88ifeq ($(TARGET_KERNEL_HEADER_ARCH),)
89KERNEL_HEADER_ARCH := $(KERNEL_ARCH)
90else
91KERNEL_HEADER_ARCH := $(TARGET_KERNEL_HEADER_ARCH)
92endif
93
94KERNEL_HEADER_DEFCONFIG := $(strip $(KERNEL_HEADER_DEFCONFIG))
95ifeq ($(KERNEL_HEADER_DEFCONFIG),)
96KERNEL_HEADER_DEFCONFIG := $(KERNEL_DEFCONFIG)
97endif
98
99
100ifneq ($(BOARD_KERNEL_IMAGE_NAME),)
101 TARGET_PREBUILT_INT_KERNEL_TYPE := $(BOARD_KERNEL_IMAGE_NAME)
102else
103 ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true)
104 TARGET_PREBUILT_INT_KERNEL_TYPE := Image
105 else
106 ifeq ($(KERNEL_ARCH),arm64)
107 TARGET_PREBUILT_INT_KERNEL_TYPE := Image.gz
108 else
109 TARGET_PREBUILT_INT_KERNEL_TYPE := zImage
110 endif
111 endif
Rashed Abdel-Tawabb48c27f2017-01-10 02:43:10 -0500112 ifeq ($(TARGET_KERNEL_APPEND_DTB),true)
113 TARGET_PREBUILT_INT_KERNEL_TYPE := $(TARGET_PREBUILT_INT_KERNEL_TYPE)-dtb
114 endif
Michael Bestas3952f6c2016-08-26 01:12:08 +0300115endif
116
117TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(TARGET_PREBUILT_INT_KERNEL_TYPE)
118
119# Clear this first to prevent accidental poisoning from env
120MAKE_FLAGS :=
121
Ziyan54648c22017-01-12 18:47:54 +0100122ifeq ($(KERNEL_ARCH),arm)
123 # Avoid "Unknown symbol _GLOBAL_OFFSET_TABLE_" errors
124 MAKE_FLAGS += CFLAGS_MODULE="-fno-pic"
125endif
126
Michael Bestas3952f6c2016-08-26 01:12:08 +0300127ifeq ($(KERNEL_ARCH),arm64)
128 # Avoid "unsupported RELA relocation: 311" errors (R_AARCH64_ADR_GOT_PAGE)
129 MAKE_FLAGS += CFLAGS_MODULE="-fno-pic"
130 ifeq ($(TARGET_ARCH),arm)
131 KERNEL_CONFIG_OVERRIDE := CONFIG_ANDROID_BINDER_IPC_32BIT=y
132 endif
133endif
134
135ifneq ($(TARGET_KERNEL_ADDITIONAL_CONFIG),)
136KERNEL_ADDITIONAL_CONFIG := $(TARGET_KERNEL_ADDITIONAL_CONFIG)
137KERNEL_ADDITIONAL_CONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG)
138 ifeq ("$(wildcard $(KERNEL_ADDITIONAL_CONFIG_SRC))","")
139 $(warning TARGET_KERNEL_ADDITIONAL_CONFIG '$(TARGET_KERNEL_ADDITIONAL_CONFIG)' doesn't exist)
140 KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
141 endif
142else
143 KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
144endif
145
Michael Bestas3952f6c2016-08-26 01:12:08 +0300146ifeq "$(wildcard $(KERNEL_SRC) )" ""
147 ifneq ($(TARGET_PREBUILT_KERNEL),)
148 HAS_PREBUILT_KERNEL := true
149 NEEDS_KERNEL_COPY := true
150 else
151 $(foreach cf,$(PRODUCT_COPY_FILES), \
152 $(eval _src := $(call word-colon,1,$(cf))) \
153 $(eval _dest := $(call word-colon,2,$(cf))) \
154 $(ifeq kernel,$(_dest), \
155 $(eval HAS_PREBUILT_KERNEL := true)))
156 endif
157
158 ifneq ($(HAS_PREBUILT_KERNEL),)
159 $(warning ***************************************************************)
160 $(warning * Using prebuilt kernel binary instead of source *)
161 $(warning * THIS IS DEPRECATED, AND WILL BE DISCONTINUED *)
162 $(warning * Please configure your device to download the kernel *)
163 $(warning * source repository to $(KERNEL_SRC))
Michael Bestas3952f6c2016-08-26 01:12:08 +0300164 $(warning * for more information *)
165 $(warning ***************************************************************)
166 FULL_KERNEL_BUILD := false
167 KERNEL_BIN := $(TARGET_PREBUILT_KERNEL)
168 else
169 $(warning ***************************************************************)
170 $(warning * *)
171 $(warning * No kernel source found, and no fallback prebuilt defined. *)
172 $(warning * Please make sure your device is properly configured to *)
173 $(warning * download the kernel repository to $(KERNEL_SRC))
174 $(warning * and add the TARGET_KERNEL_CONFIG variable to BoardConfig.mk *)
175 $(warning * *)
176 $(warning * As an alternative, define the TARGET_PREBUILT_KERNEL *)
177 $(warning * variable with the path to the prebuilt binary kernel image *)
178 $(warning * in your BoardConfig.mk file *)
179 $(warning * *)
180 $(warning ***************************************************************)
181 $(error "NO KERNEL")
182 endif
183else
184 NEEDS_KERNEL_COPY := true
185 ifeq ($(TARGET_KERNEL_CONFIG),)
186 $(warning **********************************************************)
187 $(warning * Kernel source found, but no configuration was defined *)
188 $(warning * Please add the TARGET_KERNEL_CONFIG variable to your *)
189 $(warning * BoardConfig.mk file *)
190 $(warning **********************************************************)
191 # $(error "NO KERNEL CONFIG")
192 else
193 #$(info Kernel source found, building it)
194 FULL_KERNEL_BUILD := true
195 KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL)
196 endif
197endif
198
199ifeq ($(FULL_KERNEL_BUILD),true)
200
201KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
202KERNEL_HEADERS_INSTALL_STAMP := $(KERNEL_OUT)/.headers_install_stamp
203
204ifeq ($(NEED_KERNEL_MODULE_ROOT),true)
205KERNEL_MODULES_INSTALL := root
206KERNEL_MODULES_OUT := $(TARGET_ROOT_OUT)/lib/modules
207else
208KERNEL_MODULES_INSTALL := system
209KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules
210endif
211
212TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX))
213ifneq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),)
214KERNEL_TOOLCHAIN_PREFIX ?= $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)
Zhao Wei Liew9689bb92016-11-10 20:02:58 +0800215else ifeq ($(KERNEL_ARCH),arm64)
Michael Bestas1d55ece2016-09-28 20:16:25 +0300216KERNEL_TOOLCHAIN_PREFIX ?= aarch64-linux-androidkernel-
Zhao Wei Liew9689bb92016-11-10 20:02:58 +0800217else ifeq ($(KERNEL_ARCH),arm)
Michael Bestas1d55ece2016-09-28 20:16:25 +0300218KERNEL_TOOLCHAIN_PREFIX ?= arm-linux-androidkernel-
Zhao Wei Liew9689bb92016-11-10 20:02:58 +0800219else ifeq ($(KERNEL_ARCH),x86)
Michael Bestas1d55ece2016-09-28 20:16:25 +0300220KERNEL_TOOLCHAIN_PREFIX ?= x86_64-linux-androidkernel-
Michael Bestas3952f6c2016-08-26 01:12:08 +0300221endif
222
223ifeq ($(KERNEL_TOOLCHAIN),)
224KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN_PREFIX)
225else
226ifneq ($(KERNEL_TOOLCHAIN_PREFIX),)
227KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX)
228endif
229endif
230
231ifneq ($(USE_CCACHE),)
Steve Kondik6a378282016-09-25 22:37:01 -0700232 # Detect if the system already has ccache installed to use instead of the prebuilt
233 ccache := $(shell which ccache)
234
235 ifeq ($(ccache),)
236 ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache
237 # Check that the executable is here.
238 ccache := $(strip $(wildcard $(ccache)))
239 endif
Michael Bestas3952f6c2016-08-26 01:12:08 +0300240endif
241
242KERNEL_CROSS_COMPILE := CROSS_COMPILE="$(ccache) $(KERNEL_TOOLCHAIN_PATH)"
243ccache =
244
245define mv-modules
246 mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.order`;\
247 if [ "$$mdpath" != "" ];then\
248 mpath=`dirname $$mdpath`;\
249 ko=`find $$mpath/kernel -type f -name *.ko`;\
250 for i in $$ko; do $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $$i;\
251 mv $$i $(KERNEL_MODULES_OUT)/; done;\
252 fi
253endef
254
255define clean-module-folder
256 mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.order`;\
257 if [ "$$mdpath" != "" ];then\
258 mpath=`dirname $$mdpath`; rm -rf $$mpath;\
259 fi
260endef
261
262ifeq ($(HOST_OS),darwin)
Christopher N. Hesse1e7c3f02017-04-12 00:57:44 +0200263 MAKE_FLAGS += C_INCLUDE_PATH=$(ANDROID_BUILD_TOP)/external/elfutils/libelf:/usr/local/opt/openssl/include
Rashed Abdel-Tawab7fb92512017-03-16 14:37:07 -0400264 MAKE_FLAGS += LIBRARY_PATH=/usr/local/opt/openssl/lib
Michael Bestas3952f6c2016-08-26 01:12:08 +0300265endif
266
267ifeq ($(TARGET_KERNEL_MODULES),)
268 TARGET_KERNEL_MODULES := no-external-modules
269endif
270
271$(KERNEL_OUT_STAMP):
272 $(hide) mkdir -p $(KERNEL_OUT)
273 $(hide) rm -rf $(KERNEL_MODULES_OUT)
274 $(hide) mkdir -p $(KERNEL_MODULES_OUT)
275 $(hide) touch $@
276
277KERNEL_ADDITIONAL_CONFIG_OUT := $(KERNEL_OUT)/.additional_config
278
279.PHONY: force_additional_config
280$(KERNEL_ADDITIONAL_CONFIG_OUT): force_additional_config
281 $(hide) cmp -s $(KERNEL_ADDITIONAL_CONFIG_SRC) $@ || cp $(KERNEL_ADDITIONAL_CONFIG_SRC) $@;
282
283$(KERNEL_CONFIG): $(KERNEL_OUT_STAMP) $(KERNEL_DEFCONFIG_SRC) $(KERNEL_ADDITIONAL_CONFIG_OUT)
284 @echo "Building Kernel Config"
285 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG)
286 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
287 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
288 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
289 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
Sam Mortimerb0cecb72016-10-01 09:56:52 -0700290 # Create defconfig build artifact
291 $(hide) $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig
Michael Bestas3952f6c2016-08-26 01:12:08 +0300292 $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \
293 echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \
294 $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
295 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi
296
297TARGET_KERNEL_BINARIES: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL_STAMP)
298 @echo "Building Kernel"
299 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE)
300 $(hide) if grep -q 'CONFIG_OF=y' $(KERNEL_CONFIG) ; \
301 then \
302 echo "Building DTBs" ; \
303 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) dtbs ; \
304 else \
305 echo "DTBs not enabled" ; \
306 fi ;
307 $(hide) if grep -q 'CONFIG_MODULES=y' $(KERNEL_CONFIG) ; \
308 then \
309 echo "Building Kernel Modules" ; \
310 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules && \
311 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules_install && \
312 $(mv-modules) && \
313 $(clean-module-folder) ; \
314 else \
315 echo "Kernel Modules not enabled" ; \
316 fi ;
317
318
319$(TARGET_KERNEL_MODULES): TARGET_KERNEL_BINARIES
320
321$(TARGET_PREBUILT_INT_KERNEL): $(TARGET_KERNEL_MODULES)
Michael Bestas3952f6c2016-08-26 01:12:08 +0300322
323$(KERNEL_HEADERS_INSTALL_STAMP): $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG)
324 @echo "Building Kernel Headers"
325 $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \
326 rm -f ../$(KERNEL_CONFIG); \
327 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_HEADER_DEFCONFIG); \
328 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) headers_install; fi
329 $(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \
330 echo "Used a different defconfig for header generation"; \
331 rm -f ../$(KERNEL_CONFIG); \
332 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG); fi
333 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
334 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
335 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
336 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
337 $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \
338 echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \
339 $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
340 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi
341 $(hide) touch $@
342
343# provide this rule because there are dependencies on this throughout the repo
344$(KERNEL_HEADERS_INSTALL): $(KERNEL_HEADERS_INSTALL_STAMP)
345
346kerneltags: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG)
347 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) tags
348
349kernelconfig: KERNELCONFIG_MODE := menuconfig
350kernelxconfig: KERNELCONFIG_MODE := xconfig
351kernelxconfig kernelconfig: $(KERNEL_OUT_STAMP)
352 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG)
353 env KCONFIG_NOTIMESTAMP=true \
354 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNELCONFIG_MODE)
355 env KCONFIG_NOTIMESTAMP=true \
356 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig
357 cp $(KERNEL_OUT)/defconfig $(KERNEL_DEFCONFIG_SRC)
358
Michael Bestas296008c2017-07-12 20:56:35 +0300359kernelsavedefconfig: $(KERNEL_OUT_STAMP)
360 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG)
361 env KCONFIG_NOTIMESTAMP=true \
362 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig
363 cp $(KERNEL_OUT)/defconfig $(KERNEL_DEFCONFIG_SRC)
364
Michael Bestas3952f6c2016-08-26 01:12:08 +0300365alldefconfig: $(KERNEL_OUT_STAMP)
366 env KCONFIG_NOTIMESTAMP=true \
367 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) alldefconfig
368
369endif # FULL_KERNEL_BUILD
370
371## Install it
372
373ifeq ($(NEEDS_KERNEL_COPY),true)
374file := $(INSTALLED_KERNEL_TARGET)
375ALL_PREBUILT += $(file)
376$(file) : $(KERNEL_BIN) | $(ACP)
377 $(transform-prebuilt-to-target)
378
379ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET)
380endif
381
382.PHONY: kernel
383kernel: $(INSTALLED_KERNEL_TARGET)