Ying Wang | b888843 | 2014-03-11 17:13:27 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2014 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | # We build oem.img only if it's asked for. |
| 18 | ifneq ($(filter $(MAKECMDGOALS),oem_image),) |
| 19 | ifndef BOARD_OEMIMAGE_PARTITION_SIZE |
| 20 | $(error BOARD_OEMIMAGE_PARTITION_SIZE is not set.) |
| 21 | endif |
| 22 | |
| 23 | INTERNAL_OEMIMAGE_FILES := \ |
| 24 | $(filter $(TARGET_OUT_OEM)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) |
| 25 | |
| 26 | oemimage_intermediates := \ |
| 27 | $(call intermediates-dir-for,PACKAGING,oem) |
| 28 | BUILT_OEMIMAGE_TARGET := $(PRODUCT_OUT)/oem.img |
| 29 | # We just build this directly to the install location. |
| 30 | INSTALLED_OEMIMAGE_TARGET := $(BUILT_OEMIMAGE_TARGET) |
| 31 | |
| 32 | $(INSTALLED_OEMIMAGE_TARGET) : $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_OEMIMAGE_FILES) |
| 33 | $(call pretty,"Target oem fs image: $@") |
| 34 | @mkdir -p $(TARGET_OUT_OEM) |
| 35 | @mkdir -p $(oemimage_intermediates) && rm -rf $(oemimage_intermediates)/oem_image_info.txt |
| 36 | $(call generate-userimage-prop-dictionary, $(oemimage_intermediates)/oem_image_info.txt, skip_fsck=true) |
| 37 | $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \ |
| 38 | ./build/tools/releasetools/build_image.py \ |
| 39 | $(TARGET_OUT_OEM) $(oemimage_intermediates)/oem_image_info.txt $@ |
| 40 | $(hide) $(call assert-max-image-size,$@,$(BOARD_OEMIMAGE_PARTITION_SIZE)) |
| 41 | |
| 42 | .PHONY: oem_image |
| 43 | oem_image : $(INSTALLED_OEMIMAGE_TARGET) |
| 44 | $(call dist-for-goals, oem_image, $(INSTALLED_OEMIMAGE_TARGET)) |
| 45 | |
| 46 | endif # oem_image in $(MAKECMDGOALS) |