Support regenerating partition table with bpttool in sign_target_files_apks

For Android Things targets (or any other target which has
BOARD_BPT_INPUT_FILES defined), add_img_to_target_files will generate a
partition-table.img using bpttool. It also adds the final combined .bpt
definition file into target-files in IMAGES/partition-table.bpt.

When we're signing using sign_target_files_apks, add_img_to_target_files
needs to regenerate the partition table, but META/misc_info.txt still
contains the original list of bpt input files from the build that aren't
available. This change extracts the final bpt from the input
target-files, adds it to META/ in the output target-files, and then
updates the board_bpt_input_files property to point to it.

Bug: 72837107
Test: Local sign_target_files_apks run of locally built target-files
Change-Id: Id79125208f31c78b1ac2079172f9c91a9203849b
This commit is contained in:
Bryan Henry
2018-04-14 23:10:32 -07:00
parent 69d3feb23a
commit 2a40cc6996
3 changed files with 19 additions and 0 deletions

View File

@@ -222,6 +222,15 @@ def LoadInfoDict(input_file, input_dir=None):
vendor_base_fs_file,))
del d["vendor_base_fs_file"]
# If board_bpt_input_files property is defined then bpttool is being used to
# generate the partition table. When signing target-files, the combined
# partition table definition is copied into META/partition-table.bpt since
# the original input files aren't available.
if "board_bpt_input_files" in d:
board_bpt_input_files = os.path.join(input_dir, "META", "partition-table.bpt")
if os.path.exists(board_bpt_input_files):
d["board_bpt_input_files"] = board_bpt_input_files
def makeint(key):
if key in d:
d[key] = int(d[key], 0)