Commit | Line | Data |
---|---|---|
67a74448 JC |
1 | # Copyright (C) 2017 The LineageOS Project |
2 | # | |
3 | # Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | # you may not use this file except in compliance with the License. | |
5 | # You may obtain a copy of the License at | |
6 | # | |
7 | # http://www.apache.org/licenses/LICENSE-2.0 | |
8 | # | |
9 | # Unless required by applicable law or agreed to in writing, software | |
10 | # distributed under the License is distributed on an "AS IS" BASIS, | |
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | # See the License for the specific language governing permissions and | |
13 | # limitations under the License. | |
14 | ||
15 | LOCAL_PATH := $(call my-dir) | |
16 | ||
17 | ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true) | |
18 | ifneq ($(strip $(BOARD_KERNEL_PREBUILT_DT)),true) | |
19 | ifeq ($(strip $(BUILD_TINY_ANDROID)),true) | |
20 | include device/qcom/common/dtbtool/Android.mk | |
21 | endif | |
22 | ||
23 | ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) | |
977aee55 | 24 | DTBTOOL_NAME := dtbToolLineage |
67a74448 JC |
25 | else |
26 | DTBTOOL_NAME := $(TARGET_CUSTOM_DTBTOOL) | |
27 | endif | |
28 | ||
29 | DTBTOOL := $(HOST_OUT_EXECUTABLES)/$(DTBTOOL_NAME)$(HOST_EXECUTABLE_SUFFIX) | |
30 | ||
31 | INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img | |
32 | ||
33 | ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) | |
34 | # dtbToolCM will search subdirectories | |
35 | possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ | |
36 | else | |
37 | # Most specific paths must come first in possible_dtb_dirs | |
9432ff33 | 38 | possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/exynos/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ |
67a74448 JC |
39 | endif |
40 | ||
41 | define build-dtimage-target | |
42 | $(call pretty,"Target dt image: $@") | |
43 | $(hide) for dir in $(possible_dtb_dirs); do \ | |
44 | if [ -d "$$dir" ]; then \ | |
45 | dtb_dir="$$dir"; \ | |
46 | break; \ | |
47 | fi; \ | |
48 | done; \ | |
49 | $(DTBTOOL) $(BOARD_DTBTOOL_ARGS) -o $@ -s $(BOARD_KERNEL_PAGESIZE) -p $(KERNEL_OUT)/scripts/dtc/ "$$dtb_dir"; | |
50 | $(hide) chmod a+r $@ | |
51 | endef | |
52 | ||
53 | $(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(INSTALLED_KERNEL_TARGET) | |
54 | $(build-dtimage-target) | |
55 | @echo "Made DT image: $@" | |
56 | ||
57 | .PHONY: dtimage | |
58 | dtimage: $(INSTALLED_DTIMAGE_TARGET) | |
59 | ||
60 | endif | |
61 | endif | |
62 | ||
63 | $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS) | |
64 | $(call pretty,"Target boot image: $@") | |
65 | $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ | |
66 | $(hide) echo -n "SEANDROIDENFORCE" >> $@ | |
67 | $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw) | |
68 | @echo "Made boot image: $@" | |
69 | ||
70 | $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) $(RECOVERYIMAGE_EXTRA_DEPS) | |
71 | @echo "----- Making recovery image ------" | |
72 | $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ --id > $(RECOVERYIMAGE_ID_FILE) | |
73 | $(hide) echo -n "SEANDROIDENFORCE" >> $@ | |
74 | $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw) | |
75 | @echo "Made recovery image: $@" |