Skip to content

Commit 7fb8c94

Browse files
committed
aml-flash-tool: Add "reboot to fastboot" opt
Background: This is useful for installing *.zip packages, such as LineageOS. This allows you to bypass some installation steps (connecting the keyboard to the device, ADB and recovery steps, etc.). In other words, after flashing the <aml_install_package>, the final installation is performed entirely via the fastboot terminal.
1 parent 13ecac7 commit 7fb8c94

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

aml-flash-tool/flash-tool

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ target_img=
44
parts=
55
wipe=
66
reset=
7+
fastboot=
78
soc=
89
uboot_file=
910
efuse_file=
@@ -25,7 +26,7 @@ EXE=
2526
# ------
2627
show_help()
2728
{
28-
echo "Usage : $0 --img=/path/to/aml_upgrade_package.img> --parts=<all|none|bootloader|dtb|logo|recovery|boot|system|..> [--wipe] [--reset=<y|n>] [--soc=<m8|axg|gxl|txlx|g12a>] [efuse-file=/path/to/file/location] [bootloader|dtb|logo|boot|...-file=/path/to/file/partition] [--password=/path/to/password.bin]"
29+
echo "Usage : $0 --img=/path/to/aml_upgrade_package.img> --parts=<all|none|bootloader|dtb|logo|recovery|boot|system|..> [--wipe] [--reset=<y|n>] [--fastboot=<y|n>] [--soc=<m8|axg|gxl|txlx|g12a>] [efuse-file=/path/to/file/location] [bootloader|dtb|logo|boot|...-file=/path/to/file/partition] [--password=/path/to/password.bin]"
2930
echo "Version : 4.9"
3031
echo "Parameters : --img => Specify location path to aml_upgrade_package.img"
3132
echo " --parts => Specify which partition to burn"
@@ -36,6 +37,7 @@ show_help()
3637
echo " --*-file => Force overload of partition files"
3738
echo " --password => Unlock usb mode using password file provided"
3839
echo " --destroy => Erase the bootloader and reset the board"
40+
echo " --fastboot => Put the bootloader to fastboot mode, usable only without [--reset=..] argument"
3941
}
4042

4143
# Check if a given file exists and exit if not
@@ -163,6 +165,9 @@ for opt do
163165
--reset)
164166
reset="$optval"
165167
;;
168+
--fastboot)
169+
fastboot="$optval"
170+
;;
166171
--efuse-file)
167172
efuse_file="$optval"
168173
check_file $efuse_file
@@ -236,6 +241,11 @@ if [[ -z $destroy ]]; then
236241
exit 1
237242
fi
238243
fi
244+
if [[ ! -z "$reset" ]] && [[ ! -z "$fastboot" ]]; then
245+
echo "--reset | --fastboot arguments, no simultaneous input allowed"
246+
show_help
247+
exit 1
248+
fi
239249
if [[ -z $soc ]]; then
240250
soc=gxl
241251
fi
@@ -543,7 +553,7 @@ print_debug "Partition list"
543553
print_debug "--------------"
544554
for i in $(seq 0 `expr $nb_partitions - 1`)
545555
do
546-
print_debug "$i ${partitions_file[$i]} ${partitions_name[$i]} ${partitions_type[$i]}"
556+
print_debug "$i ${partitions_file[$i]} ${partitions_name[$i]} ${partitions_type[$i]}"
547557
done
548558
print_debug ""
549559

@@ -899,9 +909,9 @@ fi
899909
# -------
900910
[[ -d $tmp_dir ]] && rm -rf "$tmp_dir"
901911

902-
# Resetting board ?
903-
# -----------------
904-
if [[ "$parts" != "none" ]]; then
912+
# Resetting board ? | fastboot ?
913+
# ------------------------------
914+
if [[ "$parts" != "none" ]] && [[ -z "$fastboot" ]]; then
905915
if [[ -z "$reset" ]]; then
906916
while true; do
907917
read -p "Do you want to reset the board? y/n [n]? " reset
@@ -915,6 +925,18 @@ if [[ "$parts" != "none" ]]; then
915925
run_update bulkcmd "burn_complete 1"
916926
echo -e $GREEN"[OK]"$RESET
917927
fi
928+
elif [[ "$parts" != "none" ]] && [[ -z "$reset" ]]; then
929+
while true; do
930+
read -p "Do you want to put the board into fastboot mode? y/n [n]? " fastboot
931+
if [[ $fastboot =~ [yYnN] ]]; then
932+
break
933+
fi
934+
done
935+
if [[ $fastboot =~ [yY] ]]; then
936+
echo -n "Rebooting to fastboot "
937+
run_update bulkcmd "fastboot"
938+
echo -e $GREEN"[OK]"$RESET
939+
fi
918940
else
919941
echo "Uboot is now loaded into your board !"
920942
echo "You can use $TOOL_PATH/tools/update bulkcmd \"any uboot command\" to control uboot"

0 commit comments

Comments
 (0)