Commit Graph
236 Commits
Author SHA1 Message Date
shenlf b53c1fdd21 fix typo siging_get_uri -> signing_get_uri
Signed-off-by: shenlf <lifeng.shen@brother-bsh.com.cn>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-10-15 22:26:59 -07:00
Bastian Krause afc85af443 fitimage.bbclass: make engine parameters in FITIMAGE_MKIMAGE_EXTRA_ARGS fail early
Now that oe-core moved to OpenSSL 4.0, the engine API is gone.
As a result uboot-mkimage's -N/--engine no longer work:

  Failed to sign 'signature-1' signature node in 'conf-imx6dl-riotboard.dtb' conf node
  uboot-mkimage Can't add hashes to FIT blob: -1
  Error: Bad parameters for FIT image type
  Usage: uboot-mkimage [-T type] -l image
            -l ==> list image header information
            -T ==> parse image file as 'type'
            -q ==> quiet

A previous patch documented how provider-based PKCS#11 signing works.
Now make an engine option in FITIMAGE_MKIMAGE_EXTRA_ARGS a fatal error. It
has no effect anymore, so a recipe still setting it has not been
migrated; failing with a clear message beats mkimage's generic error
messages above.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-10-09 10:01:36 -07:00
Bastian Krause 24dc1d0d72 fitimage.bbclass: document provider-based PKCS#11 signing
Now that oe-core moved to OpenSSL 4.0, the engine API is gone.
As a result uboot-mkimage's -N/--engine no longer work:

  Failed to sign 'signature-1' signature node in 'conf-imx6dl-riotboard.dtb' conf node
  uboot-mkimage Can't add hashes to FIT blob: -1
  Error: Bad parameters for FIT image type
  Usage: uboot-mkimage [-T type] -l image
            -l ==> list image header information
            -T ==> parse image file as 'type'
            -q ==> quiet

Document the provider-based setup instead: signing_create_uri_pem() wraps
the role's PKCS#11 URI in a PEM file that OpenSSL loads like a key file and
resolves through the PKCS#11 provider configured by signing_prepare().

mkimage looks for a key in
${FITIMAGE_SIGN_KEYDIR}/${FITIMAGE_SIGN_KEYNAME}.key, so store it there.
This way the existing mkimage invocations do not need to be touched.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-10-09 10:01:36 -07:00
Johannes Schneider 63b9897c27 signing.bbclass: extract certs via the PKCS#11 provider
signing_extract_cert_der() and signing_extract_cert_pem() read the
certificate off the token with 'extract-cert <pkcs11-uri>'. extract-cert
reaches a pkcs11 token through the OpenSSL ENGINE API, which OpenSSL 4.0
removed; meta-oe's own extract-cert now errors "PKCS#11 URIs require
OpenSSL < 4.0" on such input. Both exporters are therefore broken on
OpenSSL 4.

signing_prepare() already configures the pkcs11 provider (OPENSSL_MODULES
plus a provider openssl.cnf), so read the certificate through it with
'openssl storeutl -certs' instead. The class is provider-based on both
OpenSSL 3 and 4, so this needs no version branching. Make _pem the
primitive (storeutl emits PEM) and derive _der from it.

storeutl -certs writes every certificate the URI matches; a signing role
URI is expected to pin a single object, and _der keeps the first cert
should more than one come back.

The class no longer invokes extract-cert; drop it from DEPENDS.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-09-27 17:52:14 -07:00
Johannes Schneider 37919238d1 signing.bbclass: drop dead OpenSSL engine handling
signing_prepare() signs via the pkcs11 provider only: it writes a provider
openssl.cnf and uses OSSL_STORE for native provider access. Nothing invokes
the OpenSSL ENGINE API (no -engine), so the OPENSSL_ENGINES export and the
engines-3 directory check are dead code. The check even hard-fails
(return 1) when engines-3 is absent, which OpenSSL 4.0 no longer ships
(ENGINE API removed) - breaking signing outright although the provider path
is fine. Remove the engine export and the check.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-09-27 17:52:13 -07:00
Marcel Hellwig c3e7da7b9a Add util-linux-native to Breakpad dependencies
Signed-off-by: Marcel Hellwig <github@cookiesoft.de>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-09-21 08:13:47 -07:00
Ahmad Fatoum abb086bef6 fitimage: strip pkcs11: prefix in FITIMAGE_SIGN_KEYDIR example
Following the example in the comment as-is will lead to an error at
do_fitimage time:

  The key ID is not a valid PKCS#11 URI
  The PKCS#11 URI format is defined by RFC7512
  The key ID is not a valid PKCS#11 URI
  The PKCS#11 URI format is defined by RFC7512
  PKCS11_get_private_key returned NULL
  Failure loading private key from engine: error:40000064:pkcs11 engine::invalid id
  uboot-mkimage Can't add hashes to FIT blob: -1

