hidl: consumerir: Update samsung_consumerir header for HIDL hal
[GitHub/LineageOS/android_hardware_samsung.git] / mkbootimg.mk
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 system/tools/dtbtool/Android.mk
21 endif
22
23 ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),)
24 DTBTOOL_NAME := dtbToolLineage
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
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/
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 ifeq ($(strip $(TARGET_NEEDS_LOKI)),true)
64 LOKI_TOOL := loki_tool
65 else
66 LOKI_TOOL := echo
67 TARGET_LOKI_ABOOT_IMAGE :=
68 endif
69
70 $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS)
71 $(call pretty,"Target boot image: $@")
72 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
73 $(hide) echo -n "SEANDROIDENFORCE" >> $@
74 $(hide) $(LOKI_TOOL) patch boot $(TARGET_LOKI_ABOOT_IMAGE) $@ $@.lok
75 $(hide) cp $@.lok $@ || true
76 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
77 @echo "Made boot image: $@"
78
79 $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) $(RECOVERYIMAGE_EXTRA_DEPS)
80 @echo "----- Making recovery image ------"
81 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ --id > $(RECOVERYIMAGE_ID_FILE)
82 $(hide) echo -n "SEANDROIDENFORCE" >> $@
83 $(hide) $(LOKI_TOOL) patch recovery $(TARGET_LOKI_ABOOT_IMAGE) $@ $@.lok
84 $(hide) cp $@.lok $@ || true
85 $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
86 @echo "Made recovery image: $@"