31 Commits
Author SHA1 Message Date
Igor Opaniuk 1b9e6894b9 github: package self-contained binaries on Linux and macOS
The release artifacts were not self-contained. qdl links libxml2 and
libzip (and, on Linux, their transitive closure), but packaging copied
only a subset of those libraries, so qdl failed to start on hosts
without them installed. Inspecting the uploaded artifacts:

  Artifact         Missing                       Status
  ---------------  ----------------------------  ------
  ubuntu-22-x64    libxml2.so.2, libzip.so.4     broken
  ubuntu-22-arm64  libxml2.so.2, libzip.so.4     broken
  ubuntu-24-x64    libxml2.so.2, libzip.so.4     broken
  ubuntu-24-arm64  libxml2.so.2, libzip.so.4     broken
  macos-arm64      libzip.5.dylib (Homebrew)     broken
  macos-intel      libzip.5.dylib (Homebrew)     broken
  windows-x64      -                             ok
  windows-arm64    -                             ok

On Linux only libusb was copied; libxml2 and libzip (plus their closure:
libz, liblzma, libzstd, libbz2, libcrypto, libudev) were left to the
host. On macOS libzip was never handled, so the binary kept an absolute
Homebrew path to libzip.5.dylib. Windows already bundled the full set.

Bundle the complete dependency closure on Linux (every ldd entry except
the C runtime and dynamic loader) and set an $ORIGIN RUNPATH on the
binary and each bundled library, since RUNPATH is not inherited by
transitively-loaded libraries.

On macOS, use dylibbundler to recursively copy the non-system dylibs and
rewrite the load commands to @executable_path, replacing the
hand-maintained install_name_tool calls that missed libzip.

Both jobs now fail if any non-system library remains unresolved after
packaging.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-06-27 20:49:13 -05:00
Igor Opaniuk a34e571bf4 github: request reviews from qdl-maintainers via CODEOWNERS
Add a CODEOWNERS file so every pull request automatically requests a
review from the @linux-msm/qdl-maintainers team, instead of relying on
contributors to add reviewers by hand. The wildcard pattern covers the
whole tree; ownership can later be narrowed per path if needed.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-06-19 11:40:40 +02:00
Bjorn Andersson afc45eaa01 github: Include missing build artifacts in Windows build
The dependencies has been extended, but necessary dll files was not
added to the list of artifacts. Fix this to make it possible to run the
artifacts.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2026-05-14 22:35:31 -05:00
Bjorn Andersson bfc844ab25 tests: Introduce tests for program loading
The parsing of rawprogram files as well as the fallback and precedence
rules, is complex and subject for upcoming changes as part of the
introduction of contents XML support.

Introduce cmocka and a set of test cases to validate the <program>
entries in the rawprogram files are handled as expected.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2026-05-12 08:47:09 -05:00
Bjorn Andersson 9accf645f4 github: Run meson test with --print-errorlogs
When tests fail it is useful to know why, so print out the error log.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2026-05-12 08:47:09 -05:00
Igor Opaniuk d3d806cbe3 checkpatch: Run per-commit range checks locally and in CI
Until now checkpatch had two divergent code paths: the local meson
'check' target ran 'checkpatch.pl --no-tree -f' against every tracked
source file, while the CI workflow used the webispy/checkpatch-action
action, which runs checkpatch in patch mode against each commit in the
PR. The two modes report different defects -- in particular, file mode
flags style issues in long-untouched code and skips commit-log checks,
while patch mode validates the commit message (Signed-off-by, subject
length, ...) and only inspects added/changed lines. Contributors could
end up with a green local 'check' but a red CI run, and vice versa.

Introduce a 'check-range' mode in scripts/checkpatch_wrapper.sh that
mirrors what the GitHub Action does: iterate over every commit in
CHECKPATCH_BASE..CHECKPATCH_HEAD (defaulting to origin/master..HEAD),
feed each commit through 'git format-patch -1 --stdout' and pipe the
result into checkpatch.pl. All commits are processed even on failure
so the user sees every offending commit in one go.

