Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 1 | #Android makefile to build kernel as a part of Android Build |
| 2 | PERL = perl |
| 3 | |
| 4 | KERNEL_TARGET := $(strip $(INSTALLED_KERNEL_TARGET)) |
| 5 | ifeq ($(KERNEL_TARGET),) |
| 6 | INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel |
| 7 | endif |
| 8 | |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 9 | INSTALLED_KERNEL_VM_TARGET := $(PRODUCT_OUT)/kernel_vm |
| 10 | |
Puja Gupta | e5df4f3 | 2017-02-24 14:21:40 -0800 | [diff] [blame] | 11 | TARGET_KERNEL_MAKE_ENV := $(strip $(TARGET_KERNEL_MAKE_ENV)) |
| 12 | ifeq ($(TARGET_KERNEL_MAKE_ENV),) |
| 13 | KERNEL_MAKE_ENV := |
| 14 | else |
| 15 | KERNEL_MAKE_ENV := $(TARGET_KERNEL_MAKE_ENV) |
| 16 | endif |
| 17 | |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 18 | TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH)) |
| 19 | ifeq ($(TARGET_KERNEL_ARCH),) |
| 20 | KERNEL_ARCH := arm |
| 21 | else |
| 22 | KERNEL_ARCH := $(TARGET_KERNEL_ARCH) |
| 23 | endif |
| 24 | |
| 25 | TARGET_KERNEL_HEADER_ARCH := $(strip $(TARGET_KERNEL_HEADER_ARCH)) |
| 26 | ifeq ($(TARGET_KERNEL_HEADER_ARCH),) |
| 27 | KERNEL_HEADER_ARCH := $(KERNEL_ARCH) |
| 28 | else |
| 29 | $(warning Forcing kernel header generation only for '$(TARGET_KERNEL_HEADER_ARCH)') |
| 30 | KERNEL_HEADER_ARCH := $(TARGET_KERNEL_HEADER_ARCH) |
| 31 | endif |
| 32 | |
| 33 | KERNEL_HEADER_DEFCONFIG := $(strip $(KERNEL_HEADER_DEFCONFIG)) |
| 34 | ifeq ($(KERNEL_HEADER_DEFCONFIG),) |
| 35 | KERNEL_HEADER_DEFCONFIG := $(KERNEL_DEFCONFIG) |
| 36 | endif |
| 37 | |
| 38 | # Force 32-bit binder IPC for 64bit kernel with 32bit userspace |
| 39 | ifeq ($(KERNEL_ARCH),arm64) |
| 40 | ifeq ($(TARGET_ARCH),arm) |
| 41 | KERNEL_CONFIG_OVERRIDE := CONFIG_ANDROID_BINDER_IPC_32BIT=y |
| 42 | endif |
| 43 | endif |
| 44 | |
| 45 | TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)) |
| 46 | ifeq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),) |
| 47 | KERNEL_CROSS_COMPILE := arm-eabi- |
| 48 | else |
Mukesh Ojha | 72378c44 | 2018-11-23 16:32:02 +0530 | [diff] [blame] | 49 | KERNEL_CROSS_COMPILE := $(TARGET_KERNEL_CROSS_COMPILE_PREFIX) |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 50 | endif |
| 51 | |
Raghavendra Rao Ananta | cea6fa8 | 2018-04-16 19:14:44 -0700 | [diff] [blame] | 52 | ifeq ($(KERNEL_LLVM_SUPPORT), true) |
| 53 | ifeq ($(KERNEL_SD_LLVM_SUPPORT), true) #Using sd-llvm compiler |
Raghavendra Rao Ananta | 4b0f86a | 2018-04-17 16:50:06 -0700 | [diff] [blame^] | 54 | ifeq ($(shell echo $(SDCLANG_PATH) | head -c 1),/) |
| 55 | KERNEL_LLVM_BIN := $(SDCLANG_PATH)/clang |
Raghavendra Rao Ananta | cea6fa8 | 2018-04-16 19:14:44 -0700 | [diff] [blame] | 56 | else |
Raghavendra Rao Ananta | 4b0f86a | 2018-04-17 16:50:06 -0700 | [diff] [blame^] | 57 | KERNEL_LLVM_BIN := $(ANDROID_BUILD_TOP)/$(SDCLANG_PATH)/clang |
Raghavendra Rao Ananta | cea6fa8 | 2018-04-16 19:14:44 -0700 | [diff] [blame] | 58 | endif |
| 59 | $(warning "Using sdllvm" $(KERNEL_LLVM_BIN)) |
| 60 | else |
| 61 | KERNEL_LLVM_BIN := $(ANDROID_BUILD_TOP)/$(CLANG) #Using aosp-llvm compiler |
| 62 | $(warning "Using aosp-llvm" $(KERNEL_LLVM_BIN)) |
| 63 | endif |
| 64 | endif |
| 65 | |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 66 | ifeq ($(TARGET_PREBUILT_KERNEL),) |
| 67 | |
| 68 | KERNEL_GCC_NOANDROID_CHK := $(shell (echo "int main() {return 0;}" | $(KERNEL_CROSS_COMPILE)gcc -E -mno-android - > /dev/null 2>&1 ; echo $$?)) |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 69 | |
| 70 | real_cc := |
| 71 | ifeq ($(KERNEL_LLVM_SUPPORT),true) |
| 72 | real_cc := REAL_CC=$(KERNEL_LLVM_BIN) CLANG_TRIPLE=aarch64-linux-gnu- |
| 73 | else |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 74 | ifeq ($(strip $(KERNEL_GCC_NOANDROID_CHK)),0) |
| 75 | KERNEL_CFLAGS := KCFLAGS=-mno-android |
| 76 | endif |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 77 | endif |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 78 | |
| 79 | mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) |
| 80 | current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path)))) |
| 81 | TARGET_KERNEL := msm-$(TARGET_KERNEL_VERSION) |
| 82 | ifeq ($(TARGET_KERNEL),$(current_dir)) |
| 83 | # New style, kernel/msm-version |
| 84 | BUILD_ROOT_LOC := ../../ |
| 85 | TARGET_KERNEL_SOURCE := kernel/$(TARGET_KERNEL) |
| 86 | KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/kernel/$(TARGET_KERNEL) |
| 87 | KERNEL_SYMLINK := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ |
| 88 | KERNEL_USR := $(KERNEL_SYMLINK)/usr |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 89 | KERNEL_VM_OUT := $(TARGET_OUT_INTERMEDIATES)/kernel_vm/$(TARGET_KERNEL) |
| 90 | KERNEL_VM_SYMLINK := $(TARGET_OUT_INTERMEDIATES)/KERNEL_VM_OBJ |
| 91 | KERNEL_VM_USR := $(KERNEL_VM_SYMLINK)/usr |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 92 | else |
| 93 | # Legacy style, kernel source directly under kernel |
| 94 | KERNEL_LEGACY_DIR := true |
| 95 | BUILD_ROOT_LOC := ../ |
| 96 | TARGET_KERNEL_SOURCE := kernel |
| 97 | KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 98 | KERNEL_VM_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_VM_OBJ |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 99 | endif |
| 100 | |
| 101 | KERNEL_CONFIG := $(KERNEL_OUT)/.config |
| 102 | |
| 103 | ifeq ($(KERNEL_DEFCONFIG)$(wildcard $(KERNEL_CONFIG)),) |
| 104 | $(error Kernel configuration not defined, cannot build kernel) |
| 105 | else |
| 106 | |
| 107 | ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true) |
| 108 | $(info Using uncompressed kernel) |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 109 | TARGET_PREBUILT_INT_KERNEL_ := arch/$(KERNEL_ARCH)/boot/Image |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 110 | else |
| 111 | ifeq ($(KERNEL_ARCH),arm64) |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 112 | TARGET_PREBUILT_INT_KERNEL_ := arch/$(KERNEL_ARCH)/boot/Image.gz |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 113 | else |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 114 | TARGET_PREBUILT_INT_KERNEL_ := arch/$(KERNEL_ARCH)/boot/zImage |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 115 | endif |
| 116 | endif |
| 117 | |
| 118 | ifeq ($(TARGET_KERNEL_APPEND_DTB), true) |
| 119 | $(info Using appended DTB) |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 120 | TARGET_PREBUILT_INT_KERNEL_ := $(TARGET_PREBUILT_INT_KERNEL_)-dtb |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 121 | endif |
| 122 | |
| 123 | KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr |
Puja Gupta | 4544540 | 2017-03-24 12:56:52 -0700 | [diff] [blame] | 124 | KERNEL_MODULES_INSTALL ?= system |
| 125 | KERNEL_MODULES_OUT ?= $(PRODUCT_OUT)/$(KERNEL_MODULES_INSTALL)/lib/modules |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 126 | |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 127 | TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/$(TARGET_PREBUILT_INT_KERNEL_) |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 128 | TARGET_PREBUILT_KERNEL := $(TARGET_PREBUILT_INT_KERNEL) |
| 129 | |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 130 | KERNEL_VM_CONFIG := $(KERNEL_VM_OUT)/.config |
| 131 | KERNEL_VM_HEADERS_INSTALL := $(KERNEL_VM_OUT)/usr |
| 132 | TARGET_PREBUILT_INT_KERNEL_VM := $(KERNEL_VM_OUT)/$(TARGET_PREBUILT_INT_KERNEL_) |
| 133 | TARGET_PREBUILT_KERNEL_VM := $(TARGET_PREBUILT_INT_KERNEL_VM) |
| 134 | |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 135 | define mv-modules |
| 136 | mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.dep`;\ |
| 137 | if [ "$$mdpath" != "" ];then\ |
| 138 | mpath=`dirname $$mdpath`;\ |
| 139 | ko=`find $$mpath/kernel -type f -name *.ko`;\ |
| 140 | for i in $$ko; do mv $$i $(KERNEL_MODULES_OUT)/; done;\ |
| 141 | fi |
| 142 | endef |
| 143 | |
| 144 | define clean-module-folder |
| 145 | mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.dep`;\ |
| 146 | if [ "$$mdpath" != "" ];then\ |
| 147 | mpath=`dirname $$mdpath`; rm -rf $$mpath;\ |
| 148 | fi |
| 149 | endef |
| 150 | |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 151 | $(TARGET_PREBUILT_INT_KERNEL_VM): ; |
| 152 | |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 153 | ifneq ($(KERNEL_LEGACY_DIR),true) |
| 154 | $(KERNEL_USR): $(KERNEL_HEADERS_INSTALL) |
| 155 | rm -rf $(KERNEL_SYMLINK) |
| 156 | ln -s kernel/$(TARGET_KERNEL) $(KERNEL_SYMLINK) |
| 157 | |
| 158 | $(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_USR) |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 159 | |
| 160 | ifneq ($(KERNEL_VM_DEFCONFIG),) |
| 161 | $(KERNEL_VM_USR): $(KERNEL_VM_HEADERS_INSTALL) |
| 162 | rm -rf $(KERNEL_VM_SYMLINK); |
| 163 | ln -s kernel_vm/$(TARGET_KERNEL) $(KERNEL_VM_SYMLINK); |
| 164 | |
| 165 | $(TARGET_PREBUILT_INT_KERNEL_VM): $(KERNEL_VM_USR) |
| 166 | endif |
| 167 | endif |
| 168 | |
| 169 | ifneq ($(KERNEL_VM_DEFCONFIG),) |
| 170 | $(KERNEL_VM_OUT): |
| 171 | mkdir -p $(KERNEL_VM_OUT); |
| 172 | |
| 173 | $(KERNEL_VM_CONFIG): $(KERNEL_VM_OUT) |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 174 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_VM_DEFCONFIG); |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 175 | if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ |
| 176 | echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \ |
| 177 | echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_VM_OUT)/.config; \ |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 178 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi; |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 179 | |
| 180 | $(TARGET_PREBUILT_INT_KERNEL_VM): $(KERNEL_VM_OUT) $(KERNEL_VM_HEADERS_INSTALL) |
| 181 | echo "Building vm kernel..."; |
| 182 | rm -rf $(KERNEL_VM_OUT)/arch/$(KERNEL_ARCH)/boot/dts; |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 183 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS); |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 184 | |
| 185 | $(KERNEL_VM_HEADERS_INSTALL): $(KERNEL_VM_OUT) |
| 186 | rm -f $(BUILD_ROOT_LOC)$(KERNEL_VM_CONFIG); |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 187 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_VM_DEFCONFIG); |
| 188 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) headers_install; |
Neeraj Upadhyay | 368def7 | 2018-06-04 13:56:28 +0530 | [diff] [blame] | 189 | if [ -d "$(KERNEL_VM_HEADERS_INSTALL)/include/bringup_headers" ]; then \ |
| 190 | cp -Rf $(KERNEL_VM_HEADERS_INSTALL)/include/bringup_headers/* $(KERNEL_VM_HEADERS_INSTALL)/include/ ; fi ; |
| 191 | if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ |
| 192 | echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_VM_OUT)/.config; \ |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 193 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_VM_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi; |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 194 | endif |
| 195 | |
| 196 | $(KERNEL_OUT): |
| 197 | mkdir -p $(KERNEL_OUT) |
| 198 | |
| 199 | $(KERNEL_CONFIG): $(KERNEL_OUT) |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 200 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_DEFCONFIG) |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 201 | $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ |
| 202 | echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \ |
| 203 | echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \ |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 204 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 205 | |
| 206 | $(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_OUT) $(KERNEL_HEADERS_INSTALL) |
| 207 | $(hide) echo "Building kernel..." |
| 208 | $(hide) rm -rf $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 209 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS) |
| 210 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS) modules |
| 211 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) INSTALL_MOD_PATH=$(BUILD_ROOT_LOC)../$(KERNEL_MODULES_INSTALL) INSTALL_MOD_STRIP=1 $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) modules_install |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 212 | $(mv-modules) |
| 213 | $(clean-module-folder) |
| 214 | |
| 215 | $(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT) |
| 216 | $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \ |
| 217 | rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG); \ |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 218 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_HEADER_DEFCONFIG); \ |
| 219 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) headers_install;\ |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 220 | if [ -d "$(KERNEL_HEADERS_INSTALL)/include/bringup_headers" ]; then \ |
| 221 | cp -Rf $(KERNEL_HEADERS_INSTALL)/include/bringup_headers/* $(KERNEL_HEADERS_INSTALL)/include/ ;\ |
| 222 | fi ;\ |
| 223 | fi |
| 224 | $(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \ |
| 225 | echo "Used a different defconfig for header generation"; \ |
| 226 | rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG); \ |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 227 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_DEFCONFIG); fi |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 228 | $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ |
| 229 | echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \ |
| 230 | echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \ |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 231 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 232 | |
Neeraj Upadhyay | eff89ac | 2018-10-16 15:44:24 +0530 | [diff] [blame] | 233 | .PHONY: kerneltags |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 234 | kerneltags: $(KERNEL_OUT) $(KERNEL_CONFIG) |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 235 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) tags |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 236 | |
Neeraj Upadhyay | eff89ac | 2018-10-16 15:44:24 +0530 | [diff] [blame] | 237 | .PHONY: kernelconfig |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 238 | kernelconfig: $(KERNEL_OUT) $(KERNEL_CONFIG) |
| 239 | env KCONFIG_NOTIMESTAMP=true \ |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 240 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) menuconfig |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 241 | env KCONFIG_NOTIMESTAMP=true \ |
Prasad Sodagudi | c8de0c8 | 2017-10-04 14:44:24 -0700 | [diff] [blame] | 242 | $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) savedefconfig |
Ameya Thakur | 300fae9 | 2016-08-10 11:33:55 -0700 | [diff] [blame] | 243 | cp $(KERNEL_OUT)/defconfig $(TARGET_KERNEL_SOURCE)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_DEFCONFIG) |
| 244 | |
| 245 | endif |
| 246 | endif |