diff --git a/base-foc/run/env b/base-foc/run/env index e7f5d0e954..ccd5b25d1b 100644 --- a/base-foc/run/env +++ b/base-foc/run/env @@ -288,7 +288,7 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id return } if {[is_serial_available]} { - spawn_serial $wait_for_re $timeout_value + spawn_serial $wait_for_re $timeout_value "L4 Bootstrapper" return } diff --git a/base-hw/run/env b/base-hw/run/env index 09d130432f..edd1ab5294 100644 --- a/base-hw/run/env +++ b/base-hw/run/env @@ -207,7 +207,7 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id return } if {[is_serial_available]} { - spawn_serial $wait_for_re $timeout_value + spawn_serial $wait_for_re $timeout_value "Kernel started!" return } diff --git a/base-hw/src/core/kernel.cc b/base-hw/src/core/kernel.cc index af8f3b2439..a9a90053d5 100644 --- a/base-hw/src/core/kernel.cc +++ b/base-hw/src/core/kernel.cc @@ -1448,6 +1448,8 @@ extern "C" void kernel() /* kernel initialization */ } else { + Genode::printf("Kernel started!\n"); + /* compose kernel CPU context */ static Cpu::Context kernel_context; kernel_context.ip = (addr_t)kernel; diff --git a/tool/run b/tool/run index 9c40d08e51..cdba02714a 100755 --- a/tool/run +++ b/tool/run @@ -575,7 +575,7 @@ proc spawn_amt { wait_for_re timeout_value} { set exit_result [lindex $result 3] } sleep 5 - + # # grab output # @@ -671,23 +671,33 @@ proc exit {{status 0}} { ## # Execute scenario expecting output via serial device # -proc spawn_serial { wait_for_re timeout_value} { +proc spawn_serial { wait_for_re timeout_value kernel_msg } { global spawn_id global serial_cmd global run_target - if {$wait_for_re == "forever"} { - set timeout -1 - } else { - set timeout_value [expr $timeout_value + 30] + set retry 3 + while { $retry != 0 } { + + if {[regexp "reset" $run_target]} { + power_plug_reset + } + + eval spawn $serial_cmd + set serial_spawn_id $spawn_id + + set timeout 30 + expect { + $kernel_msg { break; } + eof { puts stderr "Serial command process died unexpectedly"; incr retry -1; } + timeout { puts stderr "Boot process timed out"; close; incr retry -1; } + } + } + if { $retry == 0 } { + puts stderr "Boot process failed 3 times in series. I give up!"; + exit -1; } - if {[regexp "reset" $run_target]} { - power_plug_reset - } - - eval spawn $serial_cmd - set serial_spawn_id $spawn_id wait_for_output $wait_for_re $timeout_value $serial_spawn_id }