Expose the new mode as a meson run_target ('meson compile check-range
-C build') and switch the CI workflow to invoke the wrapper directly
with the PR base/head SHAs, so local and CI invocations exercise the
exact same code path. Document the new target in README under the
Contributing section.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-05-04 21:25:07 -05:00
Igor Opaniuk 00f1b9bb0f markdown-lint: Add wrapper script and meson target
The markdown lint check previously only ran in CI via the
markdownlint-cli2 GitHub Action, which meant developers had no
straightforward way to reproduce the check locally before pushing. As a
result, contributors only discovered lint errors after opening a PR.

Introduce scripts/markdownlint_wrapper.sh that drives mdl on the same
set of files the CI workflow lints. mdl is shipped as a Debian/Ubuntu
package, so contributors can install it with 'sudo apt install mdl'
without pulling in a Node.js toolchain. Wire the wrapper up as a meson
run_target so it can be invoked with:

  meson compile markdown-lint -C build

Switch the markdown-lint workflow to install mdl from apt and invoke
the wrapper directly, making the script the single source of truth for
both local and CI runs. Document the usage in README under the
Contributing section.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-05-04 21:25:07 -05:00
Bjorn Andersson 2e60a77adc tests: Introduce dry-run test of flashmap flashing
The flashmap support saves the user from having to specify programmer,
program and patch XML files, it allows reading the flashmap.json either
among the flat files, or as part of a zip-container of all the parts.

Add dry-run tests for the two cases, by introducing a flashmap.json and
zipping up all the files, then run qdl on the two versions.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2026-04-22 17:14:46 -05:00
Bjorn Andersson 457e2e830a flashmap: Introduce support for consuming a zip file
The flashmap and related files form a package, suitable for distribution
and one-step installation, but having to unzip the archive in order to
flash/install its content is not convenient for the user.

Extend the qdl_file helper code to also provide access to files within a
zip file, then extend the flashmap code to attempt to decode the package
file as such.

Pass the optional zip object around to the various places where we might
read files from the package.

With this we can now "flash" the installer.zip directly:

  qdl flash installer.zip

The selective flashing mechanism is carried into the zip handling,
allowing the user to flash specific memories only, such as:

  qdl flash installer.zip::spinor

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2026-04-22 17:14:46 -05:00
Igor Opaniuk ff189b1a12 build: migrate from GNU Make to Meson build system
Replace the existing Makefile-based build system with Meson to improve
build performance, cross-platform support, and maintainability.

Key improvements:

* Build performance: Shared source files (sahara.c, util.c, oscompat.c,
  ux.c, sim.c, io.c) are now compiled once and linked into multiple
  targets instead of being compiled separately for each executable.
  This reduces total compilation units from ~30 to ~20 and speeds up
  build.

  Full build benchmark results below

  Before (Make): $ time make
  ...
  real    0m1.668s
  user    0m1.424s
  sys     0m0.242s

  After (Meson): $ time bash -c '
  meson setup build
  meson compile -C build
  '
  ...
  real    0m0.759s
  user    0m0.877s
  sys     0m0.237s

* Flexible build directory: Unlike Make which builds in-tree, Meson
  supports out-of-tree builds with custom build directories.

  Example workflows:
    meson setup builddir              # Default debug build
    meson setup build-release --buildtype=release
    meson setup build-asan -Db_sanitize=address
    meson setup build-arm64 --cross-file=aarch64-linux.txt

  This enables:
  - Multiple build configurations simultaneously
  - Clean source tree (no .o files polluting git status)
  - Easy comparison between debug/release builds
  - Separate builds for different architectures

* Cross-compilation: Native support for cross-compilation via Meson
  cross-files enables building for multiple architectures without
  requiring separate build runners for each target platform.

  Before (Make): Requires native ARM64 runner in GitHub Actions
    runs-on: ubuntu-24.04-arm  # Dedicated ARM64 hardware
    run: make

  After (Meson): Cross-compile from x64 host
    runs-on: ubuntu-24.04  # x64 host
    run: |
      meson setup build-arm64 --cross-file=ci/aarch64-linux.txt
      meson compile -C build-arm64

* Automatic dependency tracking: Meson automatically tracks header
  dependencies, eliminating the need for manual dependency declarations
  and preventing missed recompilation on header changes.

  Before (Make): Manual dependency tracking
    util.o: version.h  # Must be manually maintained

  After (Meson): Automatic header scanning
    # No manual declarations needed
    # Changing qdl.h automatically rebuilds all files that include it

  Result: Prevents subtle bugs where changing a header doesn't trigger
  necessary recompilation.

* Platform handling: Windows-specific linking (ws2_32) and platform
  detection are now handled declaratively without shell conditionals.

* Testing integration: Test suite is now integrated into the build
  system with proper dependency tracking and timeout handling.

  Before (Make):
    make tests  # Shells out to bash script

  After (Meson):
    meson test -C builddir
    meson test -C builddir --verbose
    meson test -C builddir --wrapper='valgrind --leak-check=full'

  Result: Better test output formatting, timeout handling, and ability
  to run tests under valgrind or sanitizers.

* Installation: Standard installation paths and packaging support
  through Meson's built-in install infrastructure.

  Before (Make):
    make install prefix=/usr/local DESTDIR=/tmp/package

  After (Meson):
    meson setup builddir --prefix=/usr/local
    DESTDIR=/tmp/package meson install -C builddir
    # Correctly installs to:
    # - /usr/local/bin/{qdl,qdl-ramdump,ks}
    # - /usr/local/share/man/man1/{qdl.1,qdl-ramdump.1,ks.1}

  Result: Better integration with distribution packaging (Debian .deb,
  RPM) and standard FHS paths.

Migration maintains full feature parity with the existing build system:
- All three executables (qdl, qdl-ramdump, ks) build correctly
- Version string generation from git tags
- Optional man page generation
- Support for Linux, macOS, and Windows (MSYS2/MinGW)
- Recreated tests integration via Meson’s test() function,
  including support for script arguments (e.g. --builddir)

Usage:
$ meson setup build
$ meson compile -C build
$ meson test -C build
$ meson compile check -C build

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-04-06 10:16:17 -05:00
Igor Opaniuk 972b8e5469 ci: enforce commit message formatting in PRs
Malformed commit messages (overlong lines, missing blank line between
subject and body) have slipped through review. Automate the check in
CI so every PR is validated before merge.

Uses commitlint with a Linux kernel-style config: 72-char limit on
subject and body lines, blank-line rules enforced, Conventional
Commits type enforcement disabled.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-03-30 12:09:44 -05:00
Bjorn Andersson e033f0f205 github: Resolve liblzma-related failure in Windows builds
The Windows builds suddenly fails with:
  Cannot find path 'C:\a\_temp\msys64\mingw64\bin\liblzma-5.dll' because it does not exist.

The internet indicates that this is caused by the lack of
mingw-w64-x86_64-xz, so let's introduce this.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2025-12-16 16:05:57 -08:00
Igor Opaniuk b1d46164e3 github: add step for man page generation
Add a step for generating manual pages using recently added `manpages`
target in [1].

[1] commit 0a3c1175bd ("Add 'manpages' as new target to generate manpages by help2man")
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2025-11-20 12:39:48 +01:00
Luca Weiss 09a4f034b0 github: Get --version working for Windows build
Make sure we can get the version into the binary for '--version' and
does not show up as "unknown-version" by installing git.

Additionally make sure to configure autocrlf to avoid -dirty suffix.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
2025-11-12 15:29:31 -06:00
Luca Weiss 752685df9b github: Fetch full history during checkout
With only a --depth=1 checkout we do not get good build info for
'qdl --version'.

Check out the full history so that the version is printed nicely.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
2025-11-12 15:29:31 -06:00
Bjorn Andersson 8c42508fbd github: Bump macos runner versions
As announced by GitHub, the "macos-13" runners are being retired. The
x86_64 build has been using this, so bump it to "macos-15-intel", in
case we have any x86_64 users.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2025-11-11 13:23:48 -06:00
Julien Vanier a601db1868 github: update libxml DLL bundled with Windows binary
Include new version of libxml DLL in Windows CI build.

Signed-off-by: Julien Vanier <julien@particle.io>
2025-09-08 14:16:39 -05:00
Igor Opaniuk 2204f90bee github: create a full rep clone
Increase fetch-depth property for [1] action, which indicates that all
history for all branches and tags should be fetched.

This fix address such checkpatch issues as:

WARNING: Unknown commit id '4ed250c18436', maybe rebased or not pulled?
Fixes: 4ed250c184 ("qdl: add support for vip table of digests generation")
Error: WARNING: Unknown commit id '4ed250c18436', maybe rebased or not pulled?

[1] https://github.com/webispy/checkpatch-action
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2025-06-24 14:26:25 +02:00
Igor Opaniuk 4c942eea55 github: enable tests for windows
* Enable running tests on Windows
* Don't install cmake package, as it's not needed
* Install base-devel package, which contains regular make, diff and cmp
  tools.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2025-06-24 14:26:25 +02:00
Igor Opaniuk 4d612bc25b github: add Markdown lint action
Add Markdown linter invocation for new pull requests for README.md.
This is using existing GitHub action from [1].

[1] https://github.com/DavidAnson/markdownlint-cli2-action
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2025-06-23 13:33:16 -05:00
Igor Opaniuk 6c0fbcce08 tests: add initial test set
Add tests make target and a simple test that executes qdl in dry-run mode
for a synthetic reference FLAT build with VIP table generation.

The FLAT build contains:
- patch0.xml
- patch1.xml
- rawprogram0.xml
- rawprogram1.xml

All binaries that these XML files point to are filled with zeros, generated
during github action  execution.

Tests ensures that the table is generated correctly by comparing
calculated and expected SHA256 hashes of DigestToSign.bin file.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2025-06-20 11:51:49 +02:00
Igor Opaniuk 81da98bc8a github: add checkpatch action
Add checkpatch.pl invocation for new pull requests. This is using
existing GitHub action from [1].

[1] https://github.com/webispy/checkpatch-action
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2025-06-16 09:41:10 +02:00
Julien Vanier ccfa1fe073 Enable additional platforms in CI
Add Linux arm64, Mac Intel and Windows arm64 to the CI build. GitHub Actions runners for those platforms are available for OSS repos for free.

Signed-off-by: Julien Vanier <jvanier@gmail.com>
2025-05-06 10:31:59 -04:00
Julien Vanier 6867a75063 Remove workers not supported on free GitHub Actions
GitHub Actions doesn't provide workers for Ubuntu arm64 or Mac x64. A paid plan with hosted runners is necessary for those architectures.

Signed-off-by: Julien Vanier <jvanier@gmail.com>
2025-05-02 19:00:09 -04:00
Julien Vanier c69d9adc76 Compile on Windows in GitHub Actions and save build artifacts
Compile for Linux x64 and arm64, Mac x64 and arm64 and Windows x64 on GitHub Actions. Upload binaries and required libraries for testing on those systems.

Signed-off-by: Julien Vanier <jvanier@gmail.com>
2025-05-02 19:00:09 -04:00