The forkpty check was compiled without including <pty.h>, which is
the header that declares the function. On stricter toolchains, and in
some cross builds, that can make Meson conclude that forkpty is not
available from libc even when the target provides it there.
The fallback then looked for a separate libutil as a required library.
That breaks modern glibc targets where forkpty moved into libc and no
separate libutil is available for Meson to find.
Include <pty.h> in the function probe so libc implementations are
detected correctly. Keep libutil as an optional compatibility fallback
for older targets that still need it, without failing configuration
when the separate library is absent.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Ubuntu noble still ships libgpiod 1.x, which selects the local-gpio v1
implementation. That path declared struct gpiod_line_request_config
without initializing the whole structure before passing it to libgpiod,
leaving padding or future fields undefined under stricter toolchains.
Zero-initialize the request configuration before filling the fields
cdba uses, matching the defensive style needed for older supported
distributions and newer compilers.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The Alpine clang jobs fail during Meson compiler setup rather than
during source compilation. Installing clang alone does not guarantee
the complete native build environment needed for compiler sanity
checks, linking, and startup objects on Alpine.
Install build-base in the Alpine CI setup so both gcc and clang jobs
have the standard compiler, libc, binutils, and make toolchain expected
by Meson.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Debian testing no longer provides the legacy libftdi-dev package used
by the CI install scripts. As a result, native, i386, and
cross-compile Debian testing jobs fail at apt install before the build
starts.
Install libftdi1-dev instead. The Meson build already prefers the
libftdi1 pkg-config dependency, so this matches the dependency that
the source is actually using.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Several scheduled jobs are failing because the matrix still includes
release-specific container images for distributions that have reached
end of life. These images may still be pullable, but their package
repositories are no longer maintained in the normal location and can
fail during dependency installation.
Remove the EOL Debian buster, Ubuntu oracular, and fixed Fedora
release jobs. Keep rolling and moving targets such as debian:testing,
alpine:edge, and latest tags so CI continues to catch issues users
may see on active distributions.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
GitHub Actions now warns that actions targeting Node.js 20 are
being forced to run on Node.js 24. The warning is emitted by
actions/checkout@v4 in every matrix job, which obscures the real
CI failures and will eventually become a hard compatibility problem
as Node 20 support is removed from runners.
Move to actions/checkout@v5 so the workflow uses an action version
that is compatible with the current runner JavaScript runtime.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The newly introduced support for QDL-based remote flashing of devices is
powerful, but provides an easy way to alter shared boards in unwanted
ways.
Introduce an optional "qdl_access" entry to the device configuration,
which allows to specify a list of entries each one defining a set of
users and their accepted flash targets.
A special target "all" can be used to give e.g. administrators
unrestricted access to the flash.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The open-coded parsing of the "users" object in parse_board() makes the
parse loop unnecessarily long, and with the upcoming introduction of
a QDL access list this would be an even bigger problem.
Extract the "users" parsing into a helper function of it own, to clean
up the code and prepare for the introduction of parsing of "qdl_access".
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The inactivity timeout is only bumped on incoming messages on stdout.
But during upload of images (MSG_FASTBOOT_DOWNLOAD or MSG_EDL_DOWNLOAD)
there is no traffic on stdout. Likewise MSG_EDL_WRITE would trigger the
write of an image to the storage media, which will emit updated on
stderr.
Both of these additional pipes represents activity, so let's bump the
timeout there as well.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
With the server supporting alternative power-on mechanisms, EDL
notifications and flashing support, the client interface can now be
implemented.
Allow a series of "write <target> <image>" arguments on the command line
register images and their target. Request the server to power on the
device into the newly supported EDL state, then as the EDL notification
arrives push the images and request them to be flashed by the server.
It is assumed that the flashing operations is only desired on the first
discovery of a device in EDL mode at this time, as test-scenarios across
reboot typically doesn't involve resetting storage content.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The boot payload can be massive (GBs) so queueing it upfront will
consume a lot of RAM, unnecessarily. Allow the transmit queue to carry
references to a file descriptor instead of the actual payload.
As the queue is consumed each chunk is read from the file and
transmitted. As we use zero-length messages to represent EOF, let's use
that as our signal for closing the file descriptor as well.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
For some unknown reason, when I wrote this I choose to build the
outgoing messages in an event-based manner, queuing the operation that
will produce the message, rather than just queuing the message directly.
Let's simplify this by just queueing the actual messages directly and
change the main loop to simply drain the queue.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The client can now request the device to enter EDL mode and the server's
device and driver model can power up the board to this state.
Introduce four new messages to the cdba protocol:
- EDL_PRESENT: used by the server to signal the presence of the EDL
device
- EDL_DOWNLOAD: used by the client to transfer a binary blob to the
server, mimicing the fastboot protocol
- EDL_WRITE: used by the client to indicate the target for the
downloaded binary blob. The server may start flashing the image if
supported.
- EDL_RESET: used by the client to request that the flash operations are
finalized and the board restarts.
Introduce a new "EDL" module that will look for EDL USB devices and if
found signal the client about its presence.
Implement EDL_DOWNLOAD by streaming the incoming blob into a temporary
file, let EDL_WRITE tag the image with information about where it should
be written. Then as we're relying on QDL, invoke the external tool as
part of the EDL_RESET, "flushing out" the pending operations.
Support for matching EDL device by serial number is left as a todo item.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
When the EDL key is held during power up, the device will enter EDL
mode, making the board ready for firmware flashing.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
In order to implement flash support, as well as aid in maintenance
situations, support for requesting the board to be powered on into
EDL/flashing mode is useful.
So far the payload of the MSG_POWER_ON message has been ignored by the
server, so we can tread the absence of payload as "NORMAL" power on
request and introduce the power_on_mode enumeration to define the values
in this (optional) byte.
A new key definition is also added to the protocol, representing the
holding down the EDL "key", but not exposed on the client side yet.
The device logic is wired up such that the power-on sequence will now
request the drivers to hold the EDL key while powering on, if the
power-on mode is "EDL".
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Moving between the Linux kernel's list.h and this one is confusing, as
list_add() prepends in one case and appends in the other. Rename the
function to clarify the API. Introduce an operation for those cases
where a prepend is desired.
Also introduce a list_len() operation, which can be useful to save
clients from open-coding this.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
On some Alpaca boards the power key needs to be pressed for longer than
the default duration, otherwise the board powers down automatically.
Add a 'power_key_press_ms' board configuration property to allow
specifying the duration in milliseconds.
Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
PIC32CX is a newer debug board used on automotive platforms like
sa8797p. It uses human-readable commands over serial but speaks a
different dialect than alpaca. Add a new driver to support it and extend
available config options.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>