Skip to main content

swugenerator

A host tool to generate SWU update package for SWUpdate.

SYNOPSIS

usage: SWUGenerator [-h] [-K ENCRYPTION_KEY_FILE] [-k SIGN] [-s SW_DESCRIPTION]

[-a ARTIFACTORY] -o SWU_FILE [-c CONFIG] command

Generator SWU Packages for SWUpdate

positional arguments:
command:
{create,sign,mender} command to be executed

create creates a SWU file sign signs an existing SWU file provided by -i mender wraps an existing SWU file provided by -i into a Mender Artifact

optional arguments:
-h, --help

show this help message and exit

-K ENCRYPTION_KEY_FILE, --encryption-key-file ENCRYPTION_KEY_FILE

AES Key to encrypt artifacts

-n, --no-compress

Do not compress files

-e, --no-encrypt

Do not encrypt files, for artifacts that are already encrypted. encrypted and ivt are kept as set in sw-description

-x, --no-ivt

Do not generate IV when encrypting

-y, --no-hash

Do not store sha256 hash in sw-description

-k SIGN, --sign SIGN

RSA key or certificate to sign the SWU

-s SW_DESCRIPTION, --sw-description SW_DESCRIPTION

sw-description template for the create command

-t, --encrypt-swdesc

Encrypt sw-description

-a ARTIFACTORY, --artifactory ARTIFACTORY

list of directories where artifacts are searched

-o SWU_FILE, --swu-file SWU_FILE

SWU output file

-i, --swu-in-file SWU_IN_FILE

SWU input file to be signed for the sign command

-c CONFIG, --config CONFIG

configuration file

Description

swugenerator is a tool running on host to create and modify SWUpdate’s Update files (SWU). SWU file contains a meta description of the release (sw-description), and swugenerator adds components to a template passed from command line. This tool requires openssl to run and to sign the SWU. It is goal of the tool to fill the gap with Yocto/OE, where SWU generation is done by classes in the meta-swupdate layer, but other buildsystems like Debian or Buildroot have no tools to create a SWU.

The tool signs the SWU and can encrypt the artifacts. The tool parses the sw-description, in libconfig or in JSON (a sw-description starting with {), and provides the following features:

  • replace occurrencies of variables found in the CONFIG file

  • add sha256 to each artifact

  • check if an artifact should be encrypted and encrypts it

  • sign sw-description with one of the methods accepted by SWUpdate

  • pack all artifacts into a SWU file

It maybe run in two steps to create an unsigned swu file and then sign it later in a second call:

swugenerator -o output.swu -a . -s sw-description.in create
swugenerator -o signed_output.swu -i output.swu -k CMS,key.pem,ca.crt sign

CMS signing with several signers

-k CMS,... can be given more than once: the signature has then a signer for each, for example a classic and a post-quantum key. SWUpdate verifies all of them, so every certificate must be in its trust store. The signers must use the same password file:

swugenerator -o output.swu -a . -s sw-description.in \
    -k CMS,rsa.key,rsa.crt -k CMS,mldsa.key,mldsa.crt --cms-md sha512 create

--cms-md sets the message digest of openssl cms (needed for keys without a default digest, such as ML-DSA; one digest is used for all signers), and --cms-certfile adds a file with intermediate certificates (can be repeated).

Extra files

Only the files that sw-description uses are packed. --add-file <name> (can be repeated) adds a file found in the artifactory as it is, even if sw-description does not use it; a file already in the SWU is not added twice.

Mender Artifact

A Mender Server delivers updates only as Mender Artifacts. The mender command puts an existing SWU, unchanged and with its signature, into a Mender Artifact (format version 3) as the payload of type swu, as mender-artifact write module-image -T swu does. SWUpdate’s Mender Suricatta module takes the SWU out of the artifact while it is downloaded:

swugenerator -o update.mender mender -i signed_output.swu -D board-a -D board-b -N release-2

Options of the mender command:

-i, --swu-in-file SWU_IN_FILE
                      SWU to wrap
-D, --device-type DEVICE_TYPE
                      compatible device type, can be repeated
-N, --artifact-name ARTIFACT_NAME
                      artifact name, default: version in sw-description
-T, --payload-type PAYLOAD_TYPE
                      payload type, default: swu
-C, --compression {gzip,xz,none}
                      compression of header and payload, default: gzip

The artifact is reproducible with SOURCE_DATE_EPOCH.

Installation

To install swugenerator clone the repository, and from the main project folder run pip (pip3 required): For new Linux distributions, replace it with pipx.

pip install .

To uninstall:

pip uninstall swugenerator

Metadata

Release files for swugenerator 0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swugenerator 0.8
File Size Uploaded Provenance Actions
swugenerator-0.8.tar.gz 77.9 kB Without provenance Details for swugenerator-0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swugenerator 0.8
File Interpreter ABI Platform Actions
swugenerator-0.8-py3-none-any.whl Python 3 none any Details for swugenerator-0.8-py3-none-any.whl

Total release size: 125.7 kB

Release files / swugenerator-0.8.tar.gz

Download URL swugenerator-0.8.tar.gz
Size 77.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f349ce1a3e26f072000e052be096b87b540359a10ad66ffef1154c13a1eea485
BLAKE2b-256 checksum
How to use checksums
4a0c2509cf2d0a6a584d42f37bbac8489ba2f0d953967f7693e8c5bdc0d4e358
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / swugenerator-0.8-py3-none-any.whl

Download URL swugenerator-0.8-py3-none-any.whl
Size 47.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c02ad59c7bca3e336e58557cf3d639ba927c22e8c930b524abe8d85e438019cf
BLAKE2b-256 checksum
How to use checksums
7c5105c11608705d8f223d9bcf58a09c687ac1746da446f6a5d4d82b61469c8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for swugenerator 0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page