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