mod_image_for_recovery: dynamically adjust kern-A size

This CL changes the copy-and-modify flow to:
  1) Build recovery kernel.
  2) Create an empty recovery image with correct KERN-A and STATE size.
  3) Copy partitions from source image to the recovery image.
  4) Copy recovery kernel to the recovery image.
  5) Update EFI partition.

This change breaks --modify_in_place because it will be implemented
by creating a temporary image and than move back to the source image
path. Not technically in-place, but should be acceptable.

BUG=chromium:873135
TEST=1) Create an recovery ramfs with >32MB junk files, build recovery image and
        boot on DUT successfully.
     2) Verify the script fails when a super large kernel image is
        provided.
     3) cros tryjob -g 2294783 puff-release-tryjob

Change-Id: If88e9f7893816ab40085d5cfeb360573682bfe57
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2294783
Tested-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
3 files changed