Strip the pkcs11: prefix to resolve this and save future users the
hassle.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-09-08 08:23:16 -07:00
Ahmad Fatoum e1f5f22b30 fitimage: add support for specifying FITIMAGE_CONFIG_FDTO_PREFIX
FITIMAGE_CONFIG_PREFIX is only used for configurations that contain a
kernel image, but not for mere overlay configurations.

This is inconsistent with the original kernel-fitimage.bbclass.
As the name may be hardcoded in the bootloader, add a new
FITIMAGE_CONFIG_FDTO_PREFIX to be able to customize the prefix for
device tree overlay configuration nodes as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-09-08 08:23:15 -07:00
AshishKumar Mishra a585830e2d image_types_sparse: create symlinks for generated sparse images
Ensure that symbolic links (${IMAGE_LINK_NAME}) are created for both
sparse images, matching standard Yocto image deployment behavior

Signed-off-by: AshishKumar Mishra <emailaddress.ashish@gmail.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-09-04 17:10:39 -07:00
Thomas Bonnefille 1a71a3e63f fitimage.bbclass: add command line property
Since version 0.9 of the fit image specification, it is possible to
embed the command line in the fit image.
Add the option to embed a command line argument for the next boot stage
in the fit image.

Link: https://github.com/open-source-firmware/flat-image-tree/releases/tag/v0.9

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-08-29 10:41:46 -07:00
AshishKumar Mishra 0b8685f28c image_types_sparse: switch ext* conversion to ext2simg_android
We have RFC discussion at
https://lists.openembedded.org/g/openembedded-devel/message/124499
https://lists.openembedded.org/g/openembedded-devel/message/125497

Move ext* sparse image generation from 'img2simg' to ' ext2simg_android'

Signed-off-by: AshishKumar Mishra <emailaddress.ashish@gmail.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-08-03 16:53:09 -07:00
Andreas Zdziarstek 3755354fb2 image_types_verity.bbclass: add FEC support
dm-verity can use Reed-Solomon forward error correction (FEC) data
to transparently recover a limited number of corrupted blocks instead
of only detecting them. This can be useful for mitigating error-prone
storage.

We generate this FEC data as an option, controlled by VERITY_FEC
(default off, same behavior as before) and VERITY_FEC_ROOTS (number of
Reed-Solomon roots, default 2). The FEC data is appended to the hash
tree by default. If VERITY_IMAGE_FECDEV_SUFFIX is set, a separate file
with the given suffix will be used.

When enabled, the parameter file gains additional variables necessary
for correct DM table generation.

Recipes that do not set VERITY_FEC = "1" behave the same as before.

Signed-off-by: Andreas Zdziarstek <andreas.zdziarstek@gmail.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-06-20 23:41:39 -07:00
Fabian Pflug 8b9b789542 signing.bbclass: add signing_create_uri_pem helper function
The PKCS#11 provider has a mechanism [1] to support older applications
which have not yet migrated to the OSSL_STORE API [2]. It works by
encoding the 'pkcs11:' URI into a PEM file and passing that to an
application as a file. From the application's perspective it loads the
private key from a file, but OpenSSL will transparently use select the
provider to access it via PKCS#11 instead.

Instead of upstream's Python-based tool [3] (which would pull in
asn1crypto as a dependency), we just generate the ASN.1 for the PEM
using OpenSSL's 'asn1parse -genconf'.

It has been tested with RAUC, U-Boot's mkimage (for signed FITs) and
NXP's CST.

