Add support for Brillo Partitioning Tool

The gpt image is created by BPT using
the device-partitions.bpt file.

Flashfiles archive and the provision script are
updated in order to flash partition-table.img as
gpt.

An updated u-boot is needed for this to work.

BUG=28252130

Change-Id: Iaed9f0bba00a2f2f4554ee8901ab313a6815576f
Tracked-On: https://jira01.devtools.intel.com/browse/BP-378
Signed-off-by: Irina Patru <irina.patru@intel.com>
Signed-off-by: Stefan Stanacar <stefan.stanacar@intel.com>
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 829e84e..0688720 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -32,7 +32,7 @@
 # Bootctrl HAL
 $(call add_peripheral, intel, bootctrl)
 
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 268435456
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 536870912
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 536870912
 BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456
 BOARD_U_BOOT_ENV_SIZE := 0x10000
@@ -62,10 +62,11 @@
 BOARD_SEPOLICY_DIRS += \
     device/intel/edison/sepolicy
 
+BOARD_BPT_INPUT_FILES += device/intel/edison/device-partitions.bpt
+
 vendor_partition_directory := vendor/bsp/intel/edison
 BRILLO_VENDOR_PARTITIONS := \
-    $(vendor_partition_directory)/uboot_firmware:u-boot-edison.bin \
-    $(vendor_partition_directory)/uboot_firmware:gpt.bin
+    $(vendor_partition_directory)/uboot_firmware:u-boot-edison.bin
 
 DEVICE_PACKAGES += peripheral_io.$(TARGET_DEVICE)
 
diff --git a/build/tasks/flashfiles.mk b/build/tasks/flashfiles.mk
index fb070d3..f4d5785 100644
--- a/build/tasks/flashfiles.mk
+++ b/build/tasks/flashfiles.mk
@@ -18,7 +18,7 @@
 EDISON_FLASHFILES := $(INSTALLED_BOOTIMAGE_TARGET)
 EDISON_FLASHFILES += $(INSTALLED_SYSTEMIMAGE)
 EDISON_FLASHFILES += $(INSTALLED_USERDATAIMAGE_TARGET)
-EDISON_FLASHFILES += $(EDISON_UBOOT)/gpt.bin
+EDISON_FLASHFILES += $(PRODUCT_OUT)/partition-table.img
 EDISON_FLASHFILES += $(EDISON_IFWI)/edison_ifwi-dbg-00.bin \
                      $(EDISON_IFWI)/edison_dnx_fwr.bin \
                      $(EDISON_IFWI)/edison_dnx_osr.bin
diff --git a/device-partitions.bpt b/device-partitions.bpt
new file mode 100644
index 0000000..d4bb07b
--- /dev/null
+++ b/device-partitions.bpt
@@ -0,0 +1,22 @@
+{
+	"settings": {
+		"disk_size": "3.64 GiB"
+	},
+	"partitions": [
+	{
+		"label": "u-boot",
+		"size": "4980 KiB",
+		"type_guid": "linux_fs",
+		"position": 1
+	},
+	{
+		"label": "security",
+		"size": "3 MiB",
+		"position": 2
+	},
+	{
+		"label": "sfitables",
+		"size": "1 MiB"
+	}
+	]
+}
diff --git a/flash_tools/FlashEdison.json b/flash_tools/FlashEdison.json
index 7e77499..8d03f29 100644
--- a/flash_tools/FlashEdison.json
+++ b/flash_tools/FlashEdison.json
@@ -175,7 +175,7 @@
             "gpt_file": {
                 "type": "file",
                 "description": "Partition Table",
-                "value": "gpt.bin",
+                "value": "partition-table.img",
                 "name": "Partition Table"
             }
         },
diff --git a/flash_tools/brillo-flashall-edison.bat b/flash_tools/brillo-flashall-edison.bat
index b6e8b90..4ac8373 100755
--- a/flash_tools/brillo-flashall-edison.bat
+++ b/flash_tools/brillo-flashall-edison.bat
@@ -18,7 +18,7 @@
 :: Only execute this script on a Brillo provisioned Edison.
 :: See your Brillo-Edison online information for initial provisioning and recovery.
 
-fastboot flash gpt      gpt.bin
+fastboot flash gpt      partition-table.img
 fastboot flash u-boot   u-boot-edison.bin
 fastboot flash boot_a   boot.img
 fastboot flash system_a system.img
diff --git a/flash_tools/brillo-flashall-edison.sh b/flash_tools/brillo-flashall-edison.sh
index 17b53b2..f7ecafd 100755
--- a/flash_tools/brillo-flashall-edison.sh
+++ b/flash_tools/brillo-flashall-edison.sh
@@ -33,16 +33,16 @@
     "${ANDROID_BUILD_TOP}/vendor/bsp/intel/edison/uboot_firmware")
 
 #
-# Due to possible changes in the u-boot version, we might have some issues flashing gpt.bin.
+# Due to possible changes in the u-boot version, we might have some issues flashing gpt.
 # If we do have a failure, we must first re-flash u-boot and reboot to the new u-boot.
-fastboot flash gpt "${VENDOR}"/gpt.bin "$@"
+fastboot flash gpt "${OS}"/partition-table.img "$@"
 if [ $? -ne 0 ]; then
     fastboot flash u-boot "${VENDOR}"/u-boot-edison.bin \
              reboot bootloader \
              "$@"
 fi
 
-fastboot flash gpt     "${VENDOR}"/gpt.bin \
+fastboot flash gpt     "${OS}"/partition-table.img \
 	flash u-boot   "${VENDOR}"/u-boot-edison.bin \
 	flash boot_a   "${OS}"/boot.img \
 	flash system_a "${OS}"/system.img \