forked from 8890dev/android_device_samsung_hero-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkbootimg.mk
70 lines (57 loc) · 3.19 KB
/
mkbootimg.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
66
67
68
69
70
# mkbootimg.mk - Custom mkbootimg Makefile for Exynos devices
#
# Copyright (C) 2017 Jesse Chan <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
LOCAL_PATH := $(call my-dir)
DTS_FILES = $(wildcard $(TOP)/$(TARGET_KERNEL_SOURCE)/arch/$(TARGET_KERNEL_ARCH)/boot/dts/$(TARGET_DTS_NAMES)*.dts)
DTS_FILE = $(lastword $(subst /, ,$(1)))
PROCESSED_DTS_FILE = $(addprefix $(KERNEL_OUT)/arch/$(TARGET_KERNEL_ARCH)/boot/dts_processed/,$(call DTS_FILE,$(1)))
DTB_FILE = $(addprefix $(KERNEL_OUT)/arch/$(TARGET_KERNEL_ARCH)/boot/,$(patsubst %.dts,%.dtb,$(call DTS_FILE,$(1))))
DTC = $(KERNEL_OUT)/scripts/dtc/dtc
define process-dts
rm -rf $(KERNEL_OUT)/arch/$(TARGET_KERNEL_ARCH)/boot;\
mkdir -p $(KERNEL_OUT)/arch/$(TARGET_KERNEL_ARCH)/boot/dts_processed;\
$(foreach d, $(DTS_FILES), \
cpp -nostdinc -undef -x assembler-with-cpp -I $(TARGET_KERNEL_SOURCE)/include $(d) -o $(call PROCESSED_DTS_FILE,$(d));)
endef
define make-dtbs
$(foreach d, $(DTS_FILES), \
$(DTC) -p 0 -i $(TARGET_KERNEL_SOURCE)/arch/$(TARGET_KERNEL_ARCH)/boot/dts -O dtb -o $(call DTB_FILE,$(d)) $(call PROCESSED_DTS_FILE,$(d));)
endef
## Build and run dtbtool
DTBTOOL := $(HOST_OUT_EXECUTABLES)/$(TARGET_CUSTOM_DTBTOOL)$(HOST_EXECUTABLE_SUFFIX)
INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img
$(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr $(INSTALLED_KERNEL_TARGET)
@echo -e ${CL_CYN}"Start DT image: $@"${CL_RST}
$(call process-dts)
$(call make-dtbs)
$(call pretty,"Target dt image: $(INSTALLED_DTIMAGE_TARGET)")
$(hide) $(DTBTOOL) -o $(INSTALLED_DTIMAGE_TARGET) -s $(BOARD_KERNEL_PAGESIZE) -d $(KERNEL_OUT)/arch/$(TARGET_KERNEL_ARCH)/boot/
@echo -e ${CL_CYN}"Made DT image: $@"${CL_RST}
## Boot Image Generation
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(INSTALLED_DTIMAGE_TARGET)
$(call pretty,"Target boot image: $@")
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --dt $(INSTALLED_DTIMAGE_TARGET) --output $@
$(hide) echo -n "SEANDROIDENFORCE" >> $(INSTALLED_BOOTIMAGE_TARGET)
$(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
@echo -e ${CL_CYN}"Made boot image: $@"${CL_RST}
## Recovery Image Generation
$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_DTIMAGE_TARGET) \
$(recovery_ramdisk) \
$(recovery_kernel)
@echo -e ${CL_CYN}"----- Making recovery image ------"${CL_RST}
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --dt $(INSTALLED_DTIMAGE_TARGET) --output $@
$(hide) echo -n "SEANDROIDENFORCE" >> $(INSTALLED_RECOVERYIMAGE_TARGET)
$(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
@echo -e ${CL_CYN}"Made recovery image: $@"${CL_RST}
.PHONY: dtimage
dtimage: $(INSTALLED_DTIMAGE_TARGET)