[1] https://github.com/latchset/pkcs11-provider/blob/main/docs/provider-pkcs11.7.md#use-in-older-applications-uris-in-pem-files
[2] https://docs.openssl.org/master/man7/ossl_store/
[3] https://github.com/latchset/pkcs11-provider/blob/main/tools/uri2pem.py

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2026-03-04 22:26:02 -08:00
Fabian Pflug f75a2ab194 signing.bbclass: add support for OpenSSL PKCS#11 provider
OpenSSL 4.0 will drop support for engines and use providers instead.

To access SoftHSM and other PKCS#11 modules via the provider API, we
rely on https://github.com/latchset/pkcs11-provider, which is already
available as via pkcs11-provider recipe.

We enable this provider by using a specific OpenSSL config when signing.
This means that recipes inheriting this class can decide whether they
want to use the engine or provider to access the key.

SoftHSM seems to produce broken keys when calling the C_CopyObject, so
disable caching in the provider for now.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2026-03-04 22:26:02 -08:00
Jan Luebbe 40a1825c95 signing.bbclass: remove trailing white space
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2026-03-04 22:26:02 -08:00
AshishKumar Mishra f5246b7df4 meta-oe: image: optionally remove RAW image after sparse image creation
When creating sparse images, the RAW image is no longer needed in
some workflows such as Android and CI pipelines. These RAW images
can be multi-GB artifacts and consume significant disk space.

This change introduces a configuration option
`DELETE_RAWIMAGE_AFTER_SPARSE_CMD` which, when set to "1",
removes the RAW image after sparse image generation.

This reduces disk usage in builds where sparse images are the
final deliverables and RAW images are not required.

Default behavior is unchanged: RAW images are kept unless the
variable is explicitly enabled:

    DELETE_RAWIMAGE_AFTER_SPARSE_CMD = "1"   # Delete RAW image
    DELETE_RAWIMAGE_AFTER_SPARSE_CMD = "0"   # Default behavior

Signed-off-by: AshishKumar Mishra <emailaddress.ashish@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-09-15 09:55:16 -07:00
Bastian Krause 86f2dee014 image_types_verity.bbclass: remove breaking unit suffix from machine-readable verity parameters
Since cryptsetup 2.8.0 [1], "veritysetup format" prints " [bytes]"
suffixes for "Data block size" and "Hash block size" parameters:

  UUID:
  Hash type:              1
  Data blocks:            34655
  Data block size:        4096 [bytes]
  Hash blocks:            275
  Hash block size:        4096 [bytes]
  Hash algorithm:         sha256
  Salt:                   8a8d8d807bd9838a80397a13b3bc13c55780ff1677ee4489366b17dab1b29316
  Root hash:              bd85312151dc5c69efce943038e0ac4b92e14d8954cce5d3cc90513837f854bf

This output is directly converted to a shell sourcable form in
"${DEPLOY_DIR_IMAGE}/<IMAGE_LINK_NAME>.verity-params" used to
create the desired block device via "dmsetup" during runtime. The unit
suffix becomes part of the VERITY_DATA_BLOCK_SIZE and
VERITY_HASH_BLOCK_SIZE variables, breaking its consumers:

  /init: /verity-params: line 4: [bytes]: not found
  /init: /verity-params: line 6: [bytes]: not found
  verity root hash: bd85312151dc5c69efce943038e0ac4b92e14d8954cce5d3cc90513837f854bf
  [    3.323577] device-mapper: table: 253:0: verity: Invalid data device block size (-EINVAL)
  [    3.323595] device-mapper: ioctl: error adding target to table
  [    3.345301] /dev/dm-0: Can't lookup blockdev

Fix this by removing the unit suffixes from the values.

Ideally veritysetup should support machine-readable output, but that did
not spark joy on the maintainer's side [2] (at least in veritysetup
itself).

