cgpt: Create a new disk layout v3

We need this new layout so we can add two new partitions at the
beginning and end of the disk. We don't have to be based on the V2
layout anymore as its a good idea now to remove some of the unnecessary
partitions in that layout. Some of the changes in this new partition

- Increase the MINIOS partitions to 128 MB as it seems new feature are
constantly getting added.

- Removal of "reserved" partitions with numbers 9 and 10. We can reuse
these numbers for MINIOS-A and MINIOS-B as these reserved partitions
have never been used before.

- Removal of RWFW partition as it is not being used anymore.

- Reduction in size of the OEM partition. If any board wants to use
this, it has to increase the size on their own. However, seems the build
initializes an ext4 filesystem in this partition, its not possible to
reduce its size by much.

- Move all these small partitions after MINIOS-A. This allows us to
fs_align the remaining of the large partitions in just one place.

- Keep KERN-A and ROOT-A right next to each other on disk in case we
wanted to play with resizing them (like taking from rootfs and giving to
kernel) in the future. I'm just preparing, not sure if this ever
happens. Same for KERN-B and ROOT-B.

The new layout is shown as:
$ ./ debug minios_disk_layout.json  common
Config Data
field:metadata       value:{'block_size': 512, 'fs_block_size': 4096, 'fs_align': 2097152}

COMMON Layout Data
num:   9 label:MINIOS-A   type:kernel size:128 MiB    fs_size:auto       features:[]
num:   6 label:KERN-C     type:kernel size:1          fs_size:auto       features:[]
num:   7 label:ROOT-C     type:rootfs size:1          fs_size:auto       features:[]
num:   8 label:OEM        type:data   size:4 MiB      fs_size:auto       features:[]
num:  12 label:EFI-SYSTEM type:efi    size:64 MiB     fs_size:auto       features:[]
num:   2 label:KERN-A     type:kernel size:32 MiB     fs_size:auto       features:[]
num:   3 label:ROOT-A     type:rootfs size:4 GiB      fs_size:2300 MiB   features:[]
num:   4 label:KERN-B     type:kernel size:32 MiB     fs_size:auto       features:[]
num:   5 label:ROOT-B     type:rootfs size:4 GiB      fs_size:auto       features:[]
num:   1 label:STATE      type:data   size:4 GiB      fs_size:auto       features:['expand']
num:  10 label:MINIOS-B   type:kernel size:128 MiB    fs_size:auto       features:['last_partition']

Or the output is:
       start        size    part  contents
           0           1          PMBR (Boot GUID: B6D5AE7D-5254-954E-9B1F-C50116D780B5)
           1           1          Pri GPT header
           2          32          Pri GPT table
    17313792     8401017       1  Label: "STATE"
                                  Type: Linux data
                                  UUID: 693129A9-0EF0-8E49-AA5C-15A8AEF07B5C
      405504       65536       2  Label: "KERN-A"
                                  Type: ChromeOS kernel
                                  UUID: AB0FC033-2091-7048-8313-CEDB9FCC2678
                                  Attr: priority=15 tries=15 successful=0
      471040     8388608       3  Label: "ROOT-A"
                                  Type: ChromeOS rootfs
                                  UUID: 45145E0F-C32B-F642-A1AF-A89704A39518
     8859648       65536       4  Label: "KERN-B"
                                  Type: ChromeOS kernel
                                  UUID: 464F8DCD-676C-7E45-8739-554C56A6CA87
                                  Attr: priority=0 tries=0 successful=0
     8925184     8388608       5  Label: "ROOT-B"
                                  Type: ChromeOS rootfs
                                  UUID: B17FA945-2342-1144-9FC2-AC5E047F2A05
      262208           1       6  Label: "KERN-C"
                                  Type: ChromeOS kernel
                                  UUID: 70DF9D50-8129-F242-B6A5-0E3EFA269E51
                                  Attr: priority=0 tries=0 successful=0
      262209           1       7  Label: "ROOT-C"
                                  Type: ChromeOS rootfs
                                  UUID: F2FA51C1-AB2D-7542-A87C-BADAB4E98514
      266240        8192       8  Label: "OEM"
                                  Type: Linux data
                                  UUID: 2BEFEC9E-3D92-2048-B703-97F218D395FB
          64      262144       9  Label: "MINIOS-A"
                                  Type: ChromeOS kernel
                                  UUID: D2AF1CA9-B460-CA4D-97B9-27B62ECD726E
                                  Attr: priority=0 tries=0 successful=0
    25714809        4096      10  Label: "MINIOS-B"
                                  Type: ChromeOS kernel
                                  UUID: E97CD46C-C755-9C47-B1F2-511D3A3EA310
                                  Attr: priority=0 tries=0 successful=0
      274432      131072      12  Label: "EFI-SYSTEM"
                                  Type: EFI System Partition
                                  UUID: B6D5AE7D-5254-954E-9B1F-C50116D780B5
                                  Attr: legacy_boot=1
    25718920          32          Sec GPT table
    25718952           1          Sec GPT header

BUG=b:187177283, b:172226909
TEST=build_images and chromeos-install

Change-Id: Ibea34fbabfffd431f394dfa1f38cda945c73f7b4
Tested-by: Amin Hassani <>
Commit-Queue: Amin Hassani <>
Reviewed-by: Sarthak Kukreti <>
Reviewed-by: Evan Green <>
Reviewed-by: Mike Frysinger <>
2 files changed