platform_build/core/tasks/oem_image.mk
Tao Bao 2bbb07c53c Build build_image and build_super_image as modules.
Bug: 63866463
Test: TreeHugger
Test: `atest releasetools_test`
Test: `atest releasetools_py3_test`
Change-Id: I2059a4ced709d1b2ee331a9aaaa5ca30db4ebf6b
2019-07-18 10:27:38 -07:00

46 lines
1.8 KiB
Makefile

#
# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# We build oem.img only if it's asked for.
ifneq ($(filter $(MAKECMDGOALS),oem_image),)
ifndef BOARD_OEMIMAGE_PARTITION_SIZE
$(error BOARD_OEMIMAGE_PARTITION_SIZE is not set.)
endif
INTERNAL_OEMIMAGE_FILES := \
$(filter $(TARGET_OUT_OEM)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
oemimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,oem)
BUILT_OEMIMAGE_TARGET := $(PRODUCT_OUT)/oem.img
# We just build this directly to the install location.
INSTALLED_OEMIMAGE_TARGET := $(BUILT_OEMIMAGE_TARGET)
$(INSTALLED_OEMIMAGE_TARGET) : $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_OEMIMAGE_FILES)
$(call pretty,"Target oem fs image: $@")
@mkdir -p $(TARGET_OUT_OEM)
@mkdir -p $(oemimage_intermediates) && rm -rf $(oemimage_intermediates)/oem_image_info.txt
$(call generate-image-prop-dictionary, $(oemimage_intermediates)/oem_image_info.txt,oem,skip_fsck=true)
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
$(BUILD_IMAGE) \
$(TARGET_OUT_OEM) $(oemimage_intermediates)/oem_image_info.txt $@ $(TARGET_OUT)
$(call assert-max-image-size,$@,$(BOARD_OEMIMAGE_PARTITION_SIZE))
.PHONY: oem_image
oem_image : $(INSTALLED_OEMIMAGE_TARGET)
$(call dist-for-goals, oem_image, $(INSTALLED_OEMIMAGE_TARGET))
endif # oem_image in $(MAKECMDGOALS)