2015-02-04 14:02:01 +00:00
|
|
|
##
|
|
|
|
# Load image to target hardware via Fastboot
|
|
|
|
#
|
|
|
|
# \param --load-fastboot-device Specify device serial number
|
|
|
|
# or path to device port
|
|
|
|
#
|
|
|
|
|
|
|
|
source [genode_dir]/tool/run/load.inc
|
|
|
|
|
2021-07-22 07:47:54 +00:00
|
|
|
proc load_fastboot_device { } { return [get_cmd_arg --load-fastboot-device ""] }
|
|
|
|
|
|
|
|
|
|
|
|
proc check_fastboot_supported { } {
|
|
|
|
|
|
|
|
if {![have_installed fastboot]} {
|
|
|
|
puts stderr "Missing installation of fastboot utility"
|
|
|
|
exit -1 }
|
|
|
|
|
|
|
|
if {![have_spec arm] && ![have_spec arm_64]} {
|
|
|
|
puts stderr "Fastboot not supported on this CPU architecture"
|
|
|
|
exit -1 }
|
|
|
|
}
|
|
|
|
|
2015-02-04 14:02:01 +00:00
|
|
|
|
|
|
|
proc run_load { } {
|
|
|
|
global load_spawn_id
|
|
|
|
|
2021-07-22 07:47:54 +00:00
|
|
|
check_fastboot_supported
|
2015-02-04 14:02:01 +00:00
|
|
|
|
|
|
|
if {![have_include "image/uboot"]} {
|
|
|
|
puts stderr "Cannot load via fastboot without a u-boot image"
|
|
|
|
}
|
|
|
|
|
|
|
|
set device [load_fastboot_device]
|
|
|
|
set uimg "[run_dir]/uImage"
|
|
|
|
|
|
|
|
# sleep a bit, board might need some time to come up
|
|
|
|
sleep 8
|
|
|
|
|
2021-07-22 07:47:54 +00:00
|
|
|
set fastboot_cmd [list fastboot]
|
|
|
|
if {$device != ""} {
|
|
|
|
lappend fastboot_cmd -s $device }
|
|
|
|
lappend fastboot_cmd boot $uimg
|
|
|
|
|
|
|
|
eval spawn {*}$fastboot_cmd
|
|
|
|
|
2015-02-04 14:02:01 +00:00
|
|
|
set load_spawn_id $spawn_id
|
|
|
|
set timeout 80
|
|
|
|
expect {
|
|
|
|
"finished. total time:" { return true; }
|
|
|
|
eof {
|
|
|
|
puts stderr "fastboot command process died unexpectedly";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
timeout {
|
|
|
|
puts stderr "Loading timed out";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|