hikey960: Re-add prebuilt UEFI binaries (#108) to build

Binaries from:
  https://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/95/hikey960/release/

Build Description:
  Build URL: https://ci.linaro.org/jenkins/job/96boards-reference-uefi-staging/MX_PLATFORM=hikey960,MX_TYPE=RELEASE,label=docker-stretch-amd64/108/
  UEFI Tools: https://git.linaro.org/uefi/uefi-tools.git
  UEFI Tools head: a47d7f8f4cc4a0ce63588ee3a89a3918f0f0751d
  EDK2: https://github.com/96boards-hikey/edk2.git
  EDK2 head: 776deafa053da51bfc999f6bc8552744fcd0f33e
  OpenPlatformPkg: https://github.com/96boards-hikey/OpenPlatformPkg.git
  OpenPlatformPkg branch: testing/hikey960_v1.3.4
  OpenPlatformPkg head: 245344ea5421ba126e1eb76484d00b590a4a78f7
  ARM Trusted Firmware: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
  ARM Trusted Firmware head: a4c979ade4438dfdd69c1b6e23b64e88eb648183
  OP-TEE OS: https://github.com/OP-TEE/optee_os.git
  OP-TEE OS head: 94ee4938f7f544d07d11721a355f445c020663ca

Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: If6bbee71c4e099ea964bfdf1e5b383158e470236
diff --git a/installer/hikey960/fip.bin b/installer/hikey960/fip.bin
new file mode 100644
index 0000000..90915b7
--- /dev/null
+++ b/installer/hikey960/fip.bin
Binary files differ
diff --git a/installer/hikey960/l-loader.bin b/installer/hikey960/l-loader.bin
new file mode 100644
index 0000000..ac0be65
--- /dev/null
+++ b/installer/hikey960/l-loader.bin
Binary files differ
diff --git a/installer/hikey960/prm_ptable.img b/installer/hikey960/prm_ptable.img
new file mode 100644
index 0000000..c81ffcf
--- /dev/null
+++ b/installer/hikey960/prm_ptable.img
Binary files differ
diff --git a/installer/hikey960/uefi-flash-all.sh b/installer/hikey960/uefi-flash-all.sh
new file mode 100755
index 0000000..fe42486
--- /dev/null
+++ b/installer/hikey960/uefi-flash-all.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+INSTALLER_DIR="`dirname ${0}`"
+ECHO_PREFIX="=== "
+
+# for cases that don't run "lunch hikey960-userdebug"
+if [ -z "${ANDROID_BUILD_TOP}" ]; then
+    ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../../
+    ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/hikey960"
+fi
+
+if [ ! -d "${ANDROID_PRODUCT_OUT}" ]; then
+    echo ${ECHO_PREFIX}"error in locating out directory, check if it exist"
+    exit
+fi
+
+echo ${ECHO_PREFIX}"android out dir:${ANDROID_PRODUCT_OUT}"
+
+function check_partition_table_version () {
+	fastboot erase reserved
+	if [ $? -eq 0 ]
+	then
+		IS_PTABLE_1MB_ALIGNED=true
+	else
+		IS_PTABLE_1MB_ALIGNED=false
+	fi
+}
+
+function flashing_atf_uefi () {
+	fastboot flash ptable "${INSTALLER_DIR}"/prm_ptable.img
+	fastboot flash xloader "${INSTALLER_DIR}"/hisi-sec_xloader.img
+	fastboot reboot-bootloader
+
+	fastboot flash fastboot "${INSTALLER_DIR}"/l-loader.bin
+	fastboot flash fip "${INSTALLER_DIR}"/fip.bin
+	fastboot flash nvme "${INSTALLER_DIR}"/hisi-nvme.img
+	fastboot flash fw_lpm3   "${INSTALLER_DIR}"/hisi-lpm3.img
+	fastboot flash trustfirmware   "${INSTALLER_DIR}"/hisi-bl31.bin
+	fastboot reboot-bootloader
+
+	fastboot flash ptable "${INSTALLER_DIR}"/prm_ptable.img
+	fastboot flash xloader "${INSTALLER_DIR}"/hisi-sec_xloader.img
+	fastboot flash fastboot "${INSTALLER_DIR}"/l-loader.bin
+	fastboot flash fip "${INSTALLER_DIR}"/fip.bin
+
+	fastboot flash boot "${ANDROID_PRODUCT_OUT}"/boot.img
+	fastboot flash system "${ANDROID_PRODUCT_OUT}"/system.img
+	fastboot flash vendor "${ANDROID_PRODUCT_OUT}"/vendor.img
+	fastboot flash cache "${ANDROID_PRODUCT_OUT}"/cache.img
+	fastboot flash userdata "${ANDROID_PRODUCT_OUT}"/userdata.img
+}
+
+function upgrading_ptable_1mb_aligned () {
+	fastboot flash xloader "${INSTALLER_DIR}"/hisi-sec_xloader.img
+	fastboot flash ptable "${INSTALLER_DIR}"/hisi-ptable.img
+	fastboot flash fastboot "${INSTALLER_DIR}"/hisi-fastboot.img
+	fastboot reboot-bootloader
+}
+
+echo ${ECHO_PREFIX}"Checking partition table version..."
+check_partition_table_version
+
+if [ "${IS_PTABLE_1MB_ALIGNED}" == "true" ]
+then
+	echo ${ECHO_PREFIX}"Partition table is 1MB aligned. Flashing ATF/UEFI..."
+	flashing_atf_uefi
+else
+	echo ${ECHO_PREFIX}"Partition table is 512KB aligned."
+	echo ${ECHO_PREFIX}"Upgrading to 1MB aligned version..."
+	upgrading_ptable_1mb_aligned
+	echo ${ECHO_PREFIX}"Flasing ATF/UEFI..."
+	flashing_atf_uefi
+	echo ${ECHO_PREFIX}"Done"
+fi
+
+fastboot reboot