repack_bootimg: allow specifying the copy-to file path

Currently --ramdisk_add option assumes the relative file path
is the same from the source ramdisk to the destination ramdisk.

However, in some use case we'll need to copy the file from the
source ramdisk to the other location in the destination ramdisk.
e.g., from first_stage_ramdisk/userdebug_plat_sepolicy.cil to
userdebug_plat_sepolicy.cil.

This change adds the support for specifying different file path
to copy, by using a list of src_file:dst_file pairs. e.g.,

  --ramdisk_add first_stage_ramdisk/userdebug_plat_sepolicy.cil:userdebug_plat_sepolicy.cil

It also supports a list of copy instructions, e.g.,

  --ramdisk_add file1 file2:/subdir/file2 file3

The above option copies /file1 and /file3 from the source ramdisk to the
destination ramdisk, and copies /file2 from source ramdisk to
/subdir/file2 of the destination ramdisk.

Bug: 184898848
Test: m repack_bootimg
Test: repack_bootimg --src_bootimg boot-debug-5.4.img \
      --dst_bootimg boot-debug.img --ramdisk_add \
      first_stage_ramdisk/userdebug_plat_sepolicy.cil:userdebug_plat_sepolicy.cil \
      first_stage_ramdisk/userdebug_plat_sepolicy.cil

Change-Id: Ib8faa82da95b393606ee024415b19c274a409968
1 file changed