forked from openkylin/platform_build
Merge "Add support for Brillo partitioning."
am: 2528968
* commit '2528968871cb43a775b059a9300a7cd907c3cfce':
Add support for Brillo partitioning.
Change-Id: I64897c61190f0674ec006d3ddf3af4342d9b8970
This commit is contained in:
commit
93a34234c6
|
@ -1406,6 +1406,36 @@ userdatatarball-nodeps: $(FS_GET_STATS)
|
|||
$(build-userdatatarball-target)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# partition table image
|
||||
ifdef BOARD_BPT_INPUT_FILES
|
||||
|
||||
BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
|
||||
|
||||
INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
|
||||
--output_gpt $(BUILT_BPTIMAGE_TARGET) \
|
||||
--output_json $(PRODUCT_OUT)/partition-table.bpt \
|
||||
$(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
|
||||
|
||||
ifdef BOARD_BPT_DISK_SIZE
|
||||
INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
|
||||
endif
|
||||
|
||||
define build-bptimage-target
|
||||
$(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
|
||||
$(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
|
||||
endef
|
||||
|
||||
INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
|
||||
$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
|
||||
$(build-bptimage-target)
|
||||
|
||||
.PHONY: bptimage-nodeps
|
||||
bptimage-nodeps:
|
||||
$(build-bptimage-target)
|
||||
|
||||
endif # BOARD_BPT_INPUT_FILES
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# cache partition image
|
||||
ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
|
||||
|
@ -1811,6 +1841,14 @@ ifeq ($(BOARD_BVB_ENABLE),true)
|
|||
$(hide) echo "board_bvb_key_path=$(BOARD_BVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
|
||||
$(hide) echo "board_bvb_rollback_index=$(BOARD_BVB_ROLLBACK_INDEX)" >> $(zip_root)/META/misc_info.txt
|
||||
$(hide) echo "board_bvb_add_image_hashes_args=$(BOARD_BVB_ADD_IMAGE_HASHES_ARGS)" >> $(zip_root)/META/misc_info.txt
|
||||
endif
|
||||
ifdef BOARD_BPT_INPUT_FILES
|
||||
$(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
|
||||
$(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
|
||||
$(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
|
||||
endif
|
||||
ifdef BOARD_BPT_DISK_SIZE
|
||||
$(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
|
||||
endif
|
||||
$(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
|
||||
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
|
||||
|
|
|
@ -525,6 +525,11 @@ MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
|
|||
else
|
||||
MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG)
|
||||
endif
|
||||
ifeq (,$(strip $(BOARD_CUSTOM_BPTTOOL)))
|
||||
BPTTOOL := $(HOST_OUT_EXECUTABLES)/bpttool$(HOST_EXECUTABLE_SUFFIX)
|
||||
else
|
||||
BPTTOOL := $(BOARD_CUSTOM_BPTTOOL)
|
||||
endif
|
||||
ifeq (,$(strip $(BOARD_CUSTOM_BVBTOOL)))
|
||||
BVBTOOL := $(HOST_OUT_EXECUTABLES)/bvbtool$(HOST_EXECUTABLE_SUFFIX)
|
||||
else
|
||||
|
|
|
@ -77,6 +77,7 @@ dont_bother_goals := clean clobber dataclean installclean \
|
|||
stnod systemtarball-nodeps \
|
||||
userdataimage-nodeps userdatatarball-nodeps \
|
||||
cacheimage-nodeps \
|
||||
bptimage-nodeps \
|
||||
vendorimage-nodeps \
|
||||
ramdisk-nodeps \
|
||||
bootimage-nodeps \
|
||||
|
@ -905,6 +906,9 @@ userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
|
|||
.PHONY: cacheimage
|
||||
cacheimage: $(INSTALLED_CACHEIMAGE_TARGET)
|
||||
|
||||
.PHONY: bptimage
|
||||
bptimage: $(INSTALLED_BPTIMAGE_TARGET)
|
||||
|
||||
.PHONY: vendorimage
|
||||
vendorimage: $(INSTALLED_VENDORIMAGE_TARGET)
|
||||
|
||||
|
@ -934,6 +938,7 @@ droidcore: files \
|
|||
$(INSTALLED_RECOVERYIMAGE_TARGET) \
|
||||
$(INSTALLED_USERDATAIMAGE_TARGET) \
|
||||
$(INSTALLED_CACHEIMAGE_TARGET) \
|
||||
$(INSTALLED_BPTIMAGE_TARGET) \
|
||||
$(INSTALLED_VENDORIMAGE_TARGET) \
|
||||
$(INSTALLED_FILES_FILE) \
|
||||
$(INSTALLED_FILES_FILE_VENDOR)
|
||||
|
|
|
@ -228,6 +228,35 @@ def AddUserdata(output_zip, prefix="IMAGES/"):
|
|||
shutil.rmtree(temp_dir)
|
||||
|
||||
|
||||
def AddPartitionTable(output_zip, prefix="IMAGES/"):
|
||||
"""Create a partition table image and store it in output_zip."""
|
||||
|
||||
_, img_file_name = tempfile.mkstemp()
|
||||
_, bpt_file_name = tempfile.mkstemp()
|
||||
|
||||
# use BPTTOOL from environ, or "bpttool" if empty or not set.
|
||||
bpttool = os.getenv("BPTTOOL") or "bpttool"
|
||||
cmd = [bpttool, "make_table", "--output_json", bpt_file_name,
|
||||
"--output_gpt", img_file_name]
|
||||
input_files_str = OPTIONS.info_dict["board_bpt_input_files"]
|
||||
input_files = input_files_str.split(" ")
|
||||
for i in input_files:
|
||||
cmd.extend(["--input", i])
|
||||
disk_size = OPTIONS.info_dict.get("board_bpt_disk_size")
|
||||
if disk_size:
|
||||
cmd.extend(["--disk_size", disk_size])
|
||||
args = OPTIONS.info_dict.get("board_bpt_make_table_args")
|
||||
if args:
|
||||
cmd.extend(shlex.split(args))
|
||||
|
||||
p = common.Run(cmd, stdout=subprocess.PIPE)
|
||||
p.communicate()
|
||||
assert p.returncode == 0, "bpttool make_table failed"
|
||||
|
||||
common.ZipWrite(output_zip, img_file_name, prefix + "partition-table.img")
|
||||
common.ZipWrite(output_zip, bpt_file_name, prefix + "partition-table.bpt")
|
||||
|
||||
|
||||
def AddCache(output_zip, prefix="IMAGES/"):
|
||||
"""Create an empty cache image and store it in output_zip."""
|
||||
|
||||
|
@ -362,6 +391,9 @@ def AddImagesToTargetFiles(filename):
|
|||
AddUserdata(output_zip)
|
||||
banner("cache")
|
||||
AddCache(output_zip)
|
||||
if OPTIONS.info_dict.get("board_bpt_enable", None) == "true":
|
||||
banner("partition-table")
|
||||
AddPartitionTable(output_zip)
|
||||
|
||||
# For devices using A/B update, copy over images from RADIO/ to IMAGES/ and
|
||||
# make sure we have all the needed images ready under IMAGES/.
|
||||
|
|
Loading…
Reference in New Issue