build_library: Create MiniOS disk layout with two partitions.

Add two miniOS partitions. One in the beginning and one at the end
after stateful partition. The partition in the beginning has priority.
Add a new feature `back_partition` to the cgpt script to be able to
to place MiniOS -B behind the expanded stateful partition at the
end of the disk.

       start        size    part  contents
           0           1          PMBR (Boot GUID:)
           1           1          Pri GPT header
           2          32          Pri GPT table
     5349376     8401041       1  Label: "STATE"
                                  Type: Linux data
                                  UUID: 31694155-F9E7-404C-8179-C5BEA9C8BC83
      131141       65536       2  Label: "KERN-A"
                                  Type: ChromeOS kernel
                                  UUID: 5AE5238C-2648-FD47-AF92-6D566F3320E5
                                  Attr: priority=15 tries=15 successful=0
      434176     4915200       3  Label: "ROOT-A"
                                  Type: ChromeOS rootfs
                                  UUID: 411C7DB2-DC13-464A-99B0-000DBB004AE0
          64      131072      13  Label: "MiniOS-A"
                                  Type: ChromeOS kernel
                                  UUID: D3C1DE80-998A-054C-97F7-6A43727C90F2
                                  Attr: priority=15 tries=5 successful=0
    13750417      131072      14  Label: "MiniOS-B"
                                  Type: ChromeOS kernel
                                  UUID: C24FF886-BAB9-7342-9C8A-F42CDB4591F7
                                  Attr: priority=0 tries=0 successful=0
TEST=flash and chromeos-install on hatch

Change-Id: I2d45248b7cf88c5f20d31f33d0fe8df30197b5a5
Tested-by: Vyshu Khota <>
Commit-Queue: Vyshu Khota <>
Reviewed-by: Amin Hassani <>
Reviewed-by: Mike Frysinger <>
Reviewed-by: Sarthak Kukreti <>
3 files changed