From c0c5bed2ba865e3e8fb5c8ccbe2dca70e6d2bca8 Mon Sep 17 00:00:00 2001 From: Sebastiano Barezzi Date: Tue, 9 Feb 2021 00:31:49 +0100 Subject: [PATCH] kernel: Add TARGET_FORCE_PREBUILT_KERNEL flag * TARGET_FORCE_PREBUILT_KERNEL should be useful when you don't have ready kernel sources (OEM releasing broken sources or releasing them lately) * It lets you use kernel sources for userspace generated headers (generated_kernel_headers) while keeping using prebuilt kernel * Keep in mind that generated kernel headers may not align with the ABI of kernel you're including * This commit also partially revert commit a836d79, where TARGET_KERNEL_SOURCE would have been unset if TARGET_PREBUILT_KERNEL was defined (we already check in kernel.mk if kernel sources are present anyway) Change-Id: I84acae890dabb5b9dbd48143ad58f6420c0cef75 --- build/tasks/kernel.mk | 22 ++++++++++++++++++++-- config/BoardConfigKernel.mk | 3 --- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk index efc373601..8ca693941 100644 --- a/build/tasks/kernel.mk +++ b/build/tasks/kernel.mk @@ -61,6 +61,9 @@ # modules in system instead of vendor # NEED_KERNEL_MODULE_VENDOR_OVERLAY = Optional, if true, install kernel # modules in vendor_overlay instead of vendor +# +# TARGET_FORCE_PREBUILT_KERNEL = Optional, use TARGET_PREBUILT_KERNEL even if +# kernel sources are present ifneq ($(TARGET_NO_KERNEL),true) @@ -159,8 +162,23 @@ else $(warning **********************************************************) $(error "NO KERNEL CONFIG") else - FULL_KERNEL_BUILD := true - KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL) + ifneq ($(TARGET_FORCE_PREBUILT_KERNEL),) + $(warning **********************************************************) + $(warning * Kernel source found and configuration was defined, *) + $(warning * but prebuilt kernel is being forced. *) + $(warning * While this is likely intentional, *) + $(warning * it is NOT SUPPORTED WHATSOEVER. *) + $(warning * Generated kernel headers may not align with *) + $(warning * the ABI of kernel you're including. *) + $(warning * Please unset TARGET_FORCE_PREBUILT_KERNEL *) + $(warning * to build the kernel from source. *) + $(warning **********************************************************) + FULL_KERNEL_BUILD := false + KERNEL_BIN := $(TARGET_PREBUILT_KERNEL) + else + FULL_KERNEL_BUILD := true + KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL) + endif endif endif diff --git a/config/BoardConfigKernel.mk b/config/BoardConfigKernel.mk index 43154d493..00971051c 100644 --- a/config/BoardConfigKernel.mk +++ b/config/BoardConfigKernel.mk @@ -41,9 +41,6 @@ BUILD_TOP := $(shell pwd) TARGET_AUTO_KDIR := $(shell echo $(TARGET_DEVICE_DIR) | sed -e 's/^device/kernel/g') TARGET_KERNEL_SOURCE ?= $(TARGET_AUTO_KDIR) -ifneq ($(TARGET_PREBUILT_KERNEL),) -TARGET_KERNEL_SOURCE := -endif TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH)) ifeq ($(TARGET_KERNEL_ARCH),) -- GitLab