summaryrefslogtreecommitdiff
path: root/installer
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2017-08-16 17:39:25 +0800
committerJohn Stultz <john.stultz@linaro.org>2018-03-15 14:03:47 -0700
commita4a4c27057df11fa6865a96821d1e3527c8ef2d0 (patch)
treef4ae5ae2c29947f622b57ddf7134f6ae3ea35720 /installer
parent7087633b4d393a8396843f34b0e40062c20f7187 (diff)
downloadhikey-a4a4c27057df11fa6865a96821d1e3527c8ef2d0.tar.gz
hikey960: installer: Update flash-all.sh for UEFI flashing
This patch changes the flash-all script to flash the UEFI binaries. It first checks whether the partition type is 1MB aligned. If not, it will upgrade old fastboot bootloader from using 512KB ptable to using 1MB ptable. Then, once the 1MB aligned ptable is installed, it upgrades to ATF/UEFI bootloader. And to better distinguish echo messages from fastboot command output, define ${ECHO_PREFIX} and use it with all echo commands. NOTE: This change depends on the boot.img being created uses a Image-dtb style kernel, rathern then an Image.gz. Originally by Guodong Xu Change-Id: Id9a39c318e3c7d07a3e865d617d2cc4465e581a2 Signed-off-by: Guodong Xu <guodong.xu@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'installer')
-rwxr-xr-xinstaller/hikey960/flash-all.sh75
1 files changed, 60 insertions, 15 deletions
diff --git a/installer/hikey960/flash-all.sh b/installer/hikey960/flash-all.sh
index 646e462d..fd4e7acc 100755
--- a/installer/hikey960/flash-all.sh
+++ b/installer/hikey960/flash-all.sh
@@ -1,6 +1,7 @@
#!/bin/bash
INSTALLER_DIR="`dirname ${0}`"
+ECHO_PREFIX="=== "
# for cases that don't run "lunch hikey960-userdebug"
if [ -z "${ANDROID_BUILD_TOP}" ]; then
@@ -9,22 +10,66 @@ if [ -z "${ANDROID_BUILD_TOP}" ]; then
fi
if [ ! -d "${ANDROID_PRODUCT_OUT}" ]; then
- echo "error in locating out directory, check if it exist"
+ echo ${ECHO_PREFIX}"error in locating out directory, check if it exist"
exit
fi
-echo "android out dir:${ANDROID_PRODUCT_OUT}"
-
-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
-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 flash boot "${ANDROID_PRODUCT_OUT}"/boot.img
-fastboot flash dts "${ANDROID_PRODUCT_OUT}"/dt.img
-fastboot flash system "${ANDROID_PRODUCT_OUT}"/system.img
-fastboot flash cache "${ANDROID_PRODUCT_OUT}"/cache.img
-fastboot flash userdata "${ANDROID_PRODUCT_OUT}"/userdata.img
+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 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