2016-08-26 00:12:08 +02:00
|
|
|
# Copyright (C) 2012 The CyanogenMod Project
|
2019-10-15 06:56:52 +02:00
|
|
|
# (C) 2017-2020 The LineageOS Project
|
2016-08-26 00:12:08 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
# Configuration
|
|
|
|
# =============
|
|
|
|
#
|
|
|
|
# These config vars are usually set in BoardConfig.mk:
|
|
|
|
#
|
|
|
|
# TARGET_KERNEL_CONFIG = Kernel defconfig
|
|
|
|
# TARGET_KERNEL_VARIANT_CONFIG = Variant defconfig, optional
|
|
|
|
# TARGET_KERNEL_SELINUX_CONFIG = SELinux defconfig, optional
|
|
|
|
# TARGET_KERNEL_ADDITIONAL_CONFIG = Additional defconfig, optional
|
|
|
|
#
|
2017-11-27 16:09:38 +01:00
|
|
|
# TARGET_KERNEL_CLANG_COMPILE = Compile kernel with clang, defaults to false
|
|
|
|
#
|
|
|
|
# TARGET_KERNEL_CLANG_VERSION = Clang prebuilts version, optional, defaults to clang-stable
|
|
|
|
#
|
|
|
|
# TARGET_KERNEL_CLANG_PATH = Clang prebuilts path, optional
|
|
|
|
#
|
2017-01-24 22:46:13 +01:00
|
|
|
# BOARD_KERNEL_IMAGE_NAME = Built image name
|
|
|
|
# for ARM use: zImage
|
|
|
|
# for ARM64 use: Image.gz
|
|
|
|
# for uncompressed use: Image
|
|
|
|
# If using an appended DT, append '-dtb'
|
|
|
|
# to the end of the image name.
|
|
|
|
# For example, for ARM devices,
|
|
|
|
# use zImage-dtb instead of zImage.
|
2016-08-26 00:12:08 +02:00
|
|
|
#
|
2017-11-27 16:09:38 +01:00
|
|
|
# KERNEL_CC = The C Compiler used. This is automatically set based
|
|
|
|
# on whether the clang version is set, optional.
|
2020-04-03 18:58:16 +02:00
|
|
|
# KERNEL_LD = The Linker used. This is automatically set based
|
|
|
|
# on whether the clang/gcc version is set, optional.
|
2017-11-27 16:09:38 +01:00
|
|
|
#
|
|
|
|
# KERNEL_CLANG_TRIPLE = Target triple for clang (e.g. aarch64-linux-gnu-)
|
|
|
|
# defaults to arm-linux-gnu- for arm
|
|
|
|
# aarch64-linux-gnu- for arm64
|
|
|
|
# x86_64-linux-gnu- for x86
|
|
|
|
#
|
2016-08-26 00:12:08 +02:00
|
|
|
# NEED_KERNEL_MODULE_ROOT = Optional, if true, install kernel
|
2018-07-11 00:35:33 +02:00
|
|
|
# modules in root instead of vendor
|
|
|
|
# NEED_KERNEL_MODULE_SYSTEM = Optional, if true, install kernel
|
|
|
|
# modules in system instead of vendor
|
2020-08-01 17:24:29 +02:00
|
|
|
# NEED_KERNEL_MODULE_VENDOR_OVERLAY = Optional, if true, install kernel
|
|
|
|
# modules in vendor_overlay instead of vendor
|
2016-08-26 00:12:08 +02:00
|
|
|
|
2017-12-08 20:46:30 +01:00
|
|
|
ifneq ($(TARGET_NO_KERNEL),true)
|
2016-08-26 00:12:08 +02:00
|
|
|
|
|
|
|
## Externally influenced variables
|
|
|
|
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
|
2019-10-15 06:56:52 +02:00
|
|
|
DTC := $(HOST_OUT_EXECUTABLES)/dtc
|
2019-10-14 01:59:57 +02:00
|
|
|
DTBS_OUT := $(PRODUCT_OUT)/dtbs
|
2016-08-26 00:12:08 +02:00
|
|
|
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
|
|
|
|
KERNEL_CONFIG := $(KERNEL_OUT)/.config
|
2019-07-12 12:55:35 +02:00
|
|
|
KERNEL_RELEASE := $(KERNEL_OUT)/include/config/kernel.release
|
2016-08-26 00:12:08 +02:00
|
|
|
|
|
|
|
ifeq ($(KERNEL_ARCH),x86_64)
|
|
|
|
KERNEL_DEFCONFIG_ARCH := x86
|
|
|
|
else
|
|
|
|
KERNEL_DEFCONFIG_ARCH := $(KERNEL_ARCH)
|
|
|
|
endif
|
2019-09-12 11:37:45 +02:00
|
|
|
KERNEL_DEFCONFIG_DIR := $(KERNEL_SRC)/arch/$(KERNEL_DEFCONFIG_ARCH)/configs
|
|
|
|
KERNEL_DEFCONFIG_SRC := $(KERNEL_DEFCONFIG_DIR)/$(KERNEL_DEFCONFIG)
|
2016-08-26 00:12:08 +02:00
|
|
|
|
|
|
|
ifneq ($(TARGET_KERNEL_ADDITIONAL_CONFIG),)
|
|
|
|
KERNEL_ADDITIONAL_CONFIG := $(TARGET_KERNEL_ADDITIONAL_CONFIG)
|
2019-09-12 11:37:45 +02:00
|
|
|
KERNEL_ADDITIONAL_CONFIG_SRC := $(KERNEL_DEFCONFIG_DIR)/$(KERNEL_ADDITIONAL_CONFIG)
|
2016-08-26 00:12:08 +02:00
|
|
|
ifeq ("$(wildcard $(KERNEL_ADDITIONAL_CONFIG_SRC))","")
|
|
|
|
$(warning TARGET_KERNEL_ADDITIONAL_CONFIG '$(TARGET_KERNEL_ADDITIONAL_CONFIG)' doesn't exist)
|
|
|
|
KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
|
|
|
|
endif
|
|
|
|
|
2019-09-12 11:37:45 +02:00
|
|
|
ifeq ($(BOARD_KERNEL_IMAGE_NAME),)
|
|
|
|
$(error BOARD_KERNEL_IMAGE_NAME not defined.)
|
|
|
|
endif
|
|
|
|
TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(BOARD_KERNEL_IMAGE_NAME)
|
|
|
|
|
2016-08-26 00:12:08 +02:00
|
|
|
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 *)
|
2020-04-17 19:13:20 +02:00
|
|
|
$(warning * THIS IS DEPRECATED, AND IS NOT ADVISED. *)
|
2016-08-26 00:12:08 +02:00
|
|
|
$(warning * Please configure your device to download the kernel *)
|
|
|
|
$(warning * source repository to $(KERNEL_SRC))
|
|
|
|
$(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 **********************************************************)
|
2020-08-03 11:32:19 +02:00
|
|
|
$(error "NO KERNEL CONFIG")
|
2016-08-26 00:12:08 +02:00
|
|
|
else
|
|
|
|
FULL_KERNEL_BUILD := true
|
|
|
|
KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(FULL_KERNEL_BUILD),true)
|
|
|
|
|
|
|
|
ifeq ($(NEED_KERNEL_MODULE_ROOT),true)
|
2019-02-10 00:15:11 +01:00
|
|
|
KERNEL_MODULES_OUT := $(TARGET_ROOT_OUT)
|
2019-09-10 17:44:55 +02:00
|
|
|
KERNEL_DEPMOD_STAGING_DIR := $(KERNEL_BUILD_OUT_PREFIX)$(call intermediates-dir-for,PACKAGING,depmod_recovery)
|
2017-12-04 08:59:48 +01:00
|
|
|
KERNEL_MODULE_MOUNTPOINT :=
|
2018-07-11 00:35:33 +02:00
|
|
|
else ifeq ($(NEED_KERNEL_MODULE_SYSTEM),true)
|
2019-02-10 00:15:11 +01:00
|
|
|
KERNEL_MODULES_OUT := $(TARGET_OUT)
|
2019-09-10 17:44:55 +02:00
|
|
|
KERNEL_DEPMOD_STAGING_DIR := $(KERNEL_BUILD_OUT_PREFIX)$(call intermediates-dir-for,PACKAGING,depmod_system)
|
2018-07-11 00:35:33 +02:00
|
|
|
KERNEL_MODULE_MOUNTPOINT := system
|
2020-08-01 17:24:29 +02:00
|
|
|
else ifeq ($(NEED_KERNEL_MODULE_VENDOR_OVERLAY),true)
|
|
|
|
KERNEL_MODULES_OUT := $(TARGET_OUT_PRODUCT)/vendor_overlay/$(PRODUCT_TARGET_VNDK_VERSION)
|
|
|
|
KERNEL_DEPMOD_STAGING_DIR := $(KERNEL_BUILD_OUT_PREFIX)$(call intermediates-dir-for,PACKAGING,depmod_product)
|
|
|
|
KERNEL_MODULE_MOUNTPOINT := vendor
|
|
|
|
$(INSTALLED_PRODUCTIMAGE_TARGET): $(TARGET_PREBUILT_INT_KERNEL)
|
2016-08-26 00:12:08 +02:00
|
|
|
else
|
2019-02-10 00:15:11 +01:00
|
|
|
KERNEL_MODULES_OUT := $(TARGET_OUT_VENDOR)
|
2019-09-10 17:44:55 +02:00
|
|
|
KERNEL_DEPMOD_STAGING_DIR := $(KERNEL_BUILD_OUT_PREFIX)$(call intermediates-dir-for,PACKAGING,depmod_vendor)
|
2017-12-04 08:59:48 +01:00
|
|
|
KERNEL_MODULE_MOUNTPOINT := vendor
|
2016-08-26 00:12:08 +02:00
|
|
|
endif
|
2019-09-10 17:44:55 +02:00
|
|
|
MODULES_INTERMEDIATES := $(KERNEL_BUILD_OUT_PREFIX)$(call intermediates-dir-for,PACKAGING,kernel_modules)
|
2016-08-26 00:12:08 +02:00
|
|
|
|
2019-10-15 06:56:52 +02:00
|
|
|
# Add host bin out dir to path
|
|
|
|
PATH_OVERRIDE := PATH=$(KERNEL_BUILD_OUT_PREFIX)$(HOST_OUT_EXECUTABLES):$$PATH
|
2017-11-27 16:09:38 +01:00
|
|
|
ifeq ($(TARGET_KERNEL_CLANG_COMPILE),true)
|
|
|
|
ifneq ($(TARGET_KERNEL_CLANG_VERSION),)
|
2019-09-14 16:26:26 +02:00
|
|
|
KERNEL_CLANG_VERSION := clang-$(TARGET_KERNEL_CLANG_VERSION)
|
2017-11-27 16:09:38 +01:00
|
|
|
else
|
2018-04-12 01:23:19 +02:00
|
|
|
# Use the default version of clang if TARGET_KERNEL_CLANG_VERSION hasn't been set by the device config
|
|
|
|
KERNEL_CLANG_VERSION := $(LLVM_PREBUILTS_VERSION)
|
2017-11-27 16:09:38 +01:00
|
|
|
endif
|
2019-09-10 17:38:34 +02:00
|
|
|
TARGET_KERNEL_CLANG_PATH ?= $(BUILD_TOP)/prebuilts/clang/host/$(HOST_OS)-x86/$(KERNEL_CLANG_VERSION)
|
2017-11-27 16:09:38 +01:00
|
|
|
ifeq ($(KERNEL_ARCH),arm64)
|
|
|
|
KERNEL_CLANG_TRIPLE ?= CLANG_TRIPLE=aarch64-linux-gnu-
|
|
|
|
else ifeq ($(KERNEL_ARCH),arm)
|
|
|
|
KERNEL_CLANG_TRIPLE ?= CLANG_TRIPLE=arm-linux-gnu-
|
|
|
|
else ifeq ($(KERNEL_ARCH),x86)
|
|
|
|
KERNEL_CLANG_TRIPLE ?= CLANG_TRIPLE=x86_64-linux-gnu-
|
|
|
|
endif
|
2019-09-12 11:37:45 +02:00
|
|
|
PATH_OVERRIDE += PATH=$(TARGET_KERNEL_CLANG_PATH)/bin:$$PATH LD_LIBRARY_PATH=$(TARGET_KERNEL_CLANG_PATH)/lib64:$$LD_LIBRARY_PATH
|
2018-02-19 05:13:05 +01:00
|
|
|
ifeq ($(KERNEL_CC),)
|
2018-10-22 04:07:47 +02:00
|
|
|
KERNEL_CC := CC="$(CCACHE_BIN) clang"
|
2018-02-19 05:13:05 +01:00
|
|
|
endif
|
2020-04-03 18:58:16 +02:00
|
|
|
ifeq ($(KERNEL_LD),)
|
|
|
|
KERNEL_LD :=
|
|
|
|
endif
|
2016-08-26 00:12:08 +02:00
|
|
|
endif
|
|
|
|
|
2019-09-12 11:37:45 +02:00
|
|
|
ifneq ($(TARGET_KERNEL_MODULES),)
|
|
|
|
$(error TARGET_KERNEL_MODULES is no longer supported!)
|
2016-08-26 00:12:08 +02:00
|
|
|
endif
|
|
|
|
|
2019-09-24 17:22:39 +02:00
|
|
|
PATH_OVERRIDE += PATH=$(KERNEL_TOOLCHAIN_PATH_gcc)/bin:$$PATH
|
2019-09-10 17:38:34 +02:00
|
|
|
|
2019-09-06 19:44:50 +02:00
|
|
|
# System tools are no longer allowed on 10+
|
|
|
|
PATH_OVERRIDE += $(TOOLS_PATH_OVERRIDE)
|
|
|
|
|
2016-08-26 00:12:08 +02:00
|
|
|
KERNEL_ADDITIONAL_CONFIG_OUT := $(KERNEL_OUT)/.additional_config
|
|
|
|
|
2019-02-10 01:26:51 +01:00
|
|
|
# Internal implementation of make-kernel-target
|
|
|
|
# $(1): output path (The value passed to O=)
|
|
|
|
# $(2): target to build (eg. defconfig, modules, dtbo.img)
|
|
|
|
define internal-make-kernel-target
|
2020-04-03 18:58:16 +02:00
|
|
|
$(PATH_OVERRIDE) $(KERNEL_MAKE_CMD) $(KERNEL_MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_BUILD_OUT_PREFIX)$(1) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_CLANG_TRIPLE) $(KERNEL_CC) $(KERNEL_LD) $(2)
|
2019-02-10 01:26:51 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
# Make a kernel target
|
|
|
|
# $(1): The kernel target to build (eg. defconfig, modules, modules_install)
|
|
|
|
define make-kernel-target
|
|
|
|
$(call internal-make-kernel-target,$(KERNEL_OUT),$(1))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Make a DTBO target
|
|
|
|
# $(1): The DTBO target to build (eg. dtbo.img, defconfig)
|
|
|
|
define make-dtbo-target
|
|
|
|
$(call internal-make-kernel-target,$(PRODUCT_OUT)/dtbo,$(1))
|
|
|
|
endef
|
|
|
|
|
2019-09-28 05:37:14 +02:00
|
|
|
# Make a DTB targets
|
|
|
|
# $(1): The DTB target to build (eg. dtbs, defconfig)
|
|
|
|
define make-dtb-target
|
2019-10-14 01:59:57 +02:00
|
|
|
$(call internal-make-kernel-target,$(DTBS_OUT),$(1))
|
2019-09-28 05:37:14 +02:00
|
|
|
endef
|
|
|
|
|
2019-09-12 11:37:45 +02:00
|
|
|
$(KERNEL_OUT):
|
|
|
|
mkdir -p $(KERNEL_OUT)
|
|
|
|
|
|
|
|
$(KERNEL_ADDITIONAL_CONFIG_OUT): $(KERNEL_OUT)
|
2016-08-26 00:12:08 +02:00
|
|
|
$(hide) cmp -s $(KERNEL_ADDITIONAL_CONFIG_SRC) $@ || cp $(KERNEL_ADDITIONAL_CONFIG_SRC) $@;
|
|
|
|
|
2017-11-09 21:02:33 +01:00
|
|
|
$(KERNEL_CONFIG): $(KERNEL_DEFCONFIG_SRC) $(KERNEL_ADDITIONAL_CONFIG_OUT)
|
2016-08-26 00:12:08 +02:00
|
|
|
@echo "Building Kernel Config"
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG))
|
2016-08-26 00:12:08 +02:00
|
|
|
$(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
|
|
|
|
echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
|
|
|
|
echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,oldconfig); \
|
|
|
|
fi
|
2016-10-01 18:56:52 +02:00
|
|
|
# Create defconfig build artifact
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,savedefconfig)
|
2016-08-26 00:12:08 +02:00
|
|
|
$(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \
|
|
|
|
echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \
|
|
|
|
$(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig); \
|
|
|
|
fi
|
2016-08-26 00:12:08 +02:00
|
|
|
|
2019-10-15 06:56:52 +02:00
|
|
|
$(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_CONFIG) $(DEPMOD) $(DTC)
|
|
|
|
@echo "Building Kernel Image ($(BOARD_KERNEL_IMAGE_NAME))"
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,$(BOARD_KERNEL_IMAGE_NAME))
|
2017-11-10 01:00:18 +01:00
|
|
|
$(hide) if grep -q '^CONFIG_OF=y' $(KERNEL_CONFIG); then \
|
|
|
|
echo "Building DTBs"; \
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,dtbs); \
|
2017-11-10 01:00:18 +01:00
|
|
|
fi
|
2019-02-10 06:05:01 +01:00
|
|
|
$(hide) if grep -q '=m' $(KERNEL_CONFIG); then \
|
2017-11-10 01:00:18 +01:00
|
|
|
echo "Building Kernel Modules"; \
|
2019-09-12 11:37:45 +02:00
|
|
|
$(call make-kernel-target,modules) || exit "$$?"; \
|
2017-11-10 01:00:18 +01:00
|
|
|
echo "Installing Kernel Modules"; \
|
2019-09-12 11:37:45 +02:00
|
|
|
$(call make-kernel-target,INSTALL_MOD_PATH=$(MODULES_INTERMEDIATES) INSTALL_MOD_STRIP=1 modules_install); \
|
2019-07-12 12:55:35 +02:00
|
|
|
kernel_release=$$(cat $(KERNEL_RELEASE)) \
|
2020-08-01 21:20:23 +02:00
|
|
|
kernel_modules_dir=$(MODULES_INTERMEDIATES)/lib/modules/$$kernel_release \
|
|
|
|
$(foreach s, $(TARGET_MODULE_ALIASES),\
|
|
|
|
$(eval p := $(subst :,$(space),$(s))) \
|
|
|
|
; mv $$(find $$kernel_modules_dir -name $(word 1,$(p))) $$kernel_modules_dir/$(word 2,$(p))); \
|
|
|
|
modules=$$(find $$kernel_modules_dir -type f -name '*.ko'); \
|
2019-05-02 09:31:30 +02:00
|
|
|
($(call build-image-kernel-modules,$$modules,$(KERNEL_MODULES_OUT),$(KERNEL_MODULE_MOUNTPOINT)/,$(KERNEL_DEPMOD_STAGING_DIR))); \
|
2017-11-10 01:00:18 +01:00
|
|
|
fi
|
2016-08-26 00:12:08 +02:00
|
|
|
|
2017-11-09 21:02:33 +01:00
|
|
|
.PHONY: kerneltags
|
|
|
|
kerneltags: $(KERNEL_CONFIG)
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,tags)
|
2016-08-26 00:12:08 +02:00
|
|
|
|
2018-10-06 21:12:10 +02:00
|
|
|
.PHONY: kernelsavedefconfig alldefconfig
|
2016-08-26 00:12:08 +02:00
|
|
|
|
2019-09-12 11:37:45 +02:00
|
|
|
kernelsavedefconfig: $(KERNEL_OUT)
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,$(KERNEL_DEFCONFIG))
|
2017-07-12 19:56:35 +02:00
|
|
|
env KCONFIG_NOTIMESTAMP=true \
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,savedefconfig)
|
2017-07-12 19:56:35 +02:00
|
|
|
cp $(KERNEL_OUT)/defconfig $(KERNEL_DEFCONFIG_SRC)
|
|
|
|
|
2019-09-12 11:37:45 +02:00
|
|
|
alldefconfig: $(KERNEL_OUT)
|
2016-08-26 00:12:08 +02:00
|
|
|
env KCONFIG_NOTIMESTAMP=true \
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-kernel-target,alldefconfig)
|
2016-08-26 00:12:08 +02:00
|
|
|
|
2019-05-16 23:01:19 +02:00
|
|
|
ifeq ($(TARGET_NEEDS_DTBOIMAGE),true)
|
2019-10-15 06:56:52 +02:00
|
|
|
MKDTIMG := $(HOST_OUT_EXECUTABLES)/mkdtimg$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
MKDTBOIMG := $(HOST_OUT_EXECUTABLES)/mkdtboimg.py$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
$(BOARD_PREBUILT_DTBOIMAGE): $(DTC) $(MKDTIMG) $(MKDTBOIMG)
|
2017-11-25 16:52:17 +01:00
|
|
|
echo -e ${CL_GRN}"Building DTBO.img"${CL_RST}
|
2019-02-10 01:26:51 +01:00
|
|
|
$(call make-dtbo-target,$(KERNEL_DEFCONFIG))
|
|
|
|
$(call make-dtbo-target,dtbo.img)
|
2019-05-16 23:01:19 +02:00
|
|
|
endif # TARGET_NEEDS_DTBOIMAGE
|
2017-11-25 16:52:17 +01:00
|
|
|
|
2019-02-10 21:12:50 +01:00
|
|
|
endif # FULL_KERNEL_BUILD
|
|
|
|
|
2016-08-26 00:12:08 +02:00
|
|
|
## 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
|
|
|
|
|
2019-05-16 23:01:19 +02:00
|
|
|
INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
|
2017-11-25 16:52:17 +01:00
|
|
|
ALL_PREBUILT += $(INSTALLED_DTBOIMAGE_TARGET)
|
|
|
|
|
2016-08-26 00:12:08 +02:00
|
|
|
.PHONY: kernel
|
2019-09-12 11:37:45 +02:00
|
|
|
kernel: $(INSTALLED_KERNEL_TARGET)
|
2017-12-08 20:46:30 +01:00
|
|
|
|
2019-05-16 23:01:19 +02:00
|
|
|
.PHONY: dtboimage
|
|
|
|
dtboimage: $(INSTALLED_DTBOIMAGE_TARGET)
|
2017-11-25 16:52:17 +01:00
|
|
|
|
2019-09-28 05:37:14 +02:00
|
|
|
ifeq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
|
2019-11-20 21:22:57 +01:00
|
|
|
ifeq ($(BOARD_PREBUILT_DTBIMAGE_DIR),)
|
2019-10-15 06:56:52 +02:00
|
|
|
$(INSTALLED_DTBIMAGE_TARGET): $(DTC)
|
2019-09-28 05:37:14 +02:00
|
|
|
echo -e ${CL_GRN}"Building DTBs"${CL_RST}
|
|
|
|
$(call make-dtb-target,$(KERNEL_DEFCONFIG))
|
|
|
|
$(call make-dtb-target,dtbs)
|
2019-10-07 20:42:30 +02:00
|
|
|
cat $(shell find $(DTBS_OUT)/arch/$(KERNEL_ARCH)/boot/dts/** -type f -name "*.dtb" | sort) > $@
|
2019-11-20 21:22:57 +01:00
|
|
|
endif
|
2019-09-28 05:37:14 +02:00
|
|
|
.PHONY: dtbimage
|
|
|
|
dtbimage: $(INSTALLED_DTBIMAGE_TARGET)
|
|
|
|
endif # BOARD_INCLUDE_DTB_IN_BOOTIMG
|
|
|
|
|
2017-12-08 20:46:30 +01:00
|
|
|
endif # TARGET_NO_KERNEL
|