Add a small QR code generator library so U-Boot boards can encode
arbitrary text or binary into a QR symbol. Main use cases include
displaying URLs, pairing tokens, serial numbers or
self-diagnostic state from the bootloader (e.g. during porting to a
new mobile device with no serial console or usb peripheral working).

Optionally apply gzip compression for the QR code payload.

Three patches:

1. Verbatim import of Nayuki's public-domain / MIT-licensed C QR Code
   generator (qrcodegen.{h,c}) under CONFIG_LIB_QRCODE. No code
   changes and the only adjustments are SPDX header, swapping <assert.h>
   for U-Boot's <log.h>.

2. CONFIG_LIB_QRCODE_MAX_VERSION (int, 1..40, default 40) so callers
   can cap the maximum QR version. The version trades payload capacity for
   smaller static scratch buffers.

3. CONFIG_LIB_QRCODE_GZIP (bool, depends on GZIP_COMPRESSED) and a
   helper qrcodegen_encodeBinaryCompressed(). Perpends four-byte "QRGZ"
   magic header so the scanner side can detect and decompress.

Signed-off-by: Petr Hodina <[email protected]>
---
Petr Hodina (3):
      lib: qrcodegen: Import Nayuki QR Code generator library
      lib: qrcodegen: configurable maximum QR code version
      lib: qrcodegen: optional gzip pre-compression of payloads

 include/qrcodegen.h  |  407 ++++++++++++++++++++
 lib/Kconfig          |   44 +++
 lib/Makefile         |    2 +
 lib/qrcodegen.c      | 1034 ++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/qrcodegen_gzip.c |   45 +++
 5 files changed, 1532 insertions(+)
---
base-commit: ece349ade2973e220f524ce59e59711cc919263f
change-id: 20260611-b4-lib-qrcode-a5ce89e68f85

Best regards,
--  
Petr Hodina <[email protected]>


Reply via email to