blob: c4ddebf95954ad2fdc759ce695c706098eba1bba [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
112endif
113
114TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(TARGET_PREBUILT_INT_KERNEL_TYPE)
115
116# Clear this first to prevent accidental poisoning from env
117MAKE_FLAGS :=
118
119ifeq ($(KERNEL_ARCH),arm64)
120 # Avoid "unsupported RELA relocation: 311" errors (R_AARCH64_ADR_GOT_PAGE)
121 MAKE_FLAGS += CFLAGS_MODULE="-fno-pic"
122 ifeq ($(TARGET_ARCH),arm)
123 KERNEL_CONFIG_OVERRIDE := CONFIG_ANDROID_BINDER_IPC_32BIT=y
124 endif
125endif
126
127ifneq ($(TARGET_KERNEL_ADDITIONAL_CONFIG),)
128KERNEL_ADDITIONAL_CONFIG := $(TARGET_KERNEL_ADDITIONAL_CONFIG)
129KERNEL_ADDITIONAL_CONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG)
130 ifeq ("$(wildcard $(KERNEL_ADDITIONAL_CONFIG_SRC))","")
131 $(warning TARGET_KERNEL_ADDITIONAL_CONFIG '$(TARGET_KERNEL_ADDITIONAL_CONFIG)' doesn't exist)
132 KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
133 endif
134else
135 KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
136endif
137
138## Do be discontinued in a future version. Notify builder about target
139## kernel format requirement
140ifeq ($(BOARD_KERNEL_IMAGE_NAME),)
141ifeq ($(BOARD_USES_UBOOT),true)
142 $(error "Please set BOARD_KERNEL_IMAGE_NAME to uImage")
143else ifeq ($(BOARD_USES_UNCOMPRESSED_BOOT),true)
144 $(error "Please set BOARD_KERNEL_IMAGE_NAME to Image")
145endif
146endif
147
148ifeq "$(wildcard $(KERNEL_SRC) )" ""
149 ifneq ($(TARGET_PREBUILT_KERNEL),)
150 HAS_PREBUILT_KERNEL := true
151 NEEDS_KERNEL_COPY := true
152 else
153 $(foreach cf,$(PRODUCT_COPY_FILES), \
154 $(eval _src := $(call word-colon,1,$(cf))) \
155 $(eval _dest := $(call word-colon,2,$(cf))) \
156 $(ifeq kernel,$(_dest), \
157 $(eval HAS_PREBUILT_KERNEL := true)))
158 endif
159
160 ifneq ($(HAS_PREBUILT_KERNEL),)
161 $(warning ***************************************************************)
162 $(warning * Using prebuilt kernel binary instead of source *)
163 $(warning * THIS IS DEPRECATED, AND WILL BE DISCONTINUED *)
164 $(warning * Please configure your device to download the kernel *)
165 $(warning * source repository to $(KERNEL_SRC))
Dan Pasanen03447712016-12-19 11:22:55 -0600166 $(warning * See http://wiki.lineageos.org/w/Doc:_integrated_kernel_building)
Michael Bestas3952f6c2016-08-26 01:12:08 +0300167 $(warning * for more information *)
168 $(warning ***************************************************************)
169 FULL_KERNEL_BUILD := false
170 KERNEL_BIN := $(TARGET_PREBUILT_KERNEL)
171 else
172 $(warning ***************************************************************)
173 $(warning * *)
174 $(warning * No kernel source found, and no fallback prebuilt defined. *)
175 $(warning * Please make sure your device is properly configured to *)
176 $(warning * download the kernel repository to $(KERNEL_SRC))
177 $(warning * and add the TARGET_KERNEL_CONFIG variable to BoardConfig.mk *)
178 $(warning * *)
179 $(warning * As an alternative, define the TARGET_PREBUILT_KERNEL *)
180 $(warning * variable with the path to the prebuilt binary kernel image *)
181 $(warning * in your BoardConfig.mk file *)
182 $(warning * *)
183 $(warning ***************************************************************)
184 $(error "NO KERNEL")
185 endif
186else
187 NEEDS_KERNEL_COPY := true
188 ifeq ($(TARGET_KERNEL_CONFIG),)
189 $(warning **********************************************************)
190 $(warning * Kernel source found, but no configuration was defined *)
191 $(warning * Please add the TARGET_KERNEL_CONFIG variable to your *)
192 $(warning * BoardConfig.mk file *)
193 $(warning **********************************************************)
194 # $(error "NO KERNEL CONFIG")
195 else
196 #$(info Kernel source found, building it)
197 FULL_KERNEL_BUILD := true
198 KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL)
199 endif
200endif
201
202ifeq ($(FULL_KERNEL_BUILD),true)
203
204KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
205KERNEL_HEADERS_INSTALL_STAMP := $(KERNEL_OUT)/.headers_install_stamp
206
207ifeq ($(NEED_KERNEL_MODULE_ROOT),true)
208KERNEL_MODULES_INSTALL := root
209KERNEL_MODULES_OUT := $(TARGET_ROOT_OUT)/lib/modules
210else
211KERNEL_MODULES_INSTALL := system
212KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules
213endif
214
215TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX))
216ifneq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),)
217KERNEL_TOOLCHAIN_PREFIX ?= $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)
Zhao Wei Liew9689bb92016-11-10 20:02:58 +0800218else ifeq ($(KERNEL_ARCH),arm64)
Michael Bestas1d55ece2016-09-28 20:16:25 +0300219KERNEL_TOOLCHAIN_PREFIX ?= aarch64-linux-androidkernel-
Zhao Wei Liew9689bb92016-11-10 20:02:58 +0800220else ifeq ($(KERNEL_ARCH),arm)
Michael Bestas1d55ece2016-09-28 20:16:25 +0300221KERNEL_TOOLCHAIN_PREFIX ?= arm-linux-androidkernel-
Zhao Wei Liew9689bb92016-11-10 20:02:58 +0800222else ifeq ($(KERNEL_ARCH),x86)
Michael Bestas1d55ece2016-09-28 20:16:25 +0300223KERNEL_TOOLCHAIN_PREFIX ?= x86_64-linux-androidkernel-
Michael Bestas3952f6c2016-08-26 01:12:08 +0300224endif
225
226ifeq ($(KERNEL_TOOLCHAIN),)
227KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN_PREFIX)
228else
229ifneq ($(KERNEL_TOOLCHAIN_PREFIX),)
230KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX)
231endif
232endif
233
234ifneq ($(USE_CCACHE),)
Steve Kondik6a378282016-09-25 22:37:01 -0700235 # Detect if the system already has ccache installed to use instead of the prebuilt
236 ccache := $(shell which ccache)
237
238 ifeq ($(ccache),)
239 ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache
240 # Check that the executable is here.
241 ccache := $(strip $(wildcard $(ccache)))
242 endif
Michael Bestas3952f6c2016-08-26 01:12:08 +0300243endif
244
245KERNEL_CROSS_COMPILE := CROSS_COMPILE="$(ccache) $(KERNEL_TOOLCHAIN_PATH)"
246ccache =
247
248define mv-modules
249 mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.order`;\
250 if [ "$$mdpath" != "" ];then\
251 mpath=`dirname $$mdpath`;\
252 ko=`find $$mpath/kernel -type f -name *.ko`;\
253 for i in $$ko; do $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $$i;\
254 mv $$i $(KERNEL_MODULES_OUT)/; done;\
255 fi
256endef
257
258define clean-module-folder
259 mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.order`;\
260 if [ "$$mdpath" != "" ];then\
261 mpath=`dirname $$mdpath`; rm -rf $$mpath;\
262 fi
263endef
264
265ifeq ($(HOST_OS),darwin)
266 MAKE_FLAGS += C_INCLUDE_PATH=$(ANDROID_BUILD_TOP)/external/elfutils/libelf/
267endif
268
269ifeq ($(TARGET_KERNEL_MODULES),)
270 TARGET_KERNEL_MODULES := no-external-modules
271endif
272
273$(KERNEL_OUT_STAMP):
274 $(hide) mkdir -p $(KERNEL_OUT)
275 $(hide) rm -rf $(KERNEL_MODULES_OUT)
276 $(hide) mkdir -p $(KERNEL_MODULES_OUT)
277 $(hide) touch $@
278
279KERNEL_ADDITIONAL_CONFIG_OUT := $(KERNEL_OUT)/.additional_config
280
281.PHONY: force_additional_config
282$(KERNEL_ADDITIONAL_CONFIG_OUT): force_additional_config
283 $(hide) cmp -s $(KERNEL_ADDITIONAL_CONFIG_SRC) $@ || cp $(KERNEL_ADDITIONAL_CONFIG_SRC) $@;
284
285$(KERNEL_CONFIG): $(KERNEL_OUT_STAMP) $(KERNEL_DEFCONFIG_SRC) $(KERNEL_ADDITIONAL_CONFIG_OUT)
286 @echo "Building Kernel Config"
287 $(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)
288 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
289 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
290 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
291 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
Sam Mortimerb0cecb72016-10-01 09:56:52 -0700292 # Create defconfig build artifact
293 $(hide) $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig
Michael Bestas3952f6c2016-08-26 01:12:08 +0300294 $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \
295 echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \
296 $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
297 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi
298
299TARGET_KERNEL_BINARIES: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL_STAMP)
300 @echo "Building Kernel"
301 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE)
302 $(hide) if grep -q 'CONFIG_OF=y' $(KERNEL_CONFIG) ; \
303 then \
304 echo "Building DTBs" ; \
305 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) dtbs ; \
306 else \
307 echo "DTBs not enabled" ; \
308 fi ;
309 $(hide) if grep -q 'CONFIG_MODULES=y' $(KERNEL_CONFIG) ; \
310 then \
311 echo "Building Kernel Modules" ; \
312 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules && \
313 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules_install && \
314 $(mv-modules) && \
315 $(clean-module-folder) ; \
316 else \
317 echo "Kernel Modules not enabled" ; \
318 fi ;
319
320
321$(TARGET_KERNEL_MODULES): TARGET_KERNEL_BINARIES
322
323$(TARGET_PREBUILT_INT_KERNEL): $(TARGET_KERNEL_MODULES)
Michael Bestas3952f6c2016-08-26 01:12:08 +0300324
325$(KERNEL_HEADERS_INSTALL_STAMP): $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG)
326 @echo "Building Kernel Headers"
327 $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \
328 rm -f ../$(KERNEL_CONFIG); \
329 $(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); \
330 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) headers_install; fi
331 $(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \
332 echo "Used a different defconfig for header generation"; \
333 rm -f ../$(KERNEL_CONFIG); \
334 $(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
335 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
336 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
337 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
338 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
339 $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \
340 echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \
341 $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
342 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi
343 $(hide) touch $@
344
345# provide this rule because there are dependencies on this throughout the repo
346$(KERNEL_HEADERS_INSTALL): $(KERNEL_HEADERS_INSTALL_STAMP)
347
348kerneltags: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG)
349 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) tags
350
351kernelconfig: KERNELCONFIG_MODE := menuconfig
352kernelxconfig: KERNELCONFIG_MODE := xconfig
353kernelxconfig kernelconfig: $(KERNEL_OUT_STAMP)
354 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG)
355 env KCONFIG_NOTIMESTAMP=true \
356 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNELCONFIG_MODE)
357 env KCONFIG_NOTIMESTAMP=true \
358 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig
359 cp $(KERNEL_OUT)/defconfig $(KERNEL_DEFCONFIG_SRC)
360
361alldefconfig: $(KERNEL_OUT_STAMP)
362 env KCONFIG_NOTIMESTAMP=true \
363 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) alldefconfig
364
365endif # FULL_KERNEL_BUILD
366
367## Install it
368
369ifeq ($(NEEDS_KERNEL_COPY),true)
370file := $(INSTALLED_KERNEL_TARGET)
371ALL_PREBUILT += $(file)
372$(file) : $(KERNEL_BIN) | $(ACP)
373 $(transform-prebuilt-to-target)
374
375ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET)
376endif
377
378.PHONY: kernel
379kernel: $(INSTALLED_KERNEL_TARGET)