forked from BoatPeopleBRTIK/build-artik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flash_all_by_fastboot.sh
executable file
·66 lines (55 loc) · 1.27 KB
/
flash_all_by_fastboot.sh
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
#!/bin/bash
OUTPUT_DIR=`pwd`
MIGRATE_UBOOT=false
print_usage()
{
echo "-h/--help Show help options"
echo "-o Specify directory of output files"
echo "-m Specify option to migrate bootloader"
exit 0
}
parse_options()
{
for opt in "$@"
do
case "$opt" in
-h|--help)
print_usage
shift ;;
-o)
OUTPUT_DIR="$2"
shift ;;
-m)
MIGRATE_UBOOT=true
shift ;;
*)
shift ;;
esac
done
}
parse_options "$@"
if $MIGRATE_UBOOT; then
echo "Migrate to new bootloader..."
sudo fastboot flash bootloader $OUTPUT_DIR/u-boot-recovery.bin
sudo fastboot reboot-bootloader
sleep 4
fi
echo "Fusing bootloader binaries..."
sudo fastboot flash fwbl1 $OUTPUT_DIR/bl1.bin
sudo fastboot flash bl2 $OUTPUT_DIR/bl2.bin
sudo fastboot flash bootloader $OUTPUT_DIR/u-boot.bin
sudo fastboot flash tzsw $OUTPUT_DIR/tzsw.bin
sudo fastboot flash env $OUTPUT_DIR/params.bin
sudo fastboot reboot-bootloader
sleep 4
echo "Formatting user partition"
sudo fastboot oem format
sleep 4
echo "Fusing boot image..."
sudo fastboot flash boot $OUTPUT_DIR/boot.img
echo "Fusing modules image..."
sudo fastboot flash modules $OUTPUT_DIR/modules.img
echo "Fusing rootfs image..."
sudo fastboot flash rootfs $OUTPUT_DIR/rootfs.img
sudo fastboot reboot
echo "Fusing done"