| # SPDX-License-Identifier: GPL-2.0 |
| # Copyright (C) 2019 MediaTek Inc. |
| |
| LOCAL_PATH := $(call my-dir) |
| |
| ifeq ($(notdir $(LOCAL_PATH)),$(strip $(LINUX_KERNEL_VERSION))) |
| ifneq ($(strip $(TARGET_NO_KERNEL)),true) |
| |
| include $(LOCAL_PATH)/kenv.mk |
| include $(LOCAL_PATH)/kernel_modules.mk |
| |
| ifeq ($(wildcard $(TARGET_PREBUILT_KERNEL)),) |
| KERNEL_MAKE_DEPENDENCIES := $(shell find $(KERNEL_DIR) -name .git -prune -o -type f | sort) |
| |
| $(TARGET_KERNEL_CONFIG): PRIVATE_DIR := $(KERNEL_DIR) |
| $(TARGET_KERNEL_CONFIG): $(KERNEL_CONFIG_FILE) $(LOCAL_PATH)/Android.mk |
| $(TARGET_KERNEL_CONFIG): $(KERNEL_MAKE_DEPENDENCIES) |
| $(hide) mkdir -p $(dir $@) |
| $(PREBUILT_MAKE_PREFIX)$(MAKE) -C $(PRIVATE_DIR) $(KERNEL_MAKE_OPTION) $(KERNEL_DEFCONFIG) |
| |
| .KATI_RESTAT: $(KERNEL_ZIMAGE_OUT) |
| $(KERNEL_ZIMAGE_OUT): PRIVATE_DIR := $(KERNEL_DIR) |
| $(KERNEL_ZIMAGE_OUT): $(TARGET_KERNEL_CONFIG) $(KERNEL_MAKE_DEPENDENCIES) |
| $(hide) mkdir -p $(dir $@) |
| $(PREBUILT_MAKE_PREFIX)$(MAKE) -C $(PRIVATE_DIR) $(KERNEL_MAKE_OPTION) |
| $(hide) $(call fixup-kernel-cmd-file,$(KERNEL_OUT)/arch/$(KERNEL_TARGET_ARCH)/boot/compressed/.piggy.xzkern.cmd) |
| cat $(IMAGE_GZ_PATH) $(MTK_APPEND_DTB_PATH) > $(MTK_IMAGE_GZ_DTB_PATH) |
| |
| $(BUILT_KERNEL_TARGET): $(KERNEL_ZIMAGE_OUT) $(TARGET_KERNEL_CONFIG) $(LOCAL_PATH)/Android.mk | $(ACP) |
| $(copy-file-to-target) |
| |
| $(TARGET_PREBUILT_KERNEL): $(BUILT_KERNEL_TARGET) $(LOCAL_PATH)/Android.mk | $(ACP) |
| $(copy-file-to-new-target) |
| |
| endif #TARGET_PREBUILT_KERNEL is empty |
| |
| $(INSTALLED_KERNEL_TARGET): $(BUILT_KERNEL_TARGET) $(LOCAL_PATH)/Android.mk | $(ACP) |
| $(copy-file-to-target) |
| |
| .PHONY: kernel save-kernel kernel-savedefconfig kernel-menuconfig menuconfig-kernel savedefconfig-kernel clean-kernel |
| kernel: $(INSTALLED_KERNEL_TARGET) |
| save-kernel: $(TARGET_PREBUILT_KERNEL) |
| |
| kernel-savedefconfig: $(TARGET_KERNEL_CONFIG) |
| cp $(TARGET_KERNEL_CONFIG) $(KERNEL_CONFIG_FILE) |
| |
| kernel-menuconfig: |
| $(hide) mkdir -p $(KERNEL_OUT) |
| $(MAKE) -C $(KERNEL_DIR) $(KERNEL_MAKE_OPTION) menuconfig |
| |
| menuconfig-kernel savedefconfig-kernel: |
| $(hide) mkdir -p $(KERNEL_OUT) |
| $(MAKE) -C $(KERNEL_DIR) $(KERNEL_MAKE_OPTION) $(patsubst %config-kernel,%config,$@) |
| |
| clean-kernel: |
| $(hide) rm -rf $(KERNEL_OUT) $(INSTALLED_KERNEL_TARGET) |
| |
| endif #TARGET_NO_KERNEL |
| endif #LINUX_KERNEL_VERSION |