Merge "Revert "use HW Keystore""
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 55ec8b2..3d2f8ae 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -29,7 +29,7 @@
 $(call add_peripheral, intel, sensors/mraa)
 
 BOARD_SYSTEMIMAGE_PARTITION_SIZE := 268435456
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 134217728
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 536870912
 BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456
 BOARD_U_BOOT_ENV_SIZE := 0x10000
 
diff --git a/base_product/weaved.conf b/base_product/weaved.conf
index 979e5f1..fd8f73d 100644
--- a/base_product/weaved.conf
+++ b/base_product/weaved.conf
@@ -1,5 +1,5 @@
 #
-# Copyright 2015 The Android Open Source Project
+# Copyright 2015-2016 The Android Open Source Project
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -24,17 +24,17 @@
 # api_key=
 
 # Human readable name of the device.
-name=Edison Starter Board
+name=Intel Edison Starter Board
 
 # Human readable description of the device.
 # Defaults to empty string"
-description=Intel Edison Board
+description=Intel Edison Brillo Starter Board
 
 # Location of the device.
 # location=
 
 # Manufacturer of the device.
-oem_name=Intel
+oem_name=Intel Corporation
 
 # Model of the device.
 # Defaults to Brillo.
@@ -42,7 +42,7 @@
 
 # Five character code assigned by the cloud registry of device models.
 # Defaults to "AAAAA" (Unregistered model).
-model_id=AAAAA
+model_id=ABPHb
 
 # Maximum role for local anonymous user.
 # local_anonymous_access_role=viewer
@@ -65,7 +65,7 @@
 # wifi_auto_setup_enabled=true
 
 # List of pairing modes supported by device.
-# Values can be one of: pinCode, embeddedCode.
+# See Weave documentation for supported pairing modes
 # Defaults to pinCode if embedded_code_path is empty, or embeddedCode otherwise.
 pairing_modes=embeddedCode
 
diff --git a/flash_tools/FlashEdison.json b/flash_tools/FlashEdison.json
index 4309b56..7e77499 100644
--- a/flash_tools/FlashEdison.json
+++ b/flash_tools/FlashEdison.json
@@ -37,7 +37,7 @@
                 "args": "flash gpt ${gpt_file}"
             },
             {
-                "restrict": ["full", "os", "non_os"],
+                "restrict": ["full", "os"],
                 "retry": 2,
                 "mandatory": true,
                 "description": "Flashing u-boot",
@@ -86,7 +86,7 @@
                 "retry": 2,
                 "mandatory": true,
                 "description": "Flashing data",
-                "timeout": 60000,
+                "timeout": 120000,
                 "tool": "fastboot",
                 "args": "flash userdata ${userdata_file}"
             },
@@ -97,7 +97,7 @@
                 "description": "Setting slot 0 active",
                 "timeout": 1200000,
                 "tool": "fastboot",
-                "args": "oem set_active 0"
+                "args": "set_active _a"
             },
             {
                 "restrict": ["full", "os", "update"],
diff --git a/flash_tools/brillo-flashall-edison.bat b/flash_tools/brillo-flashall-edison.bat
index 4f17f5d..b6e8b90 100755
--- a/flash_tools/brillo-flashall-edison.bat
+++ b/flash_tools/brillo-flashall-edison.bat
@@ -25,4 +25,4 @@
 fastboot flash boot_b   boot.img
 fastboot flash system_b system.img
 fastboot flash userdata userdata.img
-fastboot oem set_active 0
+fastboot set_active _a
diff --git a/flash_tools/brillo-flashall-edison.sh b/flash_tools/brillo-flashall-edison.sh
index 761301b..17b53b2 100755
--- a/flash_tools/brillo-flashall-edison.sh
+++ b/flash_tools/brillo-flashall-edison.sh
@@ -3,8 +3,6 @@
 # Only execute this script on a Brillo provisioned Edison.
 # See your Brillo-Edison online information for initial provisioning and recovery.
 
-set -e
-
 function dir_with_file() {
     local file=${1}; shift
     local dir;
@@ -34,6 +32,16 @@
     "${LOCAL_DIR}" \
     "${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.
+# 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 "$@"
+if [ $? -ne 0 ]; then
+    fastboot flash u-boot "${VENDOR}"/u-boot-edison.bin \
+             reboot bootloader \
+             "$@"
+fi
+
 fastboot flash gpt     "${VENDOR}"/gpt.bin \
 	flash u-boot   "${VENDOR}"/u-boot-edison.bin \
 	flash boot_a   "${OS}"/boot.img \
@@ -41,5 +49,5 @@
 	flash boot_b   "${OS}"/boot.img \
 	flash system_b "${OS}"/system.img \
 	flash userdata "${OS}"/userdata.img \
-	oem set_active 0 "$@"
-
+	set_active _a \
+	"$@"