Commit Graph

31 Commits

Author SHA1 Message Date
Dmitry Baryshkov
74e51393b9 cdba: extract message-sending helper
Instad of hand-coding message sending, create a single wrapper that
sends messages to the server.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-09-29 00:45:24 +03:00
Dmitry Baryshkov
bfcbff6439 cdba: fix console handling
Current default is to interpret 20 tilde characters as a signal to power
cycle the board and if there are no power cycles left to exit cdba.
Unfortunately gcc started spurting tilde chars in compile log, so
compiling software on the cdba target can cause cdba exit.

Change the defaults so that by default cdba doesn't interpret received
lines. One can specify '-c 0' on the cdba command line to restore
previous behaviour.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-09-21 13:36:58 +03:00
Krzysztof Kozlowski
647a6c59ad cdba: fix -Wpointer-arith
Pointer arithmetic should not be done on void pointers.

  cdba.c: In function ‘fastboot_work_fn’:
  cdba.c:377:38: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
    377 |         memcpy(msg->data, work->data + work->offset, left);

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Bjorn Andersson
983ec44099 cdba: Support specifying cdba-server path
For debug purposes it's useful to install a user-local version of the
cdba-server and invoke this instead, rather then having to change the
code add a flag to support specifying this on the command line.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-02-22 11:04:09 -06:00
Dmitry Baryshkov
dde2030cda cdba: allow specifying symlink as a boot file
cdba will choke with 'is not a regular file' message if one specifies
symlink as a boot file argument. Support using symlinks as a boot file.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
2021-01-21 08:56:58 -08:00
Bjorn Andersson
b01431a83d cdba: Print "Waiting for ssh" only for boot
For list and info the "Waiting for ssh" message is anoying, remove it.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-29 01:14:02 -07:00
Bjorn Andersson
4cabc1c827 Support device "description"
Add a new keyword "description" to the config file, add the necessary
wire protocol to acquire this string for a given device and introduce
the "-i" option to cdba to trigger its retrieval.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-29 01:02:57 -07:00
Bjorn Andersson
4fee7ed011 cdba: Remove unused struct
I forgot to remove the board_list_request struct as I rewrote the code,
drop it now.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-29 00:59:39 -07:00
Bjorn Andersson
afc61c7f6a cdba: Invoke cdba-server from $PATH
Rather than hard coding the server side path to
sandbox/cdba/cdba-server, just invoke cdba-server and rely on the server
side to have the tool in $PATH.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-29 00:07:16 -07:00
Bjorn Andersson
d094208e7c cdba: Add support for listing boards
Add a new argument '-l' which in combination with '-h' will connect to
said server and list the attached devices, then exit.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-28 23:47:56 -07:00
Bjorn Andersson
72c373451c cdba: Exit nicely on communication error
Receiving an invalid command should lead to termination of the client,
but doing so abruptly will cause the termios not to be reset.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-28 23:43:59 -07:00
Amit Kucheria
c5cbe74df2 bad: Rename to cdba-server
cdba-server more accurately reflects its purpose now.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2020-06-10 10:10:23 -07:00
Bjorn Andersson
bf2521dcdb cdba: Distinguish between timeout before and after fastboot
Exit with error code 2 if a timeout occured before fastboot had finished
executing, to allow scripts to determine if the kernel timed out or if
the board didn't finish fastboot.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-05-20 22:42:21 -07:00
Bjorn Andersson
ca0564cdbb cdba: Revamp timeout handling to support both -t and -T
Revamp the implementation of timeouts, to allow for both a total timeout
(-t) and an inactivity timeout -T at the same time. This is useful for
CI-loops where a board ending up in download mode should be
released quickly (due to inactivity), but a full test can be rather
extensive.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-04-30 21:17:40 -07:00
Bjorn Andersson
6efa136d8c cdba: Don't default to fastboot endlessly
The current scheme of endlessly rebooting means that we spend -t amount
of time to boot the device over and over if the device crashes early.

Add a new flag -R which does this, but change the default so that if we
see the device showing up again in fastboot we consider it rebooted and
quits.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-04-09 16:18:14 -07:00
Bjorn Andersson
c066821d1d cdba: Ensure status printouts are flushed
Using printf() for printing the status string often ended up in the
printf buffer and wasn't flushed out until cdba was exiting cleanly. Use
write() to get it out immediately instead.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-04-09 15:49:40 -07:00
Bjorn Andersson
f068352970 cdba: Support sending break with CDB assist
Add special key 'B' to send a break, currently only implemented with the
CDB assist.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-08-26 10:10:49 -07:00
Bjorn Andersson
91ee23ae86 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>
2019-08-13 12:40:19 -07:00
Bjorn Andersson
ab93bc2255 cdba: -t should always disable inactivity timeout
Specifying -t means that inactivity timeout should be disabled,
regardless of the value. Specifying either -t 0 or -T 0 will set timeout
to 0, which means no timeout, regardless of timeout_on_inactivity.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-08-01 11:19:27 -07:00
Amit Kucheria
8fa6fc9a2f cdba: Make inactivity timeout a default
Reverse the logic of inactivity timeout so that by default we set
inactivity timeout to 600s. Passing -T 0 disables inactivity timeout
completely.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2019-01-12 23:40:08 -08:00
Bjorn Andersson
eacf76b7b9 cdba: Support inactivity timeout
In addition to have a fixed timeout (-t) introduce a new inactivity
timeout (-T) which allow us to provide a shorter timeout to quickly
abort when the kernel fails to boot but still allow us to run lengthy
test scripts without getting a timeout.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-11-30 11:36:07 -08:00
Bjorn Andersson
1e92a38df1 cdba: Make exit code reflect exit cause
Make the exit code non-zero when the cdba for some reason failed, to
allow tools calling cdba to differentiate the various scenarios.

There is still some tuning needed here, but for now we exit with error
code 110 if we reached a timeout, 1 if there was an error and 0 if we
either exited by user request or by hitting the power-off token.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-11-30 11:23:54 -08:00
Bjorn Andersson
7c12435aae cdba: Gracefully handle stdin not being a tty
In the event that cdba is launched from e.g. a cron job stdin won't be a
tty and as such we can't modify the termios settings.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-11-30 11:23:54 -08:00
Bjorn Andersson
6b334bd512 cdba: Add support for timeout
Support specifying a timeout -t in order to limit the execution time of
stalling test runs.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-04-11 16:35:33 -07:00
Bjorn Andersson
6c5bd3c77e cdba: Add license header where missing
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-03-12 19:09:15 -07:00