endif
ifeq ($(INSTALLED_KERNEL_TARGET),)
+KERNEL_OBJECTS := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
BOARD_PREBUILT_DTBOIMAGE := $(PRODUCT_OUT)/prebuilt_dtbo.img
ifeq ($(TARGET_PREBUILT_KERNEL),)
-TARGET_KERNEL_SOURCE := kernel/$(TARGET_KERNEL)
-KERNEL_CONFIG := $(TARGET_KERNEL_SOURCE)/.config
-KERNEL_BOOT := $(TARGET_KERNEL_SOURCE)/arch/$(KERNEL_ARCH)/boot
+KERNEL_CONFIG := $(KERNEL_OBJECTS)/.config
+KERNEL_BOOT := $(KERNEL_OBJECTS)/arch/$(KERNEL_ARCH)/boot
KERNEL_BIN := $(KERNEL_BOOT)/Image
KERNEL_DTB_DIR := $(KERNEL_BOOT)/dts/exynos
KERNEL_DTB := $(KERNEL_DTB_DIR)/exynos9610.dtb
-KERNEL_DTBO_CFG := $(KERNEL_DTB_DIR)/exynos9610_dtboimg.cfg
MKDTIMG := $(HOST_OUT_EXECUTABLES)/mkdtimg
+TARGET_KERNEL_SOURCE := kernel/$(TARGET_KERNEL)
+KERNEL_DTB_SOURCE_DIR := $(TARGET_KERNEL_SOURCE)/arch/$(KERNEL_ARCH)/boot/dts/exynos
+KERNEL_DTBO_CFG := $(KERNEL_DTB_SOURCE_DIR)/exynos9610_dtboimg.cfg
KERNEL_MERGE_CONFIG := $(TARGET_KERNEL_SOURCE)/scripts/kconfig/merge_config.sh
KERNEL_CONFIG_BASE := $(TARGET_KERNEL_SOURCE)/arch/$(KERNEL_ARCH)/configs
KERNEL_DEFCONFIG_PATH := $(KERNEL_CONFIG_BASE)/$(KERNEL_DEFCONFIG)
else
ifeq ($(TARGET_BUILD_VARIANT),eng)
-MAKE_CONFIG_CMD := $(MAKE) -C $(TARGET_KERNEL_SOURCE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG)
+MAKE_CONFIG_CMD := $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(PWD)/$(KERNEL_OBJECTS) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG)
else
ifeq ($(TARGET_BUILD_VARIANT),userdebug)
KERNEL_USER_CFG := $(KERNEL_CONFIG_BASE)/$(TARGET_SOC)_userdebug.cfg
KERNEL_USER_CFG := $(KERNEL_CONFIG_BASE)/$(TARGET_SOC)_user.cfg
endif
MAKE_CONFIG_CMD := ARCH=$(KERNEL_ARCH) $(KERNEL_MERGE_CONFIG) -m -O $(TARGET_KERNEL_SOURCE) $(KERNEL_DEFCONFIG_PATH) $(KERNEL_USER_CFG);
-MAKE_CONFIG_CMD += $(MAKE) -C $(TARGET_KERNEL_SOURCE) ARCH=$(KERNEL_ARCH) KCONFIG_ALLCONFIG=.config alldefconfig
+MAKE_CONFIG_CMD += $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(PWD)/$(KERNEL_OBJECTS) ARCH=$(KERNEL_ARCH) KCONFIG_ALLCONFIG=.config alldefconfig;
+MAKE_CONFIG_CMD += $(MAKE) -C $(TARGET_KERNEL_SOURCE) distclean
endif
ifeq ($(N_KERNEL_BUILD_THREAD),)
$(KERNEL_BIN): $(KERNEL_CONFIG)
$(hide) echo "Building kernel..."
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) CLANG_TRIPLE=$(CLANG_TRIPLE) CC=$(CC) -j$(N_KERNEL_BUILD_THREAD)
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(PWD)/$(KERNEL_OBJECTS) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) CLANG_TRIPLE=$(CLANG_TRIPLE) CC=$(CC) -j$(N_KERNEL_BUILD_THREAD)
$(INSTALLED_KERNEL_TARGET): $(INSTALLED_DTBOIMAGE_TARGET)
cp $(KERNEL_BIN) $(INSTALLED_KERNEL_TARGET)
$(BOARD_PREBUILT_DTBOIMAGE): $(MKDTIMG) $(KERNEL_DTBO_CFG) $(KERNEL_BIN)
$(hide) echo "Building DTBOIMAGE..."
- ln -sf $(TARGET_KERNEL_SOURCE)/arch
- $(MKDTIMG) cfg_create $@ $(KERNEL_DTBO_CFG)
- rm -f arch
+ $(MKDTIMG) cfg_create $@ $(KERNEL_DTBO_CFG) -d $(KERNEL_OBJECTS)
endif #TARGET_PREBUILT_KERNEL
endif #KERNEL_DEFCONFIG
# That's our default target when none is given on the command line
PHONY := _all
_all:
- @lib/libdss-build.sh
# o Do not use make's built-in rules and variables
# (this increases performance and avoids hard-to-debug behaviour);
sub-make:
$(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
-f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
+ @lib/libdss-build.sh $(KBUILD_OUTPUT)/
# Leave processing to above invocation of make
skip-makefile := 1
# command line.
# This allow a user to issue only 'make' to build a kernel including modules
# Defaults to vmlinux, but the arch makefile usually adds further targets
+ifneq ($(O),)
+all: vmlinux
+else
all: vmlinux
+ @lib/libdss-build.sh
+endif
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)