Skip to content

update wolfboot for option of using local wolfssl source and add wolfhsm recipe - #174

Open
JacobBarthelmeh wants to merge 4 commits into
wolfSSL:masterfrom
JacobBarthelmeh:wolfhsm
Open

update wolfboot for option of using local wolfssl source and add wolfhsm recipe#174
JacobBarthelmeh wants to merge 4 commits into
wolfSSL:masterfrom
JacobBarthelmeh:wolfhsm

Conversation

@JacobBarthelmeh

Copy link
Copy Markdown
Contributor

No description provided.

The FIPS Ready recipe could only take its sources from a local directory or an
already-extracted tree, so every build host had to stage the archive by hand.
The GPLv3 FIPS Ready bundles are published openly, so there is no reason to
require that.

wolfssl-commercial.bbclass already builds a SRC_URI out of a remote URI for the
GCS case, and nothing on that path is GCS specific. Generalize it as
COMMERCIAL_BUNDLE_URL, taking precedence over COMMERCIAL_BUNDLE_GCS_URI, and
expose it from wolfssl-fips-ready.bb as WOLFSSL_SRC_URL. Existing local
directory and GCS setups are unaffected.
@JacobBarthelmeh JacobBarthelmeh self-assigned this Jul 30, 2026
Copilot AI review requested due to automatic review settings July 30, 2026 16:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@JacobBarthelmeh

Copy link
Copy Markdown
Contributor Author

Retest this please Jenkins

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@night1rider night1rider left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things I found. Biggest issues are with the newer syntax/variables related to the wrynose lts.

Comment on lines +76 to +79
# A plain download URL and a gs:// path are handled identically here: both
# are just a URI bitbake's fetcher understands. COMMERCIAL_BUNDLE_URL takes
# precedence so a recipe can offer the public download as its default while
# still allowing a GCS override.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment says GCS can still override, but url or gcs_uri means a non-empty URL wins and gcs_uri is never read. Might be good to comment that if both are set GCS is ignored.

SRC_URI = "git://github.com/wolfSSL/wolfHSM.git;protocol=https;branch=main"
SRCREV ?= "4aeecb2c35686bd4daeb40b3537500d15a93aff9"

S = "${WORKDIR}/git"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Older Yocto releases unpacked source straight into WORKDIR, which is why ${WORKDIR}/git used to be right. Newer ones unpack into a subfolder called UNPACKDIR and name the checkout after the recipe, so that path no longer exists. wrynose is listed in LAYERSERIES_COMPAT, so this layer promises to work there, and oe-core now rejects this exact line: bitbake wolfhsm stops at do_unpack with "Recipes that set S = "${WORKDIR}/git" ... should remove that assignment". Scarthgap will not show this, because it has no UNPACKDIR at all. wolfssl, wolftpm, wolfboot and others already test for UNPACKDIR and handle both layouts.


# Guard against a half-copied tree: the pipeline above reports only the
# extract side's exit status under a plain POSIX shell.
if [ ! -f "${WOLFBOOT_WOLFSSL_STAGED_SRC}/wolfcrypt/src/asn.c" ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This catches a copy that produced nothing at all. It will not catch one that started fine and died halfway, disk filling up, or a permissions problem part way down. In that case asn.c already exists, the check passes, and the build carries on with an incomplete tree.

Not sure if this is something we want to account for.

# are just a URI bitbake's fetcher understands. COMMERCIAL_BUNDLE_URL takes
# precedence so a recipe can offer the public download as its default while
# still allowing a GCS override.
remote_uri = d.getVar('COMMERCIAL_BUNDLE_URL') or gcs_uri

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When BitBake cannot find a variable, it does not blank it out. It leaves the raw text ${FOO} sitting in the value. That text is not empty, so this test passes it through and it ends up in SRC_URI as if it were a real web address. I tried it and parsing stopped across the whole build with MalformedUrl. The function above already guards for this with not X.startswith('${'), so the same check here would fix it.

# ${WORKDIR}, not ${UNPACKDIR}: the layer still supports pre-styhead
# releases (LAYERSERIES_COMPAT reaches back to sumo) where file:// SRC_URI
# entries unpack straight into ${WORKDIR}.
install -m 0644 ${WORKDIR}/wolfhsm.mk ${D}${datadir}/wolfhsm/wolfhsm.mk

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On newer releases a file:// entry lands in ${UNPACKDIR}, not directly in ${WORKDIR}, so this path points somewhere the file is not. I confirmed it separately by fixing only S, which left this failing on its own with install: cannot stat '.../wolfhsm.mk': No such file or directory.

# order the class resolves them:
#
# 1. WOLFSSL_SRC_DIRECTORY - an already-extracted source tree. No fetch.
# 2. WOLFSSL_SRC_URL - a URL bitbake downloads the archive from. The

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wolfssl-linuxkm-fips-ready.bb still only understands the GCS path, a local directory, and an already-extracted folder. It never sets COMMERCIAL_BUNDLE_URL, so when a user sets WOLFSSL_SRC_URL it builds a file path with no directory and fails on the checksum lookup.

Comment on lines +82 to 88
if remote_uri and bundle_archive:
unpack_flag = ';unpack=false' if bundle_archive.endswith('.7z') else ''
sha_flag = f';sha256sum={bundle_sha}' if bundle_sha else ''
filename_flag = f';downloadfilename={bundle_archive}'
return f'{gcs_uri}{filename_flag}{unpack_flag}{sha_flag}'
return f'{remote_uri}{filename_flag}{unpack_flag}{sha_flag}'

bundle_dir = d.getVar('COMMERCIAL_BUNDLE_DIR')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This task exists to unpack password-protected .7z bundles by hand, which is why it wants a folder to look in. A plain .zip from a URL needs none of that, because BitBake has already downloaded and unpacked it. The task knows this at line 198, where it says "not a .7z, let BitBake handle it" and returns, but line 186 demands the folder first and stops the build before getting there. I built it: do_fetch succeeds, then COMMERCIAL_BUNDLE_DIR not set. Moving :198 above :186 fixes it and leaves the .7z path unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants