-
Notifications
You must be signed in to change notification settings - Fork 1
/
Android.mk
66 lines (54 loc) · 2.29 KB
/
Android.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Use this kernel source as base for kernel if PREBUILT is not choosen
#
ifeq ($(TARGET_PREBUILT_KERNEL),)
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
KERNEL_OUT_CONFIG := $(KERNEL_OUT)/.config
TARGET_PREBUILT_KERNEL := $(KERNEL_OUT)/arch/arm/boot/zImage
KERNEL_SOURCE_PATH := $(call my-dir)
KERNEL_SOURCE_CONFIG := $(KERNEL_SOURCE_PATH)/arch/arm/configs/$(KERNEL_DEFCONFIG)
# Select choosen defconfig
install_defconfig_always:
$(KERNEL_OUT_CONFIG): install_defconfig_always
@mkdir -p $(KERNEL_OUT)
$(hide) $(MAKE) -C $(KERNEL_SOURCE_PATH) O=../$(KERNEL_OUT) \
ARCH=arm CROSS_COMPILE=arm-eabi- $(KERNEL_DEFCONFIG)
# Build kernel from selected defconfig
$(TARGET_PREBUILT_KERNEL): $(KERNEL_OUT_CONFIG)
$(hide) $(MAKE) -C $(KERNEL_SOURCE_PATH) O=../$(KERNEL_OUT) \
ARCH=arm CROSS_COMPILE=arm-eabi-
# Install selected defconfig, run menuconfig and then copy back
export KCONFIG_NOTIMESTAMP=true
.PHONY: kernelconfig
kernelconfig: $(KERNEL_OUT_CONFIG)
$(hide) $(MAKE) -C $(KERNEL_SOURCE_PATH) O=../$(KERNEL_OUT) \
ARCH=arm CROSS_COMPILE=arm-eabi- menuconfig
$(hide) cp $(KERNEL_OUT)/.config $(KERNEL_SOURCE_CONFIG)
endif
#
# Rules for packing kernel into elf and sin
#
$(PRODUCT_OUT)/kernel.elf: $(TARGET_PREBUILT_KERNEL) $(PRODUCT_OUT)/ramdisk.img $(PRODUCT_OUT)/RPM.bin | sin-tools
$(hide) $(HOST_OUT_EXECUTABLES)/mkelf.py \
-o $(dir $@)/kernel-unsigned.elf \
$(TARGET_PREBUILT_KERNEL)@$(BOARD_KERNEL_ADDR) \
$(PRODUCT_OUT)/ramdisk.img@$(BOARD_RAMDISK_ADDR),ramdisk \
$(PRODUCT_OUT)/RPM.bin@$(BOARD_RPM_ADDR),rpm && \
$(SEMCSC) -c $(PRODUCT_PARTITION_CONFIG) -p Kernel -t internal \
-i $(dir $@)/kernel-unsigned.elf -o $@
$(PRODUCT_OUT)/kernel.si_: $(PRODUCT_OUT)/kernel.elf | sin-tools
$(hide) $(HOST_OUT_EXECUTABLES)/create_sin_header Kernel $(PRODUCT_PARTITION_CONFIG) $@
$(hide) cat $< >> $@
$(PRODUCT_OUT)/kernel.sin: $(PRODUCT_OUT)/kernel.si_ $(PRODUCT_PARTITION_CONFIG) | sin-tools
@echo target SIN: $(notdir $@)
$(hide) $(SEMCSC) -c $(PRODUCT_PARTITION_CONFIG) -p Kernel -t external -i $< -o $@
#
# Add kernel to system wide PHONY target sin
#
.PHONY: sin
sin: $(PRODUCT_OUT)/kernel.sin
#
# boot.img requires $(INSTALLED_KERNEL_TARGET) to exist
#
$(INSTALLED_KERNEL_TARGET): $(TARGET_PREBUILT_KERNEL) | $(ACP)
$(transform-prebuilt-to-target)