Re-land: Use the layout.json file to actually build the FS's specified in it.

This CL refactors a bit how we build the initial base image and how we
create FS's for the partitions. Specifically, I'm changing base image
creation to work just like dev and test image creation. In the latter two,
we use to mount the existing image.bin file already
containg the gpt layout and fs's and just emerge into the directories. I
do this for the base image as well by creating the GPT image and fs's first.
In order to facilitate that, I moved the mk_fs work to
which has a new build method build_gpt_image that does what indicated. In
addition to that refactoring I had to better centralize all the mount point
logic which I've moved into mk_fs (creates the stateful and rootfs mount
mounts). Finally, I've modified mount_gpt_image to always mount the oem
partition to both persist and extend how the oem partition gets layed on
the rootfs.

In addition to fixing the below bug, this CL should make building any image
faster since we avoid half the IO (we don't have to dd a bunch of data when
we create the base image).

Finally, this CL was reverted previously because we were creating partition
5 (ROOT-B) now which is actually a waste of time (and breaks when we have
small ROOT-B's in some layouts that don't specify a smaller fs_blocks). So,
in this patch I removed all fs_format/fs_bytes for partitions we don't want
the build system to actually create.

TEST=Still going but built various images to completion. Everything is mounted
correctly. Going to create some deltas before and after.

Change-Id: I5f45509e87341386973823890f6f69d1ee069e0b
Tested-by: Chris Sosa <>
Reviewed-by: Chris Sosa <>
Commit-Queue: Chris Sosa <>
6 files changed