1LOCAL_PATH := $(call my-dir)
2
3#A/B builds require us to create the mount points at compile time.
4#Just creating it for all cases since it does not hurt.
5FIRMWARE_MOUNT_POINT := $(TARGET_OUT_VENDOR)/firmware_mnt
6ALL_DEFAULT_INSTALLED_MODULES += $(FIRMWARE_MOUNT_POINT)
7
8$(FIRMWARE_MOUNT_POINT):
9	@echo "Creating $(FIRMWARE_MOUNT_POINT)"
10	@mkdir -p $(TARGET_OUT_VENDOR)/firmware_mnt
11
12#----------------------------------------------------------------------
13# Generate persist image (persist.img)
14#----------------------------------------------------------------------
15TARGET_OUT_PERSIST_IMG_PATH := $(PRODUCT_OUT)/persist
16
17INTERNAL_PERSISTIMAGE_FILES := \
18    $(foreach pair,$(PRODUCT_COPY_FILES),\
19        $(if $(filter persist/%,$(call word-colon,2,$(pair))),\
20            $(call word-colon,1,$(pair)):$(PRODUCT_OUT)/$(call word-colon,2,$(pair))))
21
22INSTALLED_PERSISTIMAGE_FILES := $(call copy-many-files,$(INTERNAL_PERSISTIMAGE_FILES))
23INSTALLED_PERSISTIMAGE_TARGET := $(PRODUCT_OUT)/persist.img
24
25$(INSTALLED_PERSISTIMAGE_TARGET): $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(INSTALLED_PERSISTIMAGE_FILES)
26	$(call pretty,"Target persist fs image: $(INSTALLED_PERSISTIMAGE_TARGET)")
27	@mkdir -p $(TARGET_OUT_PERSIST_IMG_PATH)
28	$(hide) PATH=$(HOST_OUT_EXECUTABLES):$${PATH} $(MKEXTUSERIMG) -s $(TARGET_OUT_PERSIST_IMG_PATH) $@ ext4 persist $(BOARD_PERSISTIMAGE_PARTITION_SIZE)
29	$(hide) chmod a+r $@
30	$(hide) $(call assert-max-image-size,$@,$(BOARD_PERSISTIMAGE_PARTITION_SIZE))
31
32ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PERSISTIMAGE_TARGET)
33ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(INSTALLED_PERSISTIMAGE_TARGET)
34INSTALLED_RADIOIMAGE_TARGET += $(INSTALLED_PERSISTIMAGE_TARGET)
35
36
37.PHONY: persistimage
38persistimage: $(INSTALLED_PERSISTIMAGE_TARGET)
39
40droidcore: $(INSTALLED_PERSISTIMAGE_TARGET)
41
42
43# copy kernel headers to the build tree
44$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr: $(wildcard $(PRODUCT_VENDOR_KERNEL_HEADERS)/*)
45	rm -rf $@
46	mkdir -p $@/include
47	cp -a $(PRODUCT_VENDOR_KERNEL_HEADERS)/. $@/include
48
49#----------------------------------------------------------------------
50# build and sign the final stage of bootloader
51#----------------------------------------------------------------------
52.PHONY: aboot
53ifeq ($(USESECIMAGETOOL), true)
54aboot: gensecimage_target gensecimage_install
55else
56aboot: $(INSTALLED_BOOTLOADER_MODULE)
57endif
58