blob: ad2cddf14066e13b793ad91e36303134e4c5b080 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/bin/bash
local_android_serial="B77CA9C0032DDAE"
local_android_product="hikey"
if adb devices|grep ${local_android_serial}; then
adb -s ${local_android_serial} reboot bootloader
sleep 5
fastboot devices
sleep 3
fi
num_fastboot_devices=$(fastboot devices|wc -l)
if [ ${num_fastboot_devices} -eq 0 ]; then
echo "No fastboot devices available, please check and try again"
export ANDROID_SERIAL="${local_android_serial}"
elif [ ${num_fastboot_devices} -ne 1 ] && [ -z "${ANDROID_SERIAL}" ]; then
# for local multiple devices support
export ANDROID_SERIAL="${local_android_serial}"
elif [ ${num_fastboot_devices} -eq 1 ] && [ -z "${ANDROID_SERIAL}" ]; then
device_serial=$(fastboot devices|awk '{print $1}')
export ANDROID_SERIAL="${device_serial}"
fi
product=$(fastboot getvar product 2>&1 |grep product|awk '{print $2}')
if [ "X${product}" != "X${local_android_product}" ]; then
echo "This is not a ${local_android_product} board: ${product}"
exit 1
fi
dir_parent=$(cd $(dirname ${0}); pwd)
img_dir=${1}
if [ -z "${img_dir}" ]; then
img_dir="out/target/product/hikey"
FIRMWARE_DIR="out/dist"
else
FIRMWARE_DIR="${img_dir}"
fi
if ! [ -d ${img_dir} ]; then
echo "The specified path is not a directory:${img_dir}"
exit 1
fi
function flash_image(){
local partition=$1
local file_img=$2
if [ -z "${partition}" ] || [ -z "${file_img}" ]; then
return
fi
if [ ! -e "${file_img}" ]; then
echo "${file_img} does not exist"
return
fi
echo "======= Flash ${partition} partition with file $file_img =============="
#/SATA3/nougat/out/host/linux-x86/bin/fastboot flash -w ${partition} ${file_img}
fastboot flash ${partition} ${file_img}
if [ $? -ne 0 ]; then
echo "Failed to deploy ${file_img}"
exit 1
fi
# sleep 2 after flash
sleep 2
}
#flash_image fastboot "${FIRMWARE_DIR}"/fip.bin
#flash_image boot ${img_dir}/boot_fat.uefi.img
flash_image boot ${img_dir}/boot.img
flash_image system ${img_dir}/system.img
flash_image vendor ${img_dir}/vendor.img
flash_image cache ${img_dir}/cache.img
flash_image userdata ${img_dir}/userdata.img
#fastboot flash -S 256M userdata ${img_dir}/userdata.img
#fastboot reboot
#fastboot continue
fastboot boot ${img_dir}/boot.img
|