cdba: Add -C argument for power-cycle on success only

When using cdba to bisect for intermittent issues related to boot
lockups or crashes taking us to download mode it's only useful to
power-cycle on success (as a failure case shows the intermittent
problem).

Add a special version of the existing power cycle code, that stops the
power cycling loop if a timeout criteria is hit, cutting down on
unnecessary reboots of a broken kernel.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Bjorn Andersson
2019-08-13 12:40:19 -07:00
parent ab93bc2255
commit 91ee23ae86

9
cdba.c
View File

@@ -467,6 +467,7 @@ static void usage(void)
int main(int argc, char **argv)
{
bool power_cycle_on_timeout = true;
bool timeout_on_inactivity = true;
struct termios *orig_tios;
struct work *next;
@@ -487,11 +488,14 @@ int main(int argc, char **argv)
int opt;
int ret;
while ((opt = getopt(argc, argv, "b:c:h:t:T:")) != -1) {
while ((opt = getopt(argc, argv, "b:c:C:h:t:T:")) != -1) {
switch (opt) {
case 'b':
board = optarg;
break;
case 'C':
power_cycle_on_timeout = false;
/* FALLTHROUGH */
case 'c':
power_cycles = atoi(optarg);
break;
@@ -537,6 +541,9 @@ int main(int argc, char **argv)
if (!power_cycles)
break;
if (reached_timeout && !power_cycle_on_timeout)
break;
printf("power cycle (%d left)\n", power_cycles);
fflush(stdout);