vendor: import kernel build task from android-7.1
build: Inline kernel building as a buildtime task
By arcee
Kernel image integration is now done in the build system. The
"one true way" of doing this is to download the kernel source
into kernel/TARGET_BOOTLOADER_NAME (by usage of the cm.dependencies
mechanism or otherwise), and defining the TARGET_KERNEL_CONFIG
variable in the device's BoardConfig makefile
If the kernel's location doesn't match the automagic location
(multi-device kernel source, for instance), TARGET_KERNEL_SOURCE
can be used to specify a kernel path (i.e.,
"TARGET_KERNEL_SOURCE := kernel/shared-whatever")
If the device requires out-of-kernel-tree modules to be built,
the TARGET_KERNEL_MODULES variable can be used, pointing to a
_make target_ that will build and install such modules. Definition
of such a target is the device author's responsibility, the only
restriction is that it is a normal makefile recipe (example
below)
Optionally (or as an alternative), a prebuilt binary can also be
defined at BoardConfig, by usage of the TARGET_PREBUILT_KERNEL
variable. This binary will be used if the kernel source is absent
(or undefined).
A minimal BoardConfig.mk should look something like this:
TARGET_KERNEL_CONFIG := cyanogenmod_<device>_defconfig
TARGET_PREBUILT_KERNEL := device/<vendor>/<device>/kernel
To include, for example, the TI WLAN modules, this can be used:
-----------------------------
TIWLAN_MODULES:
make -C hardware/ti/wlan/wl1283/platforms/os/linux/ KERNEL_DIR=$(KERNEL_OUT) ARCH="arm"
CROSS_COMPILE="arm-eabi-" TNETW=1273 RANDOM_MAC=n REPORT_LOG=n
mv hardware/ti/wlan/wl1283/platforms/os/linux/tiwlan_drv.ko $(KERNEL_MODULES_OUT)
make -C hardware/ti/wlan/wl1283_softAP/platforms/os/linux/ KERNEL_DIR=$(KERNEL_OUT) ARCH="arm"
CROSS_COMPILE="arm-eabi-" TNETW=1273 REPORT_LOG=n
mv hardware/ti/wlan/wl1283_softAP/platforms/os/linux/tiap_drv.ko $(KERNEL_MODULES_OUT)
TARGET_KERNEL_MODULES := TIWLAN_MODULES
---------------------------
Change-Id: I8634fa4c788a42dc6f62e62ca170825b66db126a
build: Fix kernel.mk typos
Change-Id: I5980d6a30dd66741a561a95e0dfba60a3ad0ef5d
envsetup: set OUT_DIR to an absolute path always
OUT_DIR was set to $(TOPDIR)out previously,
but $(TOPDIR) was null, so it was a relative path.
This broke releasetools, inline kernel building, etc
since they require absolute paths.
Fix it so that it is set to $(shell readlink -f .)/out
if $(TOPDIR) is null.
Also remove hacks which checked if (OUT_DIR) was out
and changed it to $(ANDROID_BUILD_TOP)/out to workaround
the aforementioned problem.
Change-Id: I459a3b1325a1bbea0565cd73f6acf160d4ed9b39
Conflicts:
core/base_rules.mk
core/tasks/kernel.mk
Change-Id: I52a7a6024f0f2b708c230e53c0152ed138726cc1
build: change custom -> omni in a few more places
* these weren't changed when the transtition occured - fix them now
Change-Id: I47bedb96ad63a41959baa98e1a265cb616d17918
kernel.mk: Use standard toolchain paths
Change-Id: I1225fd05dcedcff03a1cf1102841cbd010b609cf
Make the kernel image format parametric instead of a chain of if/elses
Change-Id: I54bfcdecb8647f7bcf744e72b2de19fcf4e4e7ac
build: Add "dtbs" target when building the kernel
* This is needed for 3.10
Change-Id: I4044ea9e67017452efc25097a3327141a6627c24
Squashed commit of updates to kernel.mk from CM
PS2: Add default toolchain prefix for KERNEL_ARCH=arm64
Allow specifying kernel toolchain and prefix
Change-Id: Ib75cfe772e073f2196455f3e3dfba247f6b3feff
core: More flexible kernel configuration
* Allow various combinations of kernel vs. userspace architectures
* Get rid of various assumptions about everything being ARM or 32-bit
* This adds the following target flags:
TARGET_KERNEL_ARCH
TARGET_KERNEL_HEADER_ARCH
KERNEL_HEADER_DEFCONFIG
TARGET_KERNEL_CROSS_COMPILE_PREFIX
Change-Id: If0bc202abd35c216ba3ea5707ffdb602526d8ed3
Fix kernel.mk if SELINUX or VARIANT_DEFCONFIG is defined
KERNEL_HEADER_DEFCONFIG was ignoring SELINUX_DEFCONFIG thus breaking
all selinux support
Change-Id: Idc3367d6b4b85343078e63e87dca6d6d052e7f53
build: kernel: Fix stray "@"
Nested "$(hide)"s (makefile @) don't work. There was one at the
beginning of the script, remove the inner one to prevent it from
being interpreted as a shell command
Change-Id: I08a829ee56b212366a0f5a3812f7a614667a9c2b
build: Add support for additional kernel config snippet
* Add support for TARGET_KERNEL_ADDITIONAL_CONFIG which will append a
config snippet from arch/$ARCH/configs/ to the main defconfig.
* This can be used for various things, such as including DIAG support
into debuggable builds.
Change-Id: Ifa48688a3f951dd8ecc9a13a27de3a476e7bf633
kernel: Fix kernelconfig build
* Copy the generated defconfig to the correct directory
Change-Id: Ia8e259946d67501675dd5a3433165d54df6c13c5
build: check kernel config for make modules and make dtbs
from CM
Change-Id: Iabb36a222d47d1481800fb2983b60f70621b5278
build: use the system's ccache by default
* ccache gets updated semi-frequently and some builders would like
to be able to take advantage of new features without having to
rely on the prebuilt version getting updated
* If a build system has ccache installed already, use that version
instead of the prebuilt
* @nathanchance edit: Replace which with command -v for portability,
print which binary is being used, and apply the same logic to
inline kernel compilation
Change-Id: I8988c8a25fab3694d84633f957c2b92ce84cf69e
build: kernel: build arm kernel modules with -fno-pic
With androidkernel (androideabi) toolchains, -fpic is enabled by default.
At least on my 3.4 arm kernel, this causes an issue with kernel modules:
"Unknown symbol _GLOBAL_OFFSET_TABLE_".
On traditional armeabi toolchains, -fpic is not enabled, resulting in working
kernel modules; let's follow that here.
Change-Id: I3058b5213b34bdde9bb9d744563c7d55cd42d2a5
diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk
new file mode 100644
index 0000000..1404fb3
--- /dev/null
+++ b/build/tasks/kernel.mk
@@ -0,0 +1,297 @@
+# Copyright (C) 2012 The CyanogenMod Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Android makefile to build kernel as a part of Android Build
+
+-include vendor/omni/config/branding.mk
+
+TARGET_AUTO_KDIR := $(shell echo $(TARGET_DEVICE_DIR) | sed -e 's/^device/kernel/g')
+
+## Externally influenced variables
+# kernel location - optional, defaults to kernel/<vendor>/<device>
+TARGET_KERNEL_SOURCE ?= $(TARGET_AUTO_KDIR)
+KERNEL_SRC := $(TARGET_KERNEL_SOURCE)
+# kernel configuration - mandatory
+KERNEL_DEFCONFIG := $(TARGET_KERNEL_CONFIG)
+VARIANT_DEFCONFIG := $(TARGET_KERNEL_VARIANT_CONFIG)
+SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG)
+
+## Internal variables
+KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
+KERNEL_CONFIG := $(KERNEL_OUT)/.config
+
+TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH))
+ifeq ($(TARGET_KERNEL_ARCH),)
+KERNEL_ARCH := $(TARGET_ARCH)
+else
+KERNEL_ARCH := $(TARGET_KERNEL_ARCH)
+endif
+
+TARGET_KERNEL_HEADER_ARCH := $(strip $(TARGET_KERNEL_HEADER_ARCH))
+ifeq ($(TARGET_KERNEL_HEADER_ARCH),)
+KERNEL_HEADER_ARCH := $(KERNEL_ARCH)
+else
+KERNEL_HEADER_ARCH := $(TARGET_KERNEL_HEADER_ARCH)
+endif
+
+KERNEL_HEADER_DEFCONFIG := $(strip $(KERNEL_HEADER_DEFCONFIG))
+ifeq ($(KERNEL_HEADER_DEFCONFIG),)
+KERNEL_HEADER_DEFCONFIG := $(KERNEL_DEFCONFIG)
+endif
+
+
+ifneq ($(BOARD_KERNEL_IMAGE_NAME),)
+ TARGET_PREBUILT_INT_KERNEL_TYPE := $(BOARD_KERNEL_IMAGE_NAME)
+else
+ ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true)
+ TARGET_PREBUILT_INT_KERNEL_TYPE := Image
+ else
+ TARGET_PREBUILT_INT_KERNEL_TYPE := zImage
+ endif
+endif
+
+TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(TARGET_PREBUILT_INT_KERNEL_TYPE)
+
+# Clear this first to prevent accidental poisoning from env
+MAKE_FLAGS :=
+
+ifeq ($(KERNEL_ARCH),arm)
+ # Avoid "Unknown symbol _GLOBAL_OFFSET_TABLE_" errors
+ MAKE_FLAGS += CFLAGS_MODULE="-fno-pic"
+endif
+
+ifeq ($(KERNEL_ARCH),arm64)
+ # Avoid "unsupported RELA relocation: 311" errors (R_AARCH64_ADR_GOT_PAGE)
+ MAKE_FLAGS += CFLAGS_MODULE="-fno-pic"
+ ifeq ($(TARGET_ARCH),arm)
+ KERNEL_CONFIG_OVERRIDE := CONFIG_ANDROID_BINDER_IPC_32BIT=y
+ endif
+endif
+
+ifneq ($(TARGET_KERNEL_ADDITIONAL_CONFIG),)
+KERNEL_ADDITIONAL_CONFIG := $(TARGET_KERNEL_ADDITIONAL_CONFIG)
+endif
+
+## Do be discontinued in a future version. Notify builder about target
+## kernel format requirement
+ifeq ($(BOARD_KERNEL_IMAGE_NAME),)
+ifeq ($(BOARD_USES_UBOOT),true)
+ $(error "Please set BOARD_KERNEL_IMAGE_NAME to uImage")
+else ifeq ($(BOARD_USES_UNCOMPRESSED_BOOT),true)
+ $(error "Please set BOARD_KERNEL_IMAGE_NAME to Image")
+endif
+endif
+
+ifeq "$(wildcard $(KERNEL_SRC) )" ""
+ ifneq ($(TARGET_PREBUILT_KERNEL),)
+ HAS_PREBUILT_KERNEL := true
+ NEEDS_KERNEL_COPY := true
+ else
+ $(foreach cf,$(PRODUCT_COPY_FILES), \
+ $(eval _src := $(call word-colon,1,$(cf))) \
+ $(eval _dest := $(call word-colon,2,$(cf))) \
+ $(ifeq kernel,$(_dest), \
+ $(eval HAS_PREBUILT_KERNEL := true)))
+ endif
+
+ ifneq ($(HAS_PREBUILT_KERNEL),)
+ $(warning ***************************************************************)
+ $(warning * Using prebuilt kernel binary instead of source *)
+ $(warning * THIS IS DEPRECATED, AND WILL BE DISCONTINUED *)
+ $(warning * Please configure your device to download the kernel *)
+ $(warning * source repository to $(KERNEL_SRC))
+ $(warning * See $(URL_INTEGRATED_KERNEL_BUILD))
+ $(warning * for more information *)
+ $(warning ***************************************************************)
+ FULL_KERNEL_BUILD := false
+ KERNEL_BIN := $(TARGET_PREBUILT_KERNEL)
+ else
+ $(warning ***************************************************************)
+ $(warning * *)
+ $(warning * No kernel source found, and no fallback prebuilt defined. *)
+ $(warning * Please make sure your device is properly configured to *)
+ $(warning * download the kernel repository to $(KERNEL_SRC))
+ $(warning * and add the TARGET_KERNEL_CONFIG variable to BoardConfig.mk *)
+ $(warning * *)
+ $(warning * As an alternative, define the TARGET_PREBUILT_KERNEL *)
+ $(warning * variable with the path to the prebuilt binary kernel image *)
+ $(warning * in your BoardConfig.mk file *)
+ $(warning * *)
+ $(warning ***************************************************************)
+ $(error "NO KERNEL")
+ endif
+else
+ NEEDS_KERNEL_COPY := true
+ ifeq ($(TARGET_KERNEL_CONFIG),)
+ $(warning **********************************************************)
+ $(warning * Kernel source found, but no configuration was defined *)
+ $(warning * Please add the TARGET_KERNEL_CONFIG variable to your *)
+ $(warning * BoardConfig.mk file *)
+ $(warning **********************************************************)
+ # $(error "NO KERNEL CONFIG")
+ else
+ #$(info Kernel source found, building it)
+ FULL_KERNEL_BUILD := true
+ KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL)
+ endif
+endif
+
+ifeq ($(FULL_KERNEL_BUILD),true)
+
+KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
+KERNEL_MODULES_INSTALL := system
+KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules
+
+TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX))
+ifeq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),)
+ifeq ($(KERNEL_TOOLCHAIN_PREFIX),)
+ ifeq ($(KERNEL_ARCH),arm64)
+ KERNEL_TOOLCHAIN_PREFIX := aarch64-linux-android-
+ else
+ KERNEL_TOOLCHAIN_PREFIX := arm-eabi-
+ endif
+endif
+else
+KERNEL_TOOLCHAIN_PREFIX := $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)
+endif
+
+ifeq ($(KERNEL_TOOLCHAIN),)
+KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN_PREFIX)
+else
+ifneq ($(KERNEL_TOOLCHAIN_PREFIX),)
+KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX)
+endif
+endif
+
+ifneq ($(USE_CCACHE),)
+ # Detect if the system already has ccache installed to use instead of the prebuilt
+ ccache := $(shell command -v ccache)
+ ifeq ($(ccache),)
+ ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache
+ endif
+ $(info Using '$(ccache)' binary on '$(HOST_PREBUILT_TAG)')
+ # Check that the executable is here.
+ ccache := $(strip $(wildcard $(ccache)))
+endif
+
+KERNEL_CROSS_COMPILE := CROSS_COMPILE="$(ccache) $(KERNEL_TOOLCHAIN_PATH)"
+ccache =
+
+define mv-modules
+ mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.order`;\
+ if [ "$$mdpath" != "" ];then\
+ mpath=`dirname $$mdpath`;\
+ ko=`find $$mpath/kernel -type f -name *.ko`;\
+ for i in $$ko; do $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $$i;\
+ mv $$i $(KERNEL_MODULES_OUT)/; done;\
+ fi
+endef
+
+define clean-module-folder
+ mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.order`;\
+ if [ "$$mdpath" != "" ];then\
+ mpath=`dirname $$mdpath`; rm -rf $$mpath;\
+ fi
+endef
+
+ifeq ($(HOST_OS),darwin)
+ MAKE_FLAGS += C_INCLUDE_PATH=$(ANDROID_BUILD_TOP)/external/elfutils/0.153/libelf/
+endif
+
+ifeq ($(TARGET_KERNEL_MODULES),)
+ TARGET_KERNEL_MODULES := no-external-modules
+endif
+
+$(KERNEL_OUT):
+ mkdir -p $(KERNEL_OUT)
+ mkdir -p $(KERNEL_MODULES_OUT)
+
+$(KERNEL_CONFIG): $(KERNEL_OUT)
+ $(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)
+ $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
+ echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
+ echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
+ $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \
+ echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \
+ cat $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG) >> $(KERNEL_OUT)/.config; \
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
+
+TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL)
+ $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE)
+ $(hide) if grep -q 'CONFIG_OF=y' $(KERNEL_CONFIG) ; \
+ then \
+ echo -e ${CL_GRN}"Building DTBs"${CL_RST} ; \
+ $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) dtbs ; \
+ else \
+ echo "DTBs not enabled" ; \
+ fi ;
+ $(hide) if grep -q 'CONFIG_MODULES=y' $(KERNEL_CONFIG) ; \
+ then \
+ echo -e ${CL_GRN}"Building Kernel Modules"${CL_RST} ; \
+ $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules && \
+ $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules_install && \
+ $(mv-modules) && \
+ $(clean-module-folder) ; \
+ else \
+ echo "Kernel Modules not enabled" ; \
+ fi ;
+
+
+$(TARGET_KERNEL_MODULES): TARGET_KERNEL_BINARIES
+
+$(TARGET_PREBUILT_INT_KERNEL): $(TARGET_KERNEL_MODULES)
+ $(mv-modules)
+ $(clean-module-folder)
+
+$(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT) $(KERNEL_CONFIG)
+ $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \
+ rm -f ../$(KERNEL_CONFIG); \
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_HEADER_DEFCONFIG); \
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) headers_install; fi
+ $(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \
+ echo "Used a different defconfig for header generation"; \
+ rm -f ../$(KERNEL_CONFIG); \
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG); fi
+ $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
+ echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
+ echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
+ $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \
+ echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \
+ cat $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG) >> $(KERNEL_OUT)/.config; \
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi
+
+kerneltags: $(KERNEL_OUT) $(KERNEL_CONFIG)
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) tags
+
+kernelconfig: $(KERNEL_OUT) $(KERNEL_CONFIG)
+ env KCONFIG_NOTIMESTAMP=true \
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) menuconfig
+ env KCONFIG_NOTIMESTAMP=true \
+ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig
+ cp $(KERNEL_OUT)/defconfig $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_DEFCONFIG)
+
+endif # FULL_KERNEL_BUILD
+
+## Install it
+
+ifeq ($(NEEDS_KERNEL_COPY),true)
+file := $(INSTALLED_KERNEL_TARGET)
+ALL_PREBUILT += $(file)
+$(file) : $(KERNEL_BIN) | $(ACP)
+ $(transform-prebuilt-to-target)
+
+ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET)
+endif