From 7cb4d7bf4149cab900880fc507ade15830bd4d85 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Wed, 4 Feb 2015 15:02:01 +0100 Subject: [PATCH] run: support fastboot tool to load images Fixes #1397 --- tool/run/load/fastboot | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tool/run/load/fastboot diff --git a/tool/run/load/fastboot b/tool/run/load/fastboot new file mode 100644 index 000000000..140499b53 --- /dev/null +++ b/tool/run/load/fastboot @@ -0,0 +1,44 @@ +## +# 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 + +proc load_fastboot_device { } { return [get_cmd_arg --load-fastboot-device 1] } + +proc run_load { } { + global load_spawn_id + + if {![have_spec arm] || ![have_installed fastboot]} { + puts "No support for fastboot detected." + exit -1 + } + + 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 + + eval spawn fastboot -s $device boot $uimg + 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; + } + } +}