blob: 5a150fb0425bb6f80dc677f31cdb44831cd3bb40 [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
Michael Bestas3952f6c2016-08-26 01:12:08 +030033# TARGET_KERNEL_CROSS_COMPILE_PREFIX = Compiler prefix (e.g. arm-eabi-)
Michael Bestas1d55ece2016-09-28 20:16:25 +030034# defaults to arm-linux-androidkernel- for arm
35# aarch64-linux-androidkernel- for arm64
36# x86_64-linux-androidkernel- for x86
Michael Bestas3952f6c2016-08-26 01:12:08 +030037#
Dan Pasanenedc1ceb2017-01-24 15:46:13 -060038# BOARD_KERNEL_IMAGE_NAME = Built image name
39# for ARM use: zImage
40# for ARM64 use: Image.gz
41# for uncompressed use: Image
42# If using an appended DT, append '-dtb'
43# to the end of the image name.
44# For example, for ARM devices,
45# use zImage-dtb instead of zImage.
Michael Bestas3952f6c2016-08-26 01:12:08 +030046#
47# KERNEL_TOOLCHAIN_PREFIX = Overrides TARGET_KERNEL_CROSS_COMPILE_PREFIX,
48# Set this var in shell to override
49# toolchain specified in BoardConfig.mk
50# KERNEL_TOOLCHAIN = Path to toolchain, if unset, assumes
51# TARGET_KERNEL_CROSS_COMPILE_PREFIX
52# is in PATH
53# USE_CCACHE = Enable ccache (global Android flag)
54#
55# NEED_KERNEL_MODULE_ROOT = Optional, if true, install kernel
56# modules in root instead of system
57
58
59TARGET_AUTO_KDIR := $(shell echo $(TARGET_DEVICE_DIR) | sed -e 's/^device/kernel/g')
60
61## Externally influenced variables
62# kernel location - optional, defaults to kernel/<vendor>/<device>
63TARGET_KERNEL_SOURCE ?= $(TARGET_AUTO_KDIR)
64KERNEL_SRC := $(TARGET_KERNEL_SOURCE)
65# kernel configuration - mandatory
66KERNEL_DEFCONFIG := $(TARGET_KERNEL_CONFIG)
67VARIANT_DEFCONFIG := $(TARGET_KERNEL_VARIANT_CONFIG)
68SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG)
69
70## Internal variables
71KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
72KERNEL_CONFIG := $(KERNEL_OUT)/.config
73KERNEL_OUT_STAMP := $(KERNEL_OUT)/.mkdir_stamp
74
75TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH))
76ifeq ($(TARGET_KERNEL_ARCH),)
77KERNEL_ARCH := $(TARGET_ARCH)
78else
79KERNEL_ARCH := $(TARGET_KERNEL_ARCH)
80endif
81
82ifeq ($(KERNEL_ARCH),x86_64)
83KERNEL_DEFCONFIG_ARCH := x86
84else
85KERNEL_DEFCONFIG_ARCH := $(KERNEL_ARCH)
86endif
87KERNEL_DEFCONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_DEFCONFIG_ARCH)/configs/$(KERNEL_DEFCONFIG)
88
89TARGET_KERNEL_HEADER_ARCH := $(strip $(TARGET_KERNEL_HEADER_ARCH))
90ifeq ($(TARGET_KERNEL_HEADER_ARCH),)
91KERNEL_HEADER_ARCH := $(KERNEL_ARCH)
92else
93KERNEL_HEADER_ARCH := $(TARGET_KERNEL_HEADER_ARCH)
94endif
95
96KERNEL_HEADER_DEFCONFIG := $(strip $(KERNEL_HEADER_DEFCONFIG))
97ifeq ($(KERNEL_HEADER_DEFCONFIG),)
98KERNEL_HEADER_DEFCONFIG := $(KERNEL_DEFCONFIG)
99endif
100
Dan Pasanenedc1ceb2017-01-24 15:46:13 -0600101ifeq ($(BOARD_KERNEL_IMAGE_NAME),)
102$(error BOARD_KERNEL_IMAGE_NAME not defined.)
Michael Bestas3952f6c2016-08-26 01:12:08 +0300103endif
Dan Pasanenedc1ceb2017-01-24 15:46:13 -0600104ifneq ($(TARGET_USES_UNCOMPRESSED_KERNEL),)
105$(error TARGET_USES_UNCOMPRESSED_KERNEL is deprecated.)
106endif
107ifneq ($(TARGET_KERNEL_APPEND_DTB),)
108$(error TARGET_KERNEL_APPEND_DTB is deprecated.)
109endif
110TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(BOARD_KERNEL_IMAGE_NAME)
Michael Bestas3952f6c2016-08-26 01:12:08 +0300111
112# Clear this first to prevent accidental poisoning from env
113MAKE_FLAGS :=
114
Ziyan54648c22017-01-12 18:47:54 +0100115ifeq ($(KERNEL_ARCH),arm)
116 # Avoid "Unknown symbol _GLOBAL_OFFSET_TABLE_" errors
117 MAKE_FLAGS += CFLAGS_MODULE="-fno-pic"
118endif
119
Michael Bestas3952f6c2016-08-26 01:12:08 +0300120ifeq ($(KERNEL_ARCH),arm64)
121 # Avoid "unsupported RELA relocation: 311" errors (R_AARCH64_ADR_GOT_PAGE)
122 MAKE_FLAGS += CFLAGS_MODULE="-fno-pic"
123 ifeq ($(TARGET_ARCH),arm)
124 KERNEL_CONFIG_OVERRIDE := CONFIG_ANDROID_BINDER_IPC_32BIT=y
125 endif
126endif
127
128ifneq ($(TARGET_KERNEL_ADDITIONAL_CONFIG),)
129KERNEL_ADDITIONAL_CONFIG := $(TARGET_KERNEL_ADDITIONAL_CONFIG)
130KERNEL_ADDITIONAL_CONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG)
131 ifeq ("$(wildcard $(KERNEL_ADDITIONAL_CONFIG_SRC))","")
132 $(warning TARGET_KERNEL_ADDITIONAL_CONFIG '$(TARGET_KERNEL_ADDITIONAL_CONFIG)' doesn't exist)
133 KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
134 endif
135else
136 KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
137endif
138
Michael Bestas3952f6c2016-08-26 01:12:08 +0300139ifeq "$(wildcard $(KERNEL_SRC) )" ""
140 ifneq ($(TARGET_PREBUILT_KERNEL),)
141 HAS_PREBUILT_KERNEL := true
142 NEEDS_KERNEL_COPY := true
143 else
144 $(foreach cf,$(PRODUCT_COPY_FILES), \
145 $(eval _src := $(call word-colon,1,$(cf))) \
146 $(eval _dest := $(call word-colon,2,$(cf))) \
147 $(ifeq kernel,$(_dest), \
148 $(eval HAS_PREBUILT_KERNEL := true)))
149 endif
150
151 ifneq ($(HAS_PREBUILT_KERNEL),)
152 $(warning ***************************************************************)
153 $(warning * Using prebuilt kernel binary instead of source *)
154 $(warning * THIS IS DEPRECATED, AND WILL BE DISCONTINUED *)
155 $(warning * Please configure your device to download the kernel *)
156 $(warning * source repository to $(KERNEL_SRC))
Michael Bestas3952f6c2016-08-26 01:12:08 +0300157 $(warning * for more information *)
158 $(warning ***************************************************************)
159 FULL_KERNEL_BUILD := false
160 KERNEL_BIN := $(TARGET_PREBUILT_KERNEL)
161 else
162 $(warning ***************************************************************)
163 $(warning * *)
164 $(warning * No kernel source found, and no fallback prebuilt defined. *)
165 $(warning * Please make sure your device is properly configured to *)
166 $(warning * download the kernel repository to $(KERNEL_SRC))
167 $(warning * and add the TARGET_KERNEL_CONFIG variable to BoardConfig.mk *)
168 $(warning * *)
169 $(warning * As an alternative, define the TARGET_PREBUILT_KERNEL *)
170 $(warning * variable with the path to the prebuilt binary kernel image *)
171 $(warning * in your BoardConfig.mk file *)
172 $(warning * *)
173 $(warning ***************************************************************)
174 $(error "NO KERNEL")
175 endif
176else
177 NEEDS_KERNEL_COPY := true
178 ifeq ($(TARGET_KERNEL_CONFIG),)
179 $(warning **********************************************************)
180 $(warning * Kernel source found, but no configuration was defined *)
181 $(warning * Please add the TARGET_KERNEL_CONFIG variable to your *)
182 $(warning * BoardConfig.mk file *)
183 $(warning **********************************************************)
184 # $(error "NO KERNEL CONFIG")
185 else
186 #$(info Kernel source found, building it)
187 FULL_KERNEL_BUILD := true
188 KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL)
189 endif
190endif
191
192ifeq ($(FULL_KERNEL_BUILD),true)
193
194KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
195KERNEL_HEADERS_INSTALL_STAMP := $(KERNEL_OUT)/.headers_install_stamp
196
197ifeq ($(NEED_KERNEL_MODULE_ROOT),true)
198KERNEL_MODULES_INSTALL := root
199KERNEL_MODULES_OUT := $(TARGET_ROOT_OUT)/lib/modules
200else
201KERNEL_MODULES_INSTALL := system
202KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules
203endif
204
205TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX))
206ifneq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),)
207KERNEL_TOOLCHAIN_PREFIX ?= $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)
Zhao Wei Liew9689bb92016-11-10 20:02:58 +0800208else ifeq ($(KERNEL_ARCH),arm64)
Michael Bestas1d55ece2016-09-28 20:16:25 +0300209KERNEL_TOOLCHAIN_PREFIX ?= aarch64-linux-androidkernel-
Zhao Wei Liew9689bb92016-11-10 20:02:58 +0800210else ifeq ($(KERNEL_ARCH),arm)
Michael Bestas1d55ece2016-09-28 20:16:25 +0300211KERNEL_TOOLCHAIN_PREFIX ?= arm-linux-androidkernel-
Zhao Wei Liew9689bb92016-11-10 20:02:58 +0800212else ifeq ($(KERNEL_ARCH),x86)
Michael Bestas1d55ece2016-09-28 20:16:25 +0300213KERNEL_TOOLCHAIN_PREFIX ?= x86_64-linux-androidkernel-
Michael Bestas3952f6c2016-08-26 01:12:08 +0300214endif
215
216ifeq ($(KERNEL_TOOLCHAIN),)
217KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN_PREFIX)
218else
219ifneq ($(KERNEL_TOOLCHAIN_PREFIX),)
220KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX)
221endif
222endif
223
224ifneq ($(USE_CCACHE),)
Steve Kondik6a378282016-09-25 22:37:01 -0700225 # Detect if the system already has ccache installed to use instead of the prebuilt
226 ccache := $(shell which ccache)
227
228 ifeq ($(ccache),)
229 ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache
230 # Check that the executable is here.
231 ccache := $(strip $(wildcard $(ccache)))
232 endif
Michael Bestas3952f6c2016-08-26 01:12:08 +0300233endif
234
235KERNEL_CROSS_COMPILE := CROSS_COMPILE="$(ccache) $(KERNEL_TOOLCHAIN_PATH)"
236ccache =
237
Michael Bestas3952f6c2016-08-26 01:12:08 +0300238ifeq ($(HOST_OS),darwin)
Christopher N. Hesse1e7c3f02017-04-12 00:57:44 +0200239 MAKE_FLAGS += C_INCLUDE_PATH=$(ANDROID_BUILD_TOP)/external/elfutils/libelf:/usr/local/opt/openssl/include
Rashed Abdel-Tawab7fb92512017-03-16 14:37:07 -0400240 MAKE_FLAGS += LIBRARY_PATH=/usr/local/opt/openssl/lib
Michael Bestas3952f6c2016-08-26 01:12:08 +0300241endif
242
243ifeq ($(TARGET_KERNEL_MODULES),)
Tom Marshallf15c3712017-11-10 01:00:18 +0100244 TARGET_KERNEL_MODULES := INSTALLED_KERNEL_MODULES
Michael Bestas3952f6c2016-08-26 01:12:08 +0300245endif
246
247$(KERNEL_OUT_STAMP):
248 $(hide) mkdir -p $(KERNEL_OUT)
249 $(hide) rm -rf $(KERNEL_MODULES_OUT)
250 $(hide) mkdir -p $(KERNEL_MODULES_OUT)
251 $(hide) touch $@
252
253KERNEL_ADDITIONAL_CONFIG_OUT := $(KERNEL_OUT)/.additional_config
254
255.PHONY: force_additional_config
256$(KERNEL_ADDITIONAL_CONFIG_OUT): force_additional_config
257 $(hide) cmp -s $(KERNEL_ADDITIONAL_CONFIG_SRC) $@ || cp $(KERNEL_ADDITIONAL_CONFIG_SRC) $@;
258
259$(KERNEL_CONFIG): $(KERNEL_OUT_STAMP) $(KERNEL_DEFCONFIG_SRC) $(KERNEL_ADDITIONAL_CONFIG_OUT)
260 @echo "Building Kernel Config"
261 $(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)
262 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
263 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
264 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
265 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
Sam Mortimerb0cecb72016-10-01 09:56:52 -0700266 # Create defconfig build artifact
267 $(hide) $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig
Michael Bestas3952f6c2016-08-26 01:12:08 +0300268 $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \
269 echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \
270 $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
271 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi
272
273TARGET_KERNEL_BINARIES: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL_STAMP)
274 @echo "Building Kernel"
Dan Pasanenedc1ceb2017-01-24 15:46:13 -0600275 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(BOARD_KERNEL_IMAGE_NAME)
Tom Marshallf15c3712017-11-10 01:00:18 +0100276 $(hide) if grep -q '^CONFIG_OF=y' $(KERNEL_CONFIG); then \
277 echo "Building DTBs"; \
278 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) dtbs; \
279 fi
280 $(hide) if grep -q '^CONFIG_MODULES=y' $(KERNEL_CONFIG); then \
281 echo "Building Kernel Modules"; \
282 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules; \
283 fi
Michael Bestas3952f6c2016-08-26 01:12:08 +0300284
Tom Marshallf15c3712017-11-10 01:00:18 +0100285.PHONY: INSTALLED_KERNEL_MODULES
286INSTALLED_KERNEL_MODULES:
287 $(hide) if grep -q '^CONFIG_MODULES=y' $(KERNEL_CONFIG); then \
288 echo "Installing Kernel Modules"; \
289 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) modules_install && \
290 mofile=$$(find $(KERNEL_MODULES_OUT) -type f -name modules.order) && \
291 mpath=$$(dirname $$mofile) && \
292 for f in $$(find $$mpath/kernel -type f -name '*.ko'); do \
293 $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $$f; \
294 mv $$f $(KERNEL_MODULES_OUT); \
295 done && \
296 rm -rf $$mpath; \
297 fi
Michael Bestas3952f6c2016-08-26 01:12:08 +0300298
299$(TARGET_KERNEL_MODULES): TARGET_KERNEL_BINARIES
300
301$(TARGET_PREBUILT_INT_KERNEL): $(TARGET_KERNEL_MODULES)
Michael Bestas3952f6c2016-08-26 01:12:08 +0300302
303$(KERNEL_HEADERS_INSTALL_STAMP): $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG)
304 @echo "Building Kernel Headers"
305 $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \
306 rm -f ../$(KERNEL_CONFIG); \
307 $(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); \
308 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) headers_install; fi
309 $(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \
310 echo "Used a different defconfig for header generation"; \
311 rm -f ../$(KERNEL_CONFIG); \
312 $(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
313 $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
314 echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
315 echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
316 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
317 $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \
318 echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \
319 $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
320 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi
321 $(hide) touch $@
322
323# provide this rule because there are dependencies on this throughout the repo
324$(KERNEL_HEADERS_INSTALL): $(KERNEL_HEADERS_INSTALL_STAMP)
325
326kerneltags: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG)
327 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) tags
328
329kernelconfig: KERNELCONFIG_MODE := menuconfig
330kernelxconfig: KERNELCONFIG_MODE := xconfig
331kernelxconfig kernelconfig: $(KERNEL_OUT_STAMP)
332 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG)
333 env KCONFIG_NOTIMESTAMP=true \
334 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNELCONFIG_MODE)
335 env KCONFIG_NOTIMESTAMP=true \
336 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig
337 cp $(KERNEL_OUT)/defconfig $(KERNEL_DEFCONFIG_SRC)
338
Michael Bestas296008c2017-07-12 20:56:35 +0300339kernelsavedefconfig: $(KERNEL_OUT_STAMP)
340 $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG)
341 env KCONFIG_NOTIMESTAMP=true \
342 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig
343 cp $(KERNEL_OUT)/defconfig $(KERNEL_DEFCONFIG_SRC)
344
Michael Bestas3952f6c2016-08-26 01:12:08 +0300345alldefconfig: $(KERNEL_OUT_STAMP)
346 env KCONFIG_NOTIMESTAMP=true \
347 $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) alldefconfig
348
349endif # FULL_KERNEL_BUILD
350
351## Install it
352
353ifeq ($(NEEDS_KERNEL_COPY),true)
354file := $(INSTALLED_KERNEL_TARGET)
355ALL_PREBUILT += $(file)
356$(file) : $(KERNEL_BIN) | $(ACP)
357 $(transform-prebuilt-to-target)
358
359ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET)
360endif
361
362.PHONY: kernel
363kernel: $(INSTALLED_KERNEL_TARGET)