[1] commit f8788f34 ("Mark all sizes in status and dump output in the
correct units.")
[2] https://gitlab.com/cryptsetup/cryptsetup/-/issues/638

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-09-02 08:57:41 -07:00
Johannes Schneider c092b3adc5 signing.bbclass: create env with 0x600
The env file holds the PKCS#11 uris, which include the pin to access
the database - in plaintext. Directly create the file (after it has
been remove) with the proper 'user RW only' permissions, to give only
the build-user access to this somewhat "security sensitive" file.

Note that the softhsm/sqlite3.db* is already 0x600.

Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-08-20 07:35:07 -07:00
Gyorgy Sarvari 157d2fede2 gitpkgv.bbclass: inspect repository in UNPACKDIR
When BB_GIT_SHALLOW = "1" is used, the unpacked gir repository doesn't
exist in the download folder, and the class isn't able to inspect the
details of the repository.

Instead inspect the repository it the UNPACKDIR.

Beside this, since BitBake fetcher performs an actual initial shallow
clone of the repository when this feature is enabled, it is not possible
to determine the exact number of commits. Add a warning about this.

Reported-by: WXbet <WXbet@proton.me>
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-08-18 07:50:01 -07:00
Enrico Jörns 2d1d128a41 signing.bbclass: make PEM loading compatible with OpenSC 0.26.0
With https://github.com/OpenSC/OpenSC/pull/3174 which is part of 0.26.0,
OpenSC does not support reading the (DER-converted) object data from
stdin anymore.

However, OpenSC/pkcs11-tool also supports reading PEM files directly.
This we can use for simply replacing and simplifying the stdin piping in
signing_import_cert_from_pem().

Only for password-protected files we still have to use OpenSSL for
conversion, since OpenSC/pkcs11-tool currently doesn't have a mechanism
for providing passwords.
For these cases, we store the converted PEM into a simple temporary
file. This handling is sufficient, since SoftHSM import should be used
for example keys only and SoftHSM also doesn't protect the keys in any
way. Keys which actually need to be protected are stored in HSMs and
accessed via their PKCS#11 URIs.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-07-02 09:48:26 -07:00
Johannes Schneider a1dd190604 signing.bbclass: remove signing_import_cert_chain_from_pem
With the now available set|get|has_ca functions to establish a CA link
between roles during their import, the
signing_import_cert_chain_from_pem can now be removed.  As it had the
shortcoming of dynamically creating roles, which are harder to handle
then the manually/specifically setup CA roles.

This effectively reverts:
a825b85363 signing.bbclass: add certificate ca-chain handling

Reviewed-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-06-28 11:04:25 -07:00
Johannes Schneider d1b6f528a5 signing.bbclass: add signing_extract_cert helpers
Add extract-cert wrapping helper functions, to easily extract
certificates again that had been previously imported into the softhsm.

Reviewed-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-06-28 11:04:25 -07:00
Johannes Schneider b6915f6399 signing.bbclass: add signing_get_intermediate_certs
Add a method that returns a list of intermediary CA roles.

When using a complex PKI structure with for example "openssl cms",
these roles can then be iterated over adding in turn a '-certificate'.
Pseudo-code example:
  for intermediate in $(signing_get_intermediate_certs 'FooBaa'); do
     signing_extract_cert_pem $intermediate $intermediate.pem
     CMD+=" --certificate=$intermediate.pem"
  done

The typical use-case would be adding these intermediate certificates
to the CMS structure so that the relying party can build the chain
from the signing leaf certificate to the locally stored trusted CA
certificate.

Reviewed-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-06-28 11:04:24 -07:00
Johannes Schneider f642526db5 signing.bbclass: add get_root_cert
Add a helper method to retrieve the root CA certificate for a given
role, by walking the chain that has been setup with
signing_import_set_ca up to the last element - which is the root.

Reviewed-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-06-28 11:04:24 -07:00
Johannes Schneider 5b315e2fc4 signing.bbclass: add set|get|has_ca functions
Add a mechanism to establish a (metadata) link between roles and signer
certificates, in the form of a new 'ca' variable.  It must point from one
role or cert to the signer certificate to preserve the leaf->intermediary->
root certificate relation.

With this additional mechanism, it would be now possible to import a
complex PKI tree of certificates and then later during usage of one
role, reconstruct the certificate chain from the leaf, through
multiple intermediary, and up to the root certificate.

Reviewed-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-06-28 11:04:24 -07:00
Johannes Schneider 855c956fbd signing.bbclass: refactor signing_import_cert_from_*
Refactor the two methods to import certificates from PEM/DER to be
usable independently from keymaterial that is linked to a role.

By having the import_cert_from methods create a storage location (aka
role) in the softhsm dynamically.  This way certificates can - but
don't have to - be linked to a key, or can stand on their own if chain
of certificates from a PKI has to be managed.

Reviewed-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-06-28 11:04:24 -07:00
Johannes Schneider 6ae8e92e28 classes: add a systemd-sysext image class
systemd-sysext can load a raw-image containing usr/ and opt/ folders
to mount them as RO overlay over the rootfs, to "extend" the systems.

This class provides the necessary changes/additions to the enclosed
filesystem so that systemd-sysext accepts the extension for "merge"
into the rootfs.

With such a created image, placed into the correct folder (see [1]),
`systemd-sysext list` should be able to list the "extension" and
`systemd-sysext merge` should enable the overlay. On both commands a
preceding "SYSTEMD_LOG_LEVEL=debug" can aide in figuring out what is
amiss.

Link: https://www.freedesktop.org/software/systemd/man/latest/systemd-sysext.html
Link: https://0pointer.net/blog/testing-my-system-code-in-usr-without-modifying-usr.html
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-06-25 06:44:55 -07:00
Johannes Schneider 816de4c7b4 classes: add discoverable disk image class
Add a class to build discoverable disk images [1] through
systemd-repart(-native).

Note that systemd >= 256 is required for '--private-key-source'

The class was adapted from a patch [2] floating upstream.

Link: [1]: https://uapi-group.org/specifications/specs/discoverable_disk_image/
Link: [2]: https://lists.openembedded.org/g/openembedded-core/message/198724
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-06-25 06:44:54 -07:00
Alexander Kanavin fc78d37ff0 meta-openembedded/all: adapt to UNPACKDIR changes
Please see
https://git.yoctoproject.org/poky/commit/?id=4dd321f8b83afecd962393101b2a6861275b5265
for what changes are needed, and sed commands that can be used to make them en masse.

I've verified that bitbake -c patch world works with these, but did not run a world
build; the majority of recipes shouldn't need further fixups, but if there are
some that still fall out, they can be fixed in followups.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-06-25 06:44:52 -07:00
Chen Qi dd32bd666e check-version-mismatch.bbclass: use oe.qemu and add QEMU_OPTIONS settings
This bbclass is intended to be used via "INHERIT". The qemu.bbclass
is in classes-recipe. So we can't inherit qemu. We need to copy
QEMU_OPTIONS settings from qemu.bbclass and use oe.qemu to make things
work.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-05-29 22:28:02 -07:00
Chen Qi acacb59a48 Revert "recipes: adapt to qemu.bbclass refactoring"
This reverts commit 24ff52ba3b.

The original patch was my bad. The patches for oe-core were re-worked,
but I forgot the recall this patch.

In fact, inheriting qemu is needed because it sets a clear barriar
for people to use qemu user mode. And the QEMU_OPTIONS settings
are also in qemu.bbclass.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-05-29 22:28:02 -07:00
Chen Qi 24ff52ba3b recipes: adapt to qemu.bbclass refactoring
Avoid inheriting qemu.bbclass and use oe.qemu.xxx instead.

Also, the 'qemu-native' dep is replaced by 'qemuwrapper-cross' for
PACKAGE_WRITE_DEPS. qemuwrapper-cross is the one that is actually
used by postints and it has 'qemu-native' in DEPENDS.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-05-03 01:59:06 -07:00
Chen Qi 293cfe93f4 check-version-mismatch.bbclass: skip go/src directory
Files under it are source files. And if go/src locate under
/usr/lib, this will result in very long LD_LIBRARY_PATH causing
failure.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-04-19 14:36:05 -07:00
Chen Qi 93a6ada53c check-version-mismatch.bbclass: handle non-elf executables
Using qemu to run non-elf executables such as shell scripts directly
is destined to fail. In such case, we check its interperter and try
out best to run it accordingly.

We'll also need to skip the "/etc" directory as files under it are
configuration files and init scripts. And the init script will
send SIGTERM and SIGKILL to all processes, giving users annoying
behavior.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-04-19 14:36:05 -07:00
Chen Qi 62d3384378 check-version-mismatch.bbclass: ensure sysroot is available
We need to ensure sysroot is available for this version check task,
otherwise, running binaries might fail because of lack of libraries
from sysroot.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-04-19 14:36:05 -07:00
Chen Qi b1281d5bc8 check-version-mismatch.bbclass: avoid meaningless checking
If users set CHECK_VERSION_PN for a recipe and its value is a single
'%', then it matches anything. So there's no point doing any further
check.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-04-19 14:36:04 -07:00
Chen Qi 095d61d2e2 check-version-mismatch.bbclass: avoid single '(' in version output
Avoid a single '(' in version. For example, we want to extract the
'2.30.31' instead of '2.30.31(2' for lvm2.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-04-19 14:36:04 -07:00
Bastian Krause 0c3c7bc9f4 fitimage.bbclass: warn if kernel is compressed, but no compression specified
If the kernel build type uses compression, the bootloader needs to take
care of decompression. This must be configured in the FIT image via
FITIMAGE_IMAGE_myimage[comp]. So warn if the FIT image kernel compression
is not specified in such a case.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
2025-04-16 08:04:42 -07:00
Enrico Jörns 24dd46daf8 fitimage.bbclass: error-out for empty configurations
Otherwise mkimage will, but with a way less helpful error message.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
2025-04-16 08:04:42 -07:00
Enrico Jörns 5bff8f5b3b fitimage.bbclass: fix configurations node naming
Similar to e152f01d, this fixes another occurence of the config section
name to contain the 'conf_prefix'.
Luckily, this one is only debug output.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
2025-04-16 08:04:42 -07:00
Enrico Jörns 69dbad5529 fitimage.bbclass: fail early for unsupported image types
A given image type should be valid. Thus fail early here instead of
randomly failing later during mkimage call.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
2025-04-16 08:04:42 -07:00
Enrico Jörns 62eba951c7 fitimage.bbclass: let image type default to 'kernel'
When no type is set, we simply pick 'kernel' as the default since it
is still the most common to be used for FIT images.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
2025-04-16 08:04:42 -07:00
Enrico Jörns 71e6160da0 fitimage.bbclass: fix error handling for missing recipe
The 'image' name should be printed rather than the (unset) 'recipe'.
Also use f-strings for better readability.

Since a missing recipe configuration is fatal to a proper generation,
abort the parsing with bb.fatal instead of continuing with a broken
configuration.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
2025-04-16 08:04:42 -07:00
Chen Qi 14ff80c9dc version-check.conf: add mechanism for checking version mismatch
Add a mechanism to check mismatch between runtime version and build time version.

To use, add the following line to local.conf:

  include conf/version-check.conf

Ideally, layers will have their own conf/version-check.conf to establish
some baseline, so that any future warning indicates some error. In such
case, users can use include_all:

  include_all conf/version-check.conf

The basic idea is to use qemu to run executables at build time, extract
possible versions, and check if there's a mismatch found.

Python meta data and .pc files are also checked for quick match. This
is because such info are also easy to be checked by users.

check-version-mismatch.bbclass is the class that does the actual work.
A new variable, CHECK_VERSION_PV, is introduced. It defaults to ${PKGV},
but also allows override. This allows us to handle special cases in each
layer.

version-check.conf is the configuration file that makes this functionality
easier to use and draws some baseline. It contains some override settings
for some recipes. With these overrides, all recipes in oe-core are handled
well. All warnings are valid warnings.

Note that 'ps' is added to HOSTTOOLS in version-check.conf. This is because
we need 'ps' to find stale processes and then clean them.

The warnings are like below:

  WARNING: time-1.9-r0 do_package_check_version_mismatch: Possible runtime versions ['UNKNOWN'] do not match recipe version 1.9
  WARNING: python3-unittest-automake-output-0.2-r0 do_package_check_version_mismatch: Possible runtime versions ['0.1'] do not match recipe version 0.2
  WARNING: pinentry-1.3.1-r0 do_package_check_version_mismatch: Possible runtime versions ['1.3.1-unknown'] do not match recipe version 1.3.1
  ...

There will be a data directory containing all details: tmp/check-version-mismatch.
This directory contains detailed data for each recipe that is built.
If users don't want it, they can set DEBUG_VERSION_MISMATCH_CHECK to 0.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-04-04 19:18:46 -07:00
Erik Schumacher a95982edd2 image_types_verity.bbclass: Optionally create hash data in separate file
On some setups, the verity partition and the corresponding hash data are
handled separately. To account for this, a HASHDEV_SUFFIX is introduced
to divert the hash data to a separate image artifact. By default, this
suffix is equal to the image suffix, meaning that the hash data is
appended to the verity image, like before.

When the hash data is written to a separate file, the verity image is
padded with zeroes until its size is a multiple of block_size.

Signed-off-by: Erik Schumacher <erik.schumacher@iris-sensing.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-03-27 17:05:46 -07:00
Hains van den Bosch 4e47dbbc6e gitpkgv.bbclass: Fix broken git revison
The revision dictionary was built with keys from names list in Bitbake(setup_revisions()).
See:
https://git.openembedded.org/bitbake/commit/?id=2515fbd10824005fa7f34e87706000c079920366

And used to build names list in gitpkgv.bbclass in the old situation, see:
https://git.openembedded.org/meta-openembedded/commit/?id=2920d4909236106e1a36d56b3b20762a308ba3d4

Use name variable to build names list instead of revision variable.
Use append() now name variable is a string.

Old ipk file name:
enigma2_3.13+git3_1_3_0_9_c_7_0_a_4_f_a_6_9_d_6_7_0_1_7_b_b_9_f_7_f_4_d_d_9_d_6_1_0_a_8_c_3_d_20+31309c70a4-r0_dm920.ipk

New ipk file name:
enigma2_3.13+git21834+31309c70+31309c70a4-r0_dm920.ipk

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-03-22 09:58:08 -07:00
Richard Purdie 2920d49092 gitpkgver: Update to match bitbake fetcher changes
The bitbake fetcher dropped support for multiple revisions on a single
url. Update the gitpkgver code to match.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-03-20 09:04:50 -07:00
John Ripple 90f3c21186 fitimage.bbclass: Add missing punctuation
The functions related to signing the fitimage had missing quotations and
newlines. Without this punctuation, the signing class would fail to
generate a signed fitimage.

To test this change just create a fitImage using this class and set
FITIMAGE_SIGN to 1. The resulting fitImage its file should have one
property per line with quotes around the property values.

Signed-off-by: John Ripple <john.ripple@keysight.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-03-13 22:09:36 -07:00
Gyorgy Sarvari 6b1ba4543a capnproto: remove binaries from target-build, add bbclass
When linking to capnproto from another project, cmake fails to
find this package with the following error:

| CMake Error at ${RECIPE_SYSROOT}/usr/lib/cmake/CapnProto/CapnProtoTargets.cmake:176 (message):
|   The imported target "CapnProto::capnp_tool" references the file
|
|      "${RECIPE_SYSROOT}/usr/bin/capnp"
|
|   but this file does not exist.  Possible reasons include:

To solve this, this change includes the following:

1. Add a patch that removes the files installed (and exported) in
${bindir} from the target build. The CMake file originally verified
that these files exist when another recipe tried to use it, however
the ${RECIPE_SYSROOT} does not contain the binaries in ${bindir},
so it failed quick in the do_configure step. (This alone is enough
to link against the cross-compiled libraries of capnproto successfully,
but code-generation from capnproto definition fails)

2. Add a new bbclass for capnproto. To cross-compile an application
that uses capnproto, the application needs to be linked against the
cross-compiled version of the libraries, however the native version
of the binaries need to be used to generate C++ code from the
capnproto definitions. This class sets the correct CMake arguments, to
use the capnproto binaries from the native package, instead of looking
for the non-existent cross-compiled binaries. (These variables can
be found in ${libdir}/cmake/CapnProto/CapnProtoConfig.cmake file)

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-02-03 11:25:22 -08:00
Akash Hadke 59614eafb0 fitimage.bbclass: Remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True
option from getVar() calls with a regex search and replace.

Signed-off-by: Akash Hadke <akash.hadke27@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-01-10 09:33:53 